125 lines
2.4 KiB
PHP
125 lines
2.4 KiB
PHP
<?php
|
|
namespace Order\Mount;
|
|
|
|
use \Helpers\View as view;
|
|
|
|
//事件中存在的操作
|
|
class PdfForm implements \Order\Listener\PdfFormEvents
|
|
{
|
|
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)
|
|
{
|
|
view::Dump($e->getMessage());
|
|
}
|
|
|
|
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 "请填写项目标题";
|
|
}
|
|
|
|
if(empty($formData['project_leader']))
|
|
{
|
|
return "请填写项目负责人";
|
|
}
|
|
|
|
if(empty($formData['project']))
|
|
{
|
|
return "请填写用途";
|
|
}
|
|
|
|
return true;
|
|
}//checkPdfOrderField
|
|
} |