完善了dataservice与wsn的对接,在pdf生成中,如果有子集选择数据,则添加到附件中
This commit is contained in:
parent
6152c36246
commit
7c131daf89
|
@ -1797,7 +1797,6 @@ class DataController extends Zend_Controller_Action
|
|||
} elseif ($formData['submit']) {
|
||||
//提交
|
||||
//生成PDF
|
||||
|
||||
$orderListener = new OrderListener();
|
||||
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
//生成西部数据中心离线申请表
|
||||
|
||||
use Helpers\View as view;
|
||||
|
||||
require_once('fpdf/chinese-unicode.php');
|
||||
require_once('fpdi/fpdi.php');
|
||||
class ApplicantPDF extends FPDI
|
||||
|
@ -142,5 +145,54 @@ class ApplicantPDF extends FPDI
|
|||
$this->setXY(122,242);
|
||||
$this->Write($this->fontsize,$t);
|
||||
}
|
||||
|
||||
//如果有dataservice内容,则添加
|
||||
public function addSelection($data)
|
||||
{
|
||||
$line = array();
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
if(!empty($v['selection']))
|
||||
{
|
||||
$selection = json_decode($v['selection'],true);
|
||||
$thisline = "".$v['title']."\r\n";
|
||||
foreach($selection as $s)
|
||||
{
|
||||
$thisline .= "".$s['name'].": ";
|
||||
if($s['var'] == -1)
|
||||
{
|
||||
$thisline .= "全部";
|
||||
}else{
|
||||
foreach($s['var'] as $var)
|
||||
{
|
||||
$thisline.= $var["nameview"]."/";
|
||||
}
|
||||
}
|
||||
$thisline .= $s['starttime'] ." - ". $s['endtime'];
|
||||
$thisline .= "\r\n\r\n";
|
||||
}
|
||||
$line[] = $thisline."";
|
||||
}
|
||||
}
|
||||
|
||||
if(count($line) < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addPage();
|
||||
$this->SetFont('ugb','B',20);
|
||||
$this->ln();
|
||||
$this->Cell(0,0,'附件:申请的数据子集',0,2,'C');
|
||||
$this->setY(30);
|
||||
|
||||
foreach($line as $k=>$v)
|
||||
{
|
||||
$this->SetFont('ugb','',10);
|
||||
$this->Write(5,($k+1).'. ' .$v ."\r\n");
|
||||
$this->ln();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -43,11 +43,18 @@ class DataService
|
|||
|
||||
$curl = new Curl();
|
||||
|
||||
$uid = view::User('id');
|
||||
|
||||
if(!is_numeric($uid) || $uid <1)
|
||||
{
|
||||
return "请先登录";
|
||||
}
|
||||
|
||||
if($type == 'site')
|
||||
{
|
||||
$param = array(
|
||||
'uuid'=>$uuid,
|
||||
//'uuid'=> '78e2423f-fe4a-4f9e-a368-c932afc5d257', ///TEST TEST TEST
|
||||
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
|
||||
'uid'=> view::User('id')
|
||||
);
|
||||
$data = $curl->request($info['service_url']."site/",$param,"POST");
|
||||
|
@ -58,7 +65,7 @@ class DataService
|
|||
{
|
||||
$param_temp = array(
|
||||
'uuid'=>$uuid,
|
||||
//'uuid'=> '78e2423f-fe4a-4f9e-a368-c932afc5d257', ///TEST TEST TEST
|
||||
//'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
|
||||
'uid'=> view::User('id'),
|
||||
);
|
||||
$param = array_merge($param,$param_temp);
|
||||
|
@ -69,11 +76,12 @@ class DataService
|
|||
if($type == 'submit')
|
||||
{
|
||||
$param_temp = array(
|
||||
'uuid'=>$uuid,
|
||||
//'uuid'=> '78e2423f-fe4a-4f9e-a368-c932afc5d257', ///TEST TEST TEST
|
||||
//'uuid'=>$uuid,
|
||||
'uuid'=> 'b7beb8bf-58d9-4e58-a945-7b6e1dc7705f', ///TEST TEST TEST
|
||||
'uid'=> view::User('id'),
|
||||
);
|
||||
$param = array_merge($param,$param_temp);
|
||||
|
||||
$data = $curl->request($info['service_url']."insert/",$param,"POST");
|
||||
$data = json_decode($data['response'],TRUE);
|
||||
}
|
||||
|
|
|
@ -308,6 +308,7 @@ class Order
|
|||
if (isset($formData['heihelist'])) $pdf->drawHeihe();
|
||||
|
||||
$pdf->addRef($this->pdfData);
|
||||
$pdf->addSelection($this->pdfData);
|
||||
|
||||
$pdf->addSecurity($this->config->offline->security);
|
||||
|
||||
|
@ -338,7 +339,7 @@ class Order
|
|||
$uid = view::User('id');
|
||||
}
|
||||
|
||||
$sql = "select m.title||'('||m.filesize::text||'MB)' as title,m.ts_published,date_part('year',doi.ts_published) as publish_year,m.citation,m.suppinfo,
|
||||
$sql = "select m.title||'('||m.filesize::text||'MB)' as title,m.ts_published,date_part('year',doi.ts_published) as publish_year,m.citation,m.suppinfo,d.selection,
|
||||
array_to_string(ARRAY(
|
||||
select r.reference from mdref mr left join reference r on mr.refid=r.id
|
||||
where mr.reftype=3 and mr.uuid=d.uuid order by mr.place),'\n'::text) as reference,
|
||||
|
|
|
@ -46,9 +46,12 @@ class PdfOperate implements \Order\listener\PdfEvents
|
|||
|
||||
$dbh = new dbh($this->db);
|
||||
$formData['username'] = $formData['realname'];
|
||||
$formData['userid'] = $uid;
|
||||
|
||||
unset($formData['realname']);
|
||||
unset($formData['save']);
|
||||
unset($formData['submit']);
|
||||
unset($formData['id']);
|
||||
|
||||
if ($row) {
|
||||
$s = $dbh->update($this->tbl_offlineapp,$formData," id={$row['id']} ");
|
||||
|
@ -62,7 +65,12 @@ class PdfOperate implements \Order\listener\PdfEvents
|
|||
if(empty($returnid))
|
||||
{
|
||||
$s = $dbh->insert($this->tbl_offlineapp,$formData);
|
||||
return $s;
|
||||
if($s > 0)
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return "保存失败,请重试";
|
||||
}
|
||||
}else{
|
||||
$id = $dbh->insert($this->tbl_offlineapp,$formData,true);
|
||||
return $id;
|
||||
|
|
|
@ -220,9 +220,9 @@ westdc.dataservice.wsn = {
|
|||
$(this).find('.wsnctl-select-all').click(function(e) {
|
||||
if($(this).attr('checked') == 'checked')
|
||||
{
|
||||
_this.find('.wsnctl-select').attr('disabled','disabled');
|
||||
$(this).parent('label').parent('div').find('.wsnctl-select').attr('disabled','disabled');
|
||||
}else{
|
||||
_this.find('.wsnctl-select').removeAttr('disabled');
|
||||
$(this).parent('label').parent('div').find('.wsnctl-select').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -329,7 +329,6 @@ function setRectangle(east,west,south,north){
|
|||
map: map,
|
||||
});
|
||||
|
||||
markers.push(marker);
|
||||
}
|
||||
|
||||
var bounds = new google.maps.LatLngBounds();
|
||||
|
|
Loading…
Reference in New Issue