init(); $this->drawTitlePage(); $this->drawContent(); } function init() { //$this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro'); //$this->AddUniGBhwFont('ugh','AdobeHeitiStd-Light'); $this->AddUniGBhwFont('uGB'); $this->AddFont('uGB'); } function DrawTitlePage() { $this->AddPage(); $this->Image('http://www.sanjiangyuan.org.cn/images/logo.png',80,30,0,0,'','http://www.sanjiangyuan.org.cn/'); $this->SetFont('uGB','B',20); $this->setXY(0,70); $this->Cell(0,0,'三江源生态监测综合服务平台',0,2,'C',false,'http://'.$_SERVER['SERVER_NAME']); $imgurl='http://'.$_SERVER['SERVER_NAME'].'/service/bigthumb/uuid/'.$this->metadata['uuid']; $imgsize=getimagesize($imgurl); if ($this->metadata['filetype'] && $imgsize) { if ($imgsize[0]/$imgsize[1]>200/180) $this->Image($imgurl,5,110,200,0,$this->metadata['filetype']); else $this->Image($imgurl,100-round(90.0*$imgsize[0]/$imgsize[1]),110,0,180,$this->metadata['filetype']); } $this->SetFont('uGB','B',20); $this->setXY(0,80); $this->multicell(0,10,$this->metadata['title'],0,'C'); //$this->setFont('Arial','',12); $this->ln(10); $this->SetFont('uGB','B',12); $this->Cell(0,0,'UUID: '.$this->metadata['uuid'],0,2,'C',false,'http://'.$_SERVER['SERVER_NAME'].'/data/'.$this->metadata['uuid']); } function DrawContent() { $this->addPage(); $this->setfont('uGB','',12); //$this->setXY(15,80); $this->multicell(0,10,$this->metadata['title'],0,'C','http://'.$_SERVER['SERVER_NAME'].'/data/'.$this->metadata['uuid']); if ($this->metadata['title_en']) { //$this->setFont('times','',12); $this->multicell(0,5,$this->metadata['title_en'],0,'C','http://'.$_SERVER['SERVER_NAME'].'/data/'.$this->metadata['uuid']); } $this->ln(10); $this->setfont('uGB','',10); $this->setFillColor(200,200,200); $this->Cell(0,8,' 摘要',0,1,'L',true); //$this->write(5,$this->metadata['description']); $this->DrawTable($this->metadata['description']); //todo: table in abstract $this->ln(5); $this->Cell(0,8,' 关键词',0,1,'L',true); $this->write(5,'主题:'.$this->metadata['keyword']['theme']); $this->ln(5); $this->write(5,'位置:'.$this->metadata['keyword']['place']); $this->ln(5); $this->write(5,'时间:'.$this->metadata['keyword']['temporal']); $this->ln(5); $this->write(5,'学科:'.$this->metadata['keyword']['discipline']); $this->ln(5); $this->write(5,'地层:'.$this->metadata['keyword']['stratum']); $this->ln(5); $this->Cell(0,8,' 数据分类',0,1,'L',true); $this->write(5,'分类:'.$this->metadata['category'].' '.$this->metadata['category_zh']); $this->ln(5); $this->Cell(0,8,' 数据细节',0,1,'L',true); if ($this->metadata['rfdenom']) { $this->write(5,'比例尺:'.$this->metadata['rfdenom']); $this->ln(5); } if ($this->metadata['resolution']) { $this->write(5,'分辨率:'.$this->metadata['resolution']); $this->ln(5); } $this->write(5,'投影:'.$this->metadata['projection']); $this->ln(5); $this->write(5,'数据大小(MB):'.$this->metadata['filesize']); $this->ln(5); $this->write(5,'数据格式:'.$this->metadata['fileformat']); $this->ln(5); $this->Cell(0,8,' 缩略图和空间范围',0,1,'L',true); $this->ln(5); $x=$this->getX();$y=$this->getY(); $w=50*abs(($this->metadata['north']-$this->metadata['south'])/($this->metadata['west']-$this->metadata['east'])); if ($this->metadata['filetype']) $this->Image('http://'.$_SERVER['SERVER_NAME'].'/service/thumb/uuid/'.$this->metadata['uuid'],$x+80+$w,$y,0,50,$this->metadata['filetype']); $this->rect($x+50,$y,$w,50); $this->setXY($x+55,$y-4); $this->write(5,'N:'.$this->metadata['north']); $this->setXY($x+40,$y+20); $this->write(5,'W:'.$this->metadata['west']); $this->setXY($x+50+$w,$y+20); $this->write(5,'E:'.$this->metadata['east']); $this->setXY($x+55,$y+50); $this->write(5,'S:'.$this->metadata['south']); $this->ln(5); $this->Cell(0,8,' 时间范围',0,1,'L',true); $this->write(5,'开始时间:'.$this->metadata['timebegin']); $this->ln(5); $this->write(5,'结束时间:'.$this->metadata['timeend']); $this->ln(5); $this->Cell(0,8,' 本数据引用方式',0,1,'L',true); $this->write(5,$this->metadata['citation']); $this->ln(5); $this->Cell(0,8,' 建议参考文献',0,1,'L',true); $this->write(5,$this->metadata['reference']); //$this->ln(5); $this->Cell(0,8,' 数据DOI',0,1,'L',true); $this->write(5,$this->metadata['doi']); $this->ln(5); $this->Cell(0,8,' 项目支持信息',0,1,'L',true); $this->write(5,$this->metadata['suppinfo']); $this->ln(5); $this->Cell(0,8,' 使用声明',0,1,'L',true); $this->write(5,$this->metadata['uselimits']); $this->Cell(0,8,' 相关链接',0,1,'L',true); foreach($this->metadata['resources'] as $k=>$r) { $this->write(5,($k+1).'. '.$r['name'].' '.$r['linkage'],$r['linkage']); $this->ln(5); } $this->Cell(0,8,' 相关联系人',0,1,'L',true); $party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'数据服务联系人','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'数据调查与处理者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者'); foreach($this->metadata['contacts'] as $k=>$c) { $this->write(5,($k+1).'. '.$party_zh[$c['role']]);$this->ln(5); $this->write(5,$c['individual'].' 单位:'.$c['organisation']);$this->ln(5); $this->write(5,'地址:'.$c['country'].' '.$c['administractive'].' '.$c['city'].' '.$c['delivery']);$this->ln(5); $this->write(5,'邮编:'.$c['postal'].' 电话:'.$c['phone'].' 邮件:'.$c['email']); $this->ln(5); $this->ln(5); } } function DrawTable($text) { $table=explode("{|",$text); $this->write(5,$table[0]); $table1=explode("|}",$table[1]); $table=explode("|-",$table1[0]); $header=explode("!",str_replace(array("\r\n", "\n", "\r"),'',$table[0])); $data=array(); foreach($table as $line=>$tr) { if ($line>0 && !empty($tr)) { $tr=substr(trim($tr),1); $data[]=explode("||",$tr); } } //Header foreach($header as $k=>$col) if ($k>0) $this->Cell(40,7,$col,1); $this->Ln(); //Data foreach($data as $row) { foreach($row as $col) $this->Cell(40,6,$col,1); $this->Ln(); } $this->write(5,$table1[1]); } function Footer() { //Page footer $this->SetY(-15); $this->SetFont('Arial','I',8); $this->SetTextColor(128); if ($this->PageNo()>1) $this->Cell(0,10,' - '.($this->PageNo()-1).' - ',0,0,'C'); } } ?>