westdc-zf1/vendor/Sookon/Article/Handle/CategoryHandle.php

81 lines
1.3 KiB
PHP

<?php
namespace Sookon\Article\Handle;
use Sookon\Helpers\PDO as Pdo;
use Sookon\Helpers\Config;
use Sookon\Helpers\View as view;
use Sookon\Mail\Mail;
use Sookon\Search\Search;
use Zend\EventManager\EventInterface;
class CategoryHandle
{
private $db;
private $config;
function __construct($db = NULL)
{
$this->db = new Pdo();
$this->config = Config::get();
}
//检查字段
public function checkParam(EventInterface $e){
$data = $e->getParam('data');
if(!is_array($data))
{
return "参数错误";
}
if(empty($data["title"]))
{
return "请输入标题";
}
if(empty($data["code"]))
{
return "请输入栏目url代码";
}
return true;
}//checkParam
//处理字段
public function processData(EventInterface $e)
{
$data = $e->getParam('data');
$category = new \Sookon\Article\Category;
$LftRgt = $category->Insert($data['tid']);
$data['lft'] = $LftRgt['left'];
$data['rgt'] = $LftRgt['right'];
return $data;
}
//发布
public function recordPosted(EventInterface $e)
{
$data = $e->getParam('data');
//return $data;
}
//更改
public function recordChanged(EventInterface $e)
{
$data = $e->getParam('data');
$id = $e->getParam('id');
//return $data;
}
}