westdc-zf1/application/models/ApplicantPDF.php

91 lines
2.7 KiB
PHP

<?php
//生成西部数据中心离线申请表
require_once('fpdf/chinese-unicode.php');
require_once('fpdi/fpdi.php');
class ApplicantPDF extends FPDI
{
public $template;//模板文件的路径
public $data;//包含具体的数据,数组
public $fontsize=10;
function drawWestdc()
{
$pagecount = $this->setSourceFile($this->template);
$tplidx = $this->importPage(1);
$this->addPage();
$this->useTemplate($tplidx);
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
$this->SetFont('ugb','',$this->fontsize);
$this->setXY(71,44);
$this->Write($this->fontsize,$this->data['realname']);
$this->SetXY(34,55);
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist']));
$this->setXY(30,100);
$this->MultiCell(166,4,trim($this->data['project']));
//$this->setXY(34,239);
//$this->Write($this->fontsize,$this->data['realname']);
$this->setXY(32,225);
$this->Write($this->fontsize,$this->data['unit']);
$this->setXY(112,225);
$this->Write($this->fontsize,$this->data['email']);
$this->setXY(174,225);
$this->Write($this->fontsize,$this->data['postcode']);
$this->setXY(32,231);
$this->Write($this->fontsize,$this->data['address']);
$this->setXY(112,231);
$this->Write($this->fontsize,$this->data['phone']);
$t=date("Y-m-d");
$this->setXY(174,231);
$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);
}
}
?>