添加了用户上传申请表的功能
This commit is contained in:
parent
b062e86e04
commit
3f4c945dbf
|
@ -2,7 +2,6 @@
|
|||
use \data\DataService;
|
||||
use Helpers\View as view;
|
||||
use Order\Order;
|
||||
use Order\listener\OrderListener;
|
||||
|
||||
class DataController extends Zend_Controller_Action
|
||||
{
|
||||
|
@ -825,8 +824,6 @@ class DataController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$order = new Order();
|
||||
$orderListener = new OrderListener();
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
$status = $order->addOrder($uuid,json_encode($data['data']['site'],JSON_NUMERIC_CHECK));
|
||||
if($status !== true)
|
||||
{
|
||||
|
@ -1633,8 +1630,6 @@ class DataController extends Zend_Controller_Action
|
|||
//存在历史遗留问题,原来的数据并不能保证唯一
|
||||
|
||||
$order = new Order();
|
||||
$orderListener = new OrderListener();
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
$state = $order->addOrder($uuid);
|
||||
|
||||
if($state !== true)
|
||||
|
@ -1667,8 +1662,6 @@ class DataController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$order = new Order();
|
||||
$orderListener = new OrderListener();
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
$state = $order->addOrder($uuid,$selections);
|
||||
|
||||
if($state !== true)
|
||||
|
@ -1775,10 +1768,6 @@ class DataController extends Zend_Controller_Action
|
|||
|
||||
if (@$formData['save']) {
|
||||
|
||||
$orderListener = new OrderListener();
|
||||
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
|
||||
$order->setPdfData($rows);
|
||||
|
||||
$s = $order->SaveOrder($formData);
|
||||
|
@ -1797,12 +1786,7 @@ class DataController extends Zend_Controller_Action
|
|||
} elseif ($formData['submit']) {
|
||||
//提交
|
||||
//生成PDF
|
||||
$orderListener = new OrderListener();
|
||||
|
||||
@$order->events()->attachAggregate($orderListener);
|
||||
|
||||
$order->setPdfData($rows);
|
||||
|
||||
$s = $order->SubmitOrder($formData);
|
||||
|
||||
if($s !== true)
|
||||
|
@ -1811,81 +1795,125 @@ class DataController extends Zend_Controller_Action
|
|||
return true;
|
||||
}
|
||||
|
||||
//跳转到/data/order,并提示帮助信息,告知用户已经发送EMAIL
|
||||
$this->view->msg = view::Msg('alert-success',"提示信息:您的离线申请已经提交,系统已经发送一封邮件给您,请打印出申请表、签字后扫描为pdf并email给数据中心服务组(仍可以采用邮寄方式),具体信息请参考邮件说明。",0);
|
||||
$this->view->msg = view::Msg('alert-success','提示信息:您的离线申请已经提交,请<a href="/data/order/ac/offline3">在线上传PDF的签字版PDF文件</a>。',0);
|
||||
if (empty($ac)) $ac='offline3';
|
||||
//$this->_redirect('/data/order');
|
||||
}
|
||||
} else {
|
||||
$sql="select u.*,o.* from users u left join offlineapp o on u.id=o.userid where u.id=? ORDER BY o.id DESC";
|
||||
$row=$this->db->fetchRow($sql,array($userid));
|
||||
/*$row=$ut->fetchRow('id='.$userid);
|
||||
$formData['email']=$row->email;
|
||||
$formData['phone']=$row->phone;
|
||||
$formData['realname']=$row->realname;
|
||||
$formData['unit']=$row->unit;
|
||||
$formData['address']=$row->address;
|
||||
$formData['purpose']=$row->project;
|
||||
$formData['id']=$row->id;*/
|
||||
$this->view->formData = $row;
|
||||
}
|
||||
} else
|
||||
} else{
|
||||
$this->view->msg=view::Msg('alert-error',"错误:您还没有提交任何离线申请的数据,或您的数据申请已经提交(等待处理过程中)!",0);
|
||||
}
|
||||
return true;
|
||||
}//pdf
|
||||
|
||||
if($ac == "commitapplicationform")
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$offlineappid = $this->_getParam('offlineappid');
|
||||
|
||||
if(!is_numeric($offlineappid) || $offlineappid < 1)
|
||||
{
|
||||
$this->jsonexit(array('error'=>'参数错误'));
|
||||
return true;
|
||||
}
|
||||
|
||||
$order = new Order();
|
||||
$status = $order->commitApplicationForm($offlineappid);
|
||||
|
||||
if( $status !== true)
|
||||
{
|
||||
$this->jsonexit(array("error"=>$status));
|
||||
}else{
|
||||
$this->jsonexit(array('success'=>1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//index
|
||||
|
||||
$this->view->ac = $ac;
|
||||
$this->_helper->viewRenderer('order');
|
||||
if ($ac=='' || $ac=='online')
|
||||
{
|
||||
$status='d.status=0 and d.ts_approved is not null';
|
||||
$this->view->tabID='order-online';
|
||||
} else if ($ac=='offline1') {
|
||||
$status='d.status in (1)';
|
||||
$this->view->tabID='order-offline1';
|
||||
} else if ($ac=='offline2') {
|
||||
$status='d.status in (2)';
|
||||
$this->view->tabID='order-offline2';
|
||||
} else if ($ac=='offline3') {
|
||||
$status='d.status in (3,4)';
|
||||
$this->view->tabID='order-offline3';
|
||||
} else if ($ac=='offline4') {
|
||||
$status='d.status in (5)';
|
||||
$this->view->tabID='order-offline4';
|
||||
}
|
||||
//显示已经申请的数据,包括已经提交的申请和未提交的申请,还有已经处理完成的申请,正在进行的在线数据下载
|
||||
$sql="select d.*,m.title,m.datatype from dataorder d left join metadata m on d.uuid=m.uuid
|
||||
where $status and d.userid=? order by d.status,d.ts_created desc";
|
||||
where d.userid=? order by d.status,d.ts_created desc";
|
||||
$rows=$this->db->fetchAll($sql,array($userid));
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
/*foreach($rows as $row) {
|
||||
switch ($row['status']){
|
||||
|
||||
$showorders = array();
|
||||
$counts = array(
|
||||
'onlineapp' => 0,
|
||||
'offline1' => 0,
|
||||
'offline2' => 0,
|
||||
'offline3' => 0,
|
||||
'offline4' => 0
|
||||
);
|
||||
|
||||
if(count($rows) > 0) {
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
switch($v['status']) {
|
||||
case 0:
|
||||
$dataorder0[]=$row;
|
||||
$counts['onlineapp'] ++;
|
||||
break;
|
||||
case 1:
|
||||
$dataorder1[]=$row;
|
||||
$counts['offline1'] ++;
|
||||
break;
|
||||
case 2:
|
||||
$counts['offline2'] ++;
|
||||
break;
|
||||
case 3:
|
||||
$counts['offline3'] ++;
|
||||
break;
|
||||
case 4:
|
||||
$dataorder2[]=$row;
|
||||
$counts['offline3'] ++;
|
||||
break;
|
||||
case 5:
|
||||
$dataorder3[]=$row;
|
||||
$counts['offline4'] ++;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
switch($ac){
|
||||
default :
|
||||
if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
|
||||
break;
|
||||
case 'online' :
|
||||
if($v['status'] == 0 && !empty($v['ts_approved']))$showorders[] = $rows[$k];
|
||||
break;
|
||||
case 'offline1' :
|
||||
if($v['status'] == 1) $showorders[] = $rows[$k];
|
||||
break;
|
||||
case 'offline2' :
|
||||
if($v['status'] == 2) $showorders[] = $rows[$k];
|
||||
break;
|
||||
case 'offline3' :
|
||||
if($v['status'] == 3 || $v['status'] == 4) $showorders[] = $rows[$k];
|
||||
$this->view->offlineappid = $v['offlineappid'];
|
||||
$this->view->applicationform = $v['applicationform'];
|
||||
$this->view->offlineappstatus = $v['status'];
|
||||
break;
|
||||
case 'offline4' :
|
||||
if($v['status'] == 5) $showorders[] = $rows[$k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@$this->view->dataorder0=$dataorder0;
|
||||
@$this->view->dataorder1=$dataorder1;
|
||||
@$this->view->dataorder2=$dataorder2;
|
||||
@$this->view->dataorder3=$dataorder3;*/
|
||||
}
|
||||
|
||||
$this->view->counts = $counts;
|
||||
view::addPaginator($showorders,$this,10);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<?php
|
||||
use Helpers\View;
|
||||
use Helpers\dbh;
|
||||
use Files\Files;
|
||||
use Files\Output;
|
||||
use Files\Listener\FileListener;
|
||||
|
||||
class ServiceController extends Zend_Controller_Action
|
||||
{
|
||||
private $limit=10;
|
||||
|
@ -1550,6 +1556,56 @@ class ServiceController extends Zend_Controller_Action
|
|||
|
||||
}
|
||||
|
||||
//上传申请表
|
||||
function uploadapplicationformAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$id = $this->_getParam('offlineappid');
|
||||
|
||||
if(empty($id))
|
||||
{
|
||||
$this->jsonexit(array('error'=>"参数错误"));
|
||||
return true;
|
||||
}
|
||||
|
||||
$uid = view::User('id');
|
||||
if(!is_numeric($uid))
|
||||
{
|
||||
$this->jsonexit(array('error'=>"用户信息读取失败,请重试"));
|
||||
return true;
|
||||
}
|
||||
|
||||
$files = new Files();
|
||||
$FileListener = new FileListener();
|
||||
@$files->events()->attachAggregate($FileListener);
|
||||
|
||||
$statu = $files->uploadApplicationForm($_FILES['Filedata'],$id);
|
||||
|
||||
if(isset($statu['error']))
|
||||
{
|
||||
$this->jsonexit($statu);
|
||||
return true;
|
||||
}else{
|
||||
$sql = "UPDATE dataorder SET applicationform='{$statu['file']}' WHERE offlineappid=$id AND userid=$uid AND status IN (3,4)";
|
||||
if($this->db->exec($sql))
|
||||
{
|
||||
$this->jsonexit(array("success"=>1));
|
||||
return true;
|
||||
}else{
|
||||
$this->jsonexit(array('error'=>"申请表上传失败".$sql));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//下载申请表
|
||||
public function downloadapplicationformAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
输出验证码
|
||||
*/
|
||||
|
@ -1728,4 +1784,9 @@ class ServiceController extends Zend_Controller_Action
|
|||
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
|
||||
}
|
||||
|
||||
public function jsonexit($data){
|
||||
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<div id="upload-form" class="modal hide fade" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="myModalLabel">申请表上传</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="application-form">
|
||||
<div id="fsUploadProgress">允许上传20M以内的 PDF 文件</div>
|
||||
<input type="file" name="Filedata" id="file_upload" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">取消上传</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
_this.SessionID = '<?php echo session_id(); ?>';
|
||||
</script>
|
|
@ -3,11 +3,10 @@
|
|||
$this->headTitle($this->config->title->data);
|
||||
$this->headTitle('离线申请');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||
$this->breadcrumb('离线申请');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
|
||||
$this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
$this->theme->AppendPlus($this,'uploadify');
|
||||
$this->theme->AppendModel($this,'offlineapp-uploader');
|
||||
?>
|
||||
<?= $this->render('breadcrumbs.phtml') ?>
|
||||
<div class="row">
|
||||
|
@ -28,11 +27,11 @@ $this->nav[] = array('link'=>"/data/order",'title'=>'数据蓝');
|
|||
?>
|
||||
<ul class="nav nav-tabs">
|
||||
|
||||
<li id="Nav-order-offline1"><a href="/data/order/ac/offline1">未提交的数据</a></li>
|
||||
<li id="Nav-order-offline2"><a href="/data/order/ac/offline2">正在提交的数据</a></li>
|
||||
<li id="Nav-order-offline3"><a href="/data/order/ac/offline3">等待通过的申请</a></li>
|
||||
<li id="Nav-order-offline4"><a href="/data/order/ac/offline4">已通过的申请</a></li>
|
||||
<li id="Nav-order-online"><a href="/data/order/ac/online">在线数据</a></li>
|
||||
<li id="Nav-order-offline1"><a href="/data/order/ac/offline1">未提交的数据<?= !empty($this->counts['offline1']) ? '<span class="badge badge-info">'.$this->counts['offline1'].'</span>':'' ?></a></li>
|
||||
<li id="Nav-order-offline2"><a href="/data/order/ac/offline2">正在提交的数据<?= !empty($this->counts['offline2']) ? '<span class="badge badge-info">'.$this->counts['offline2'].'</span>':'' ?></a></li>
|
||||
<li id="Nav-order-offline3"><a href="/data/order/ac/offline3">等待通过的申请<?= !empty($this->counts['offline3']) ? '<span class="badge badge-info">'.$this->counts['offline3'].'</span>':'' ?></a></li>
|
||||
<li id="Nav-order-offline4"><a href="/data/order/ac/offline4">已通过的申请<?= !empty($this->counts['offline4']) ? '<span class="badge badge-info">'.$this->counts['offline4'].'</span>':'' ?></a></li>
|
||||
<li id="Nav-order-online"><a href="/data/order/ac/online">在线数据<?= !empty($this->counts['onlineapp']) ? '<span class="badge badge-info">'.$this->counts['onlineapp'].'</span>':'' ?></a></li>
|
||||
</ul>
|
||||
<!-- content -->
|
||||
<?php if (!empty($this->paginator)) : ?>
|
||||
|
@ -47,7 +46,17 @@ echo '<a class="btn btn-primary" href="/data/order/apply/all">提交所有数据
|
|||
} elseif ($this->tabID=='order-offline2') {
|
||||
echo '<a class="btn btn-primary" href="/data/order/pdf/1">提交离线申请</a>';
|
||||
} elseif ($this->tabID=='order-offline3') {
|
||||
echo '申请状态';
|
||||
if(count($this->paginator))
|
||||
{
|
||||
if(empty($this->applicationform))
|
||||
echo '<a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传申请表</a>';
|
||||
else
|
||||
if($this->offlineappstatus == 3)
|
||||
{
|
||||
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传申请表</a> ';
|
||||
echo '<a class="btn btn-success" href="javascript:void(0);" onclick="commit('.$this->offlineappid.');">确认申请</a>';
|
||||
}
|
||||
}
|
||||
} elseif ($this->tabID=='order-offline4') {
|
||||
echo '通过时间';
|
||||
}
|
||||
|
@ -72,7 +81,10 @@ if ($this->tabID=='order-offline1') {
|
|||
echo ' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
|
||||
break;
|
||||
case 3:
|
||||
echo "请打印签字扫描为pdf并email或邮寄";
|
||||
if(!empty($order['applicationform']))
|
||||
echo '<span class="label label-success">申请表已上传</span>';
|
||||
else
|
||||
echo '<span class="label label-warning">请上传申请表</span>';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -80,10 +92,16 @@ if ($this->tabID=='order-offline1') {
|
|||
} elseif ($this->tabID=='order-offline3') {
|
||||
switch($order['status']) {
|
||||
case 3:
|
||||
echo "请打印签字扫描为pdf并email或邮寄";
|
||||
if(!empty($order['applicationform']))
|
||||
echo '<span class="label label-success">申请表已上传</span>';
|
||||
else
|
||||
echo '<span class="label label-warning">请上传申请表</span>';
|
||||
break;
|
||||
case 4:
|
||||
echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));
|
||||
if(!empty($order['applicationform']))
|
||||
{ echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));}
|
||||
else
|
||||
echo '<span class="label label-warning">请上传申请表</span>';
|
||||
break;
|
||||
case 5:
|
||||
echo "已通过申请,请查收邮件";
|
||||
|
@ -105,3 +123,7 @@ if ($this->tabID=='order-offline1') {
|
|||
</div><!--/span-->
|
||||
</div><!--/row-->
|
||||
<script>$('#Nav-<?= $this->tabID?>').addClass("active");</script>
|
||||
<script>
|
||||
var _this = {};
|
||||
</script>
|
||||
<?= $this->partial('data/offlineapp-uploaderform.phtml'); ?>
|
||||
|
|
Loading…
Reference in New Issue