添加保密协议支持及数据引用信息支持

This commit is contained in:
wlx 2011-11-22 14:22:09 +00:00
parent 6359ffcad2
commit 2fb79b587d
2 changed files with 57 additions and 4 deletions

View File

@ -1078,7 +1078,7 @@ class DataController extends Zend_Controller_Action
//生成PDF离线申请文件 //生成PDF离线申请文件
//用户信息可以从SESSION中读取离线申请信息 //用户信息可以从SESSION中读取离线申请信息
//$sql="select * from users where id=?"; //$sql="select * from users where id=?";
$sql="select m.title||'('||m.filesize::text||'MB)' as title from dataorder d left join metadata m on d.uuid=m.uuid where d.status=2 and d.userid=? order by d.ts_created desc"; $sql="select m.title||'('||m.filesize::text||'MB)' as title,m.citation,m.suppinfo from dataorder d left join metadata m on d.uuid=m.uuid where d.status=2 and d.userid=? order by d.ts_created desc";
$rows=$this->db->fetchAll($sql,array($userid)); $rows=$this->db->fetchAll($sql,array($userid));
if ($rows) { if ($rows) {
$this->view->data2=$rows; $this->view->data2=$rows;
@ -1110,7 +1110,9 @@ class DataController extends Zend_Controller_Action
$pdf = new ApplicantPDF(); $pdf = new ApplicantPDF();
$pdf->template=$this->view->config->offline->template; $pdf->template=$this->view->config->offline->template;
$pdf->data = $formData; $pdf->data = $formData;
$pdf->drawWestdc(); $pdf->drawWestdc();
$pdf->addRef($rows);
$pdf->addSecurity($this->view->config->offline->security);
header("Content-Disposition: inline; filename=westdc-data-apply.pdf"); header("Content-Disposition: inline; filename=westdc-data-apply.pdf");
header("Content-Type:application/pdf"); header("Content-Type:application/pdf");
//header("Content-Length: " . strlen($pdfstring)); //header("Content-Length: " . strlen($pdfstring));
@ -1124,7 +1126,8 @@ class DataController extends Zend_Controller_Action
$pdf->template=$this->view->config->offline->template; $pdf->template=$this->view->config->offline->template;
$pdf->data = $formData; $pdf->data = $formData;
$pdf->drawWestdc(); $pdf->drawWestdc();
$pdf->addRef($rows);
$pdf->addSecurity($this->view->config->offline->security);
$fn=$formData['realname'].date('YmdHis').".pdf"; $fn=$formData['realname'].date('YmdHis').".pdf";
$pdf->Output($this->view->config->offline->savepath."/".$fn, 'F'); $pdf->Output($this->view->config->offline->savepath."/".$fn, 'F');

View File

@ -15,7 +15,7 @@ class ApplicantPDF extends FPDI
$this->useTemplate($tplidx); $this->useTemplate($tplidx);
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro'); $this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
$this->SetFont('ugb','',$this->fontsize); $this->SetFont('ugb','',$this->fontsize);
$this->setXY(71,45); $this->setXY(71,44);
$this->Write($this->fontsize,$this->data['realname']); $this->Write($this->fontsize,$this->data['realname']);
$this->SetXY(34,55); $this->SetXY(34,55);
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist'])); $this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist']));
@ -37,5 +37,55 @@ class ApplicantPDF extends FPDI
$this->setXY(174,231); $this->setXY(174,231);
$this->Write($this->fontsize,$t); $this->Write($this->fontsize,$t);
} }
function addRef($mds)
{
$this->addPage();
$this->SetFont('ugb','B',20);
$this->ln();
$this->Cell(0,0,'附件:数据引用信息',0,2,'C');
$this->setY(30);
foreach($mds as $i=>$md)
{
$this->SetFont('ugb','',12);
$this->Write(5,($i+1).'. '.$md['title']);
$this->ln();
if ($md['citation'])
{
$this->Write(5,'【建议引用方式】'.$md['citation']);
$this->ln();
}
if ($md['suppinfo'])
{
$this->SetFont('ugb','I',10);
$this->Write(5,'【项目支持信息】'.$md['suppinfo']);
$this->ln();
}
$this->ln();
}
}
function addSecurity($template_file)
{
$pagecount = $this->setSourceFile($template_file);
$tplidx = $this->importPage(1);
$this->addPage();
$this->useTemplate($tplidx);
$this->SetFont('ugb','B',14);
$this->setXY(46,43);
$this->Write(10,$this->data['realname']);
$this->SetFont('ugb','',12);
$this->setXY(122,194);
$this->Write(10,$this->data['realname']);
$this->setXY(122,201);
$this->Write($this->fontsize,$this->data['address']);
$this->setXY(122,209);
$this->Write($this->fontsize,$this->data['phone']);
$this->setXY(122,216);
$this->Write($this->fontsize,$this->data['email']);
$t=date("Y-m-d");
$this->setXY(32,246);
$this->Write($this->fontsize,$t);
$this->setXY(122,246);
$this->Write($this->fontsize,$t);
}
} }
?> ?>