2009-03-06 03:20:46 +00:00
|
|
|
<?php
|
|
|
|
//生成西部数据中心离线申请表
|
|
|
|
require_once('fpdf/chinese-unicode.php');
|
2009-07-17 09:45:44 +00:00
|
|
|
require_once('fpdi/fpdi.php');
|
2009-03-06 03:20:46 +00:00
|
|
|
class ApplicantPDF extends FPDI
|
|
|
|
{
|
|
|
|
public $template;//模板文件的路径
|
2013-07-17 08:04:33 +00:00
|
|
|
public $heihetemplate;//模板文件的路径
|
2009-03-06 03:20:46 +00:00
|
|
|
public $data;//包含具体的数据,数组
|
|
|
|
public $fontsize=10;
|
2013-07-17 08:04:33 +00:00
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro');
|
|
|
|
}
|
2009-03-06 03:20:46 +00:00
|
|
|
function drawWestdc()
|
|
|
|
{
|
|
|
|
$pagecount = $this->setSourceFile($this->template);
|
2011-11-22 12:46:58 +00:00
|
|
|
$tplidx = $this->importPage(1);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->addPage();
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->useTemplate($tplidx);
|
|
|
|
$this->SetFont('ugb','',$this->fontsize);
|
|
|
|
$this->setXY(74,43);
|
|
|
|
$this->Write($this->fontsize,$this->data['realname']);
|
|
|
|
$this->SetXY(34,55);
|
|
|
|
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['westdclist']));
|
|
|
|
$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,223);
|
|
|
|
$this->Write($this->fontsize,$this->data['unit']);
|
|
|
|
$this->setXY(112,223);
|
|
|
|
$this->Write($this->fontsize,$this->data['email']);
|
|
|
|
$this->setXY(174,223);
|
|
|
|
$this->Write($this->fontsize,$this->data['postcode']);
|
|
|
|
$this->setXY(32,230);
|
|
|
|
$this->Write($this->fontsize,$this->data['address']);
|
|
|
|
$this->setXY(112,230);
|
|
|
|
$this->Write($this->fontsize,$this->data['phone']);
|
|
|
|
$t=date("Y-m-d");
|
|
|
|
$this->setXY(174,230);
|
|
|
|
$this->Write($this->fontsize,$t);
|
|
|
|
}
|
|
|
|
function drawHeihe()
|
|
|
|
{
|
|
|
|
$pagecount = $this->setSourceFile($this->heihetemplate);
|
|
|
|
$tplidx = $this->importPage(1);
|
|
|
|
$this->addPage();
|
|
|
|
$this->useTemplate($tplidx);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->SetFont('ugb','',$this->fontsize);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(88,43);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['realname']);
|
2011-11-22 12:46:58 +00:00
|
|
|
$this->SetXY(34,55);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->MultiCell (166, 4, str_replace(";","\n",$this->data['heihelist']));
|
2011-11-22 12:46:58 +00:00
|
|
|
$this->setXY(30,100);
|
2010-11-04 13:53:23 +00:00
|
|
|
$this->MultiCell(166,4,trim($this->data['project']));
|
|
|
|
//$this->setXY(34,239);
|
|
|
|
//$this->Write($this->fontsize,$this->data['realname']);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(32,223);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['unit']);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(112,223);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['email']);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(174,223);
|
2011-11-22 12:46:58 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['postcode']);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(32,230);
|
2011-11-22 12:46:58 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['address']);
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(112,230);
|
2009-03-06 03:20:46 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['phone']);
|
2011-11-22 12:46:58 +00:00
|
|
|
$t=date("Y-m-d");
|
2013-07-17 08:04:33 +00:00
|
|
|
$this->setXY(174,230);
|
2011-11-22 12:46:58 +00:00
|
|
|
$this->Write($this->fontsize,$t);
|
2009-03-06 03:20:46 +00:00
|
|
|
}
|
2011-11-22 14:22:09 +00:00
|
|
|
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();
|
2013-07-02 06:44:01 +00:00
|
|
|
if ($md['reference'])
|
|
|
|
{
|
|
|
|
$this->Write(5,'【引用方式】'.$md['reference']);
|
|
|
|
$this->ln();
|
|
|
|
if (!empty($md['publish_year']))
|
|
|
|
{
|
|
|
|
$this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', '
|
|
|
|
.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).
|
|
|
|
'. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en']
|
|
|
|
.'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']');
|
|
|
|
$this->ln();
|
|
|
|
}
|
|
|
|
} elseif ($md['citation'])
|
|
|
|
{
|
|
|
|
$this->Write(5,'【引用方式】'.$md['citation']);
|
2011-11-22 14:22:09 +00:00
|
|
|
$this->ln();
|
2013-07-02 06:44:01 +00:00
|
|
|
if (!empty($md['publish_year']) && !strpos($md['citation'],$md['datadoi']))
|
|
|
|
{
|
|
|
|
$this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', '
|
|
|
|
.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).
|
|
|
|
'. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en']
|
|
|
|
.'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']');
|
|
|
|
$this->ln();
|
|
|
|
}
|
2011-11-22 14:22:09 +00:00
|
|
|
}
|
2013-07-02 06:44:01 +00:00
|
|
|
if ($md['suppinfo'] || $md['fund'])
|
2011-11-22 14:22:09 +00:00
|
|
|
{
|
|
|
|
$this->SetFont('ugb','I',10);
|
2013-07-02 06:44:01 +00:00
|
|
|
$p=(!empty($md['fund']))?$md['fund']:$md['suppinfo'];
|
|
|
|
$this->Write(5,'【项目信息】'.$p);
|
2011-11-22 14:22:09 +00:00
|
|
|
$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);
|
2013-07-02 03:32:51 +00:00
|
|
|
$this->setXY(46,51);
|
2011-11-22 14:22:09 +00:00
|
|
|
$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']);
|
2013-07-02 03:32:51 +00:00
|
|
|
$this->setXY(122,208);
|
2011-11-22 14:22:09 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['phone']);
|
2013-07-02 03:32:51 +00:00
|
|
|
$this->setXY(122,215);
|
2011-11-22 14:22:09 +00:00
|
|
|
$this->Write($this->fontsize,$this->data['email']);
|
|
|
|
$t=date("Y-m-d");
|
2013-07-02 03:32:51 +00:00
|
|
|
$this->setXY(32,242);
|
2011-11-22 14:22:09 +00:00
|
|
|
$this->Write($this->fontsize,$t);
|
2013-07-02 03:32:51 +00:00
|
|
|
$this->setXY(122,242);
|
2011-11-22 14:22:09 +00:00
|
|
|
$this->Write($this->fontsize,$t);
|
|
|
|
}
|
2009-03-06 03:20:46 +00:00
|
|
|
}
|
|
|
|
?>
|