westdc-zf1/application/module/Reference/Handler/ReferenceHandler.php

61 lines
1.1 KiB
PHP

<?php
namespace Reference\Handler;
use Helpers\View as view;
use Helpers\dbh;
//事件中存在的操作
class ReferenceHandler implements \Reference\Event\ReferenceEvent
{
private $db; //传入PDO对象误
private $config; //全局配置
public $tbl_maillog = ""; //邮件日志表
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 checkReferenceParam(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
if(!is_array($data))
{
return "参数错误";
}
if(empty($data["title"]))
{
return "请输入标题";
}
if(empty($data['reference']))
{
return "请输入前台引用方式,并且唯一";
}
return true;
}
public function processReferenceData(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
if(empty($data['attid']))
{
$data['attid'] = 0;
}
return $data;
}
}