AdminLogic.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * 问答显示逻辑
  4. * @author cp
  5. */
  6. class AdminLogic extends BaseLogic {
  7. private $categorydao;
  8. private $questiondao;
  9. private $creditdao;
  10. private $answerdao;
  11. private $messagedao;
  12. private $examinedao;
  13. function __construct() {
  14. Doo::loadModel ( 'CategoryDao' );
  15. Doo::loadModel ( 'QuestionDao' );
  16. Doo::loadModel ( 'CreditDao' );
  17. Doo::loadModel ( 'AnswerDao' );
  18. Doo::loadModel ( 'MessageDao' );
  19. $this->messagedao = new MessageDao ();
  20. $this->categorydao = new CategoryDao ();
  21. $this->questiondao = new QuestionDao ();
  22. $this->creditdao = new CreditDao ();
  23. $this->answerdao = new AnswerDao ();
  24. Doo::loadModel ( 'ExamineDao' );
  25. $this->examinedao = new ExamineDao ();
  26. }
  27. /**
  28. * 获取审批列表
  29. */
  30. function get_examine_list() {
  31. $list = $this->examinedao->get_examine_list ();
  32. $list = $this->_format_question_data ( $list );
  33. Doo::loadClass ( 'XDeode' );
  34. $XDeode = new XDeode ( 5 );
  35. foreach ( $list as $key => $value ) {
  36. $list [$key] ['idKey'] = $XDeode->encode ( $value ['id'] );
  37. }
  38. return $list;
  39. }
  40. /**
  41. * 清空审批列表
  42. */
  43. function examine_clear() {
  44. $this->examinedao->examine_clear ();
  45. }
  46. function get_examine($idKey = "") {
  47. Doo::loadClass ( 'XDeode' );
  48. $XDeode = new XDeode ( 5 );
  49. $idKey = $XDeode->decode ( $idKey );
  50. if (! is_numeric ( $idKey ))
  51. return array ();
  52. $list = $this->examinedao->get_examine ($idKey);
  53. return $list;
  54. }
  55. function examine_delete($idKey){
  56. Doo::loadClass ( 'XDeode' );
  57. $XDeode = new XDeode ( 5 );
  58. $idKey = $XDeode->decode ( $idKey );
  59. if (! is_numeric ( $idKey ))
  60. return 0;
  61. return $this->examinedao->examine_delete ($idKey);
  62. }
  63. /**
  64. * 格式化问题数据
  65. * @param unknown_type $data
  66. */
  67. function _format_question_data($data = array(), $type = "index", $time_type = "Y-m-d H:i:s") {
  68. foreach ( $data as $key => $value ) {
  69. $data [$key] ['time'] = my_date_format2 ( $value ['time'], $time_type );
  70. $data [$key] ['status'] = format_question_status ( $value ['status'], $type );
  71. }
  72. return $data;
  73. }
  74. /**
  75. * 实现接口 (non-PHPdoc)
  76. * @see BaseLogic::format_email_content()
  77. */
  78. protected function format_email_content($html_templete, $templete_name, $qid, $aid) {
  79. }
  80. /**
  81. * 获取还未审批的数量
  82. *
  83. * @return int
  84. */
  85. function get_unapproved_num() {
  86. $count = $this->examinedao->count(array(
  87. 'where' => 'isdelete = 0',
  88. ));
  89. return $count;
  90. }
  91. }
  92. ?>