cms_comment.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * cms评论
  4. *
  5. *
  6. *
  7. ***/
  8. defined('InShopNC') or exit('Access Invalid!');
  9. class cms_commentControl extends SystemControl{
  10. public function __construct(){
  11. parent::__construct();
  12. Language::read('cms');
  13. }
  14. public function indexOp() {
  15. $this->comment_manageOp();
  16. }
  17. /**
  18. * 评论管理
  19. */
  20. public function comment_manageOp() {
  21. $condition = array();
  22. if(!empty($_GET['comment_id'])) {
  23. $condition['comment_id'] = intval($_GET['comment_id']);
  24. }
  25. if(!empty($_GET['member_name'])) {
  26. $condition['member_name'] = array('like','%'.trim($_GET['member_name']).'%');
  27. }
  28. if(!empty($_GET['comment_type'])) {
  29. $condition['comment_type'] = intval($_GET['comment_type']);
  30. }
  31. if(!empty($_GET['comment_object_id'])) {
  32. $condition['comment_object_id'] = intval($_GET['comment_object_id']);
  33. }
  34. if(!empty($_GET['comment_message'])) {
  35. $condition['comment_message'] = array('like','%'.trim($_GET['comment_message']).'%');
  36. }
  37. $model_comment = Model("cms_comment");
  38. $comment_list = $model_comment->getListWithUserInfo($condition,10,'comment_time desc');
  39. Tpl::output('list',$comment_list);
  40. Tpl::output('show_page',$model_comment->showpage(2));
  41. $this->get_type_array();
  42. $this->show_menu('comment_manage');
  43. Tpl::showpage('cms_comment.manage');
  44. }
  45. /**
  46. * 获取类型数组
  47. */
  48. private function get_type_array() {
  49. $type_array = array();
  50. $type_array[1] = array('name'=>Language::get('cms_text_artcile'),'key'=>'article');
  51. $type_array[2] = array('name'=>Language::get('cms_text_picture'),'key'=>'picture');
  52. Tpl::output('type_array',$type_array);
  53. }
  54. /**
  55. * 评论删除
  56. */
  57. public function comment_dropOp() {
  58. $model = Model('cms_comment');
  59. $condition = array();
  60. $condition['comment_id'] = array('in',trim($_POST['comment_id']));
  61. $result = $model->drop($condition);
  62. if($result) {
  63. $this->log(Language::get('cms_log_comment_drop').$_POST['comment_id'], 1);
  64. showMessage(Language::get('nc_common_del_succ'),'');
  65. } else {
  66. $this->log(Language::get('cms_log_comment_drop').$_POST['comment_id'], 0);
  67. showMessage(Language::get('nc_common_del_fail'),'','','error');
  68. }
  69. }
  70. private function show_menu($menu_key) {
  71. $menu_array = array(
  72. "{$menu_key}"=>array('menu_type'=>'link','menu_name'=>Language::get('nc_manage'),'menu_url'=>'index.php?act=cms_comment&op='.$menu_key),
  73. );
  74. $menu_array[$menu_key]['menu_type'] = 'text';
  75. Tpl::output('menu',$menu_array);
  76. }
  77. }