123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- /**
- * 问答显示逻辑
- * @author cp
- */
- class AdminLogic extends BaseLogic {
- private $categorydao;
- private $questiondao;
- private $creditdao;
- private $answerdao;
- private $messagedao;
- private $examinedao;
- function __construct() {
- Doo::loadModel ( 'CategoryDao' );
- Doo::loadModel ( 'QuestionDao' );
- Doo::loadModel ( 'CreditDao' );
- Doo::loadModel ( 'AnswerDao' );
- Doo::loadModel ( 'MessageDao' );
-
- $this->messagedao = new MessageDao ();
- $this->categorydao = new CategoryDao ();
- $this->questiondao = new QuestionDao ();
- $this->creditdao = new CreditDao ();
- $this->answerdao = new AnswerDao ();
-
- Doo::loadModel ( 'ExamineDao' );
- $this->examinedao = new ExamineDao ();
- }
-
- /**
- * 获取审批列表
- */
- function get_examine_list() {
- $list = $this->examinedao->get_examine_list ();
- $list = $this->_format_question_data ( $list );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- foreach ( $list as $key => $value ) {
- $list [$key] ['idKey'] = $XDeode->encode ( $value ['id'] );
- }
-
- return $list;
- }
-
- /**
- * 清空审批列表
- */
- function examine_clear() {
- $this->examinedao->examine_clear ();
- }
- function get_examine($idKey = "") {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $idKey = $XDeode->decode ( $idKey );
- if (! is_numeric ( $idKey ))
- return array ();
- $list = $this->examinedao->get_examine ($idKey);
- return $list;
- }
-
- function examine_delete($idKey){
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $idKey = $XDeode->decode ( $idKey );
- if (! is_numeric ( $idKey ))
- return 0;
-
- return $this->examinedao->examine_delete ($idKey);
- }
-
- /**
- * 格式化问题数据
- * @param unknown_type $data
- */
- function _format_question_data($data = array(), $type = "index", $time_type = "Y-m-d H:i:s") {
- foreach ( $data as $key => $value ) {
- $data [$key] ['time'] = my_date_format2 ( $value ['time'], $time_type );
- $data [$key] ['status'] = format_question_status ( $value ['status'], $type );
- }
- return $data;
- }
-
- /**
- * 实现接口 (non-PHPdoc)
- * @see BaseLogic::format_email_content()
- */
- protected function format_email_content($html_templete, $templete_name, $qid, $aid) {
- }
- /**
- * 获取还未审批的数量
- *
- * @return int
- */
- function get_unapproved_num() {
- $count = $this->examinedao->count(array(
- 'where' => 'isdelete = 0',
- ));
- return $count;
- }
- }
- ?>
|