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 "This data could not be ordered."; } if($this->checkOrderNum(true,$uid) === false) { return "Max items reached in your order."; } if($this->checkOrderHas($uuid,$uid)) { return "You have already ordered this item."; } }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 "Please input your real name"; } if(empty($formData['email'])) { return "Please input your Email"; } if (!preg_match('/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/',$formData['email'])) { return "Please correct the email"; } if(empty($formData['phone'])) { return "Please input your phone"; } if(empty($formData['unit'])) { return "Please input your company or organization."; } if(empty($formData['address'])) { return "Please input your address."; } if(empty($formData['postcode']) || !is_numeric($formData['postcode'])) { return "Please input the post code."; } if(empty($formData['project_id'])) { return "Please input the fund number."; } if(empty($formData['project_type'])) { return "Please choice the fund type."; } if(empty($formData['project_title'])) { return "Please input the fund title."; } if(empty($formData['project_leader'])) { return "Please input the fund PI."; } if(empty($formData['project'])) { return "Please input your usage."; } return true; }//checkPdfOrderField }