2013-07-24 10:11:14 +00:00
|
|
|
<?php
|
2013-11-05 03:57:01 +00:00
|
|
|
namespace Order\Mount;
|
2013-08-26 02:33:44 +00:00
|
|
|
|
2013-11-05 03:57:01 +00:00
|
|
|
use \Helpers\View as view;
|
2013-07-24 10:11:14 +00:00
|
|
|
|
|
|
|
//事件中存在的操作
|
2013-11-05 03:57:01 +00:00
|
|
|
class PdfForm implements \Order\Listener\PdfFormEvents
|
2013-07-24 10:11:14 +00:00
|
|
|
{
|
|
|
|
private $db;
|
|
|
|
private $config;
|
|
|
|
|
|
|
|
//!!!!!!important!!!!!
|
|
|
|
//不同项目使用时是否要修改此项??
|
|
|
|
public $tbl_metadata = "heihemetadata";
|
|
|
|
public $tbl_dataorder = "dataorder";
|
|
|
|
|
|
|
|
function __construct($db = NULL)
|
|
|
|
{
|
|
|
|
if(empty($db))
|
|
|
|
{
|
|
|
|
$this->db = \Zend_Registry::get('db');
|
|
|
|
}else{
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->config = \Zend_Registry::get('config');
|
|
|
|
}
|
|
|
|
|
|
|
|
//提交申请
|
|
|
|
public function submit(\Zend_EventManager_Event $e)
|
|
|
|
{
|
|
|
|
$uuid = $e->getParam('uuid');
|
|
|
|
$uid = $e->getParam('uid');
|
|
|
|
|
|
|
|
try{
|
|
|
|
if($this->checkOrderUUID($uuid) !== false)
|
|
|
|
{
|
|
|
|
return "此数据尚未正式发布,还不能申请";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->checkOrderNum(true,$uid) === false)
|
|
|
|
{
|
|
|
|
return "您的数据篮中存放的数据已达到可申请的数量";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->checkOrderHas($uuid,$uid))
|
|
|
|
{
|
|
|
|
return "此数据已经在数据篮中";
|
|
|
|
}
|
|
|
|
}catch(Exception $e)
|
|
|
|
{
|
2013-08-26 02:33:44 +00:00
|
|
|
view::Dump($e->getMessage());
|
2013-07-24 10:11:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//checkPdfOrderField 检查PDF申请表的信息
|
|
|
|
public function checkPdfOrderField(\Zend_EventManager_Event $e)
|
|
|
|
{
|
|
|
|
$formData = $e->getParam('formData');
|
|
|
|
|
|
|
|
if(empty($formData['realname']))
|
|
|
|
{
|
|
|
|
return "请输入真实姓名";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['email']))
|
|
|
|
{
|
|
|
|
return "请输入Email";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!preg_match('/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',$formData['email']))
|
|
|
|
{
|
|
|
|
return "请输入正确的电子邮件地址";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['phone']))
|
|
|
|
{
|
|
|
|
return "请输入联系电话";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['unit']))
|
|
|
|
{
|
|
|
|
return "请输入单位";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['address']))
|
|
|
|
{
|
|
|
|
return "请输入地址";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['postcode']) || !is_numeric($formData['postcode']))
|
|
|
|
{
|
|
|
|
return "请输入邮政编码";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['project_id']))
|
|
|
|
{
|
|
|
|
return "请输入项目编号";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['project_type']))
|
|
|
|
{
|
|
|
|
return "请选择项目类型";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(empty($formData['project_title']))
|
|
|
|
{
|
|
|
|
return "请填写项目标题";
|
|
|
|
}
|
|
|
|
|
2013-09-06 03:41:46 +00:00
|
|
|
if(empty($formData['project_leader']))
|
2013-08-28 01:41:49 +00:00
|
|
|
{
|
|
|
|
return "请填写项目负责人";
|
|
|
|
}
|
|
|
|
|
2013-07-24 10:11:14 +00:00
|
|
|
if(empty($formData['project']))
|
|
|
|
{
|
|
|
|
return "请填写用途";
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}//checkPdfOrderField
|
|
|
|
}
|