XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
comment.admin.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
13 {
14 
19  function init()
20  {
21 
22  }
23 
29  {
30  // option to get a list
31  $args = new stdClass();
32  $args->page = Context::get('page'); // /< Page
33  $args->list_count = 30; // / the number of postings to appear on a single page
34  $args->page_count = 5; // / the number of pages to appear on the page navigation
35 
36  $args->sort_index = 'list_order'; // /< Sorting values
37 
38  $args->module_srl = Context::get('module_srl');
39  /*
40  $search_target = Context::get('search_target');
41  $search_keyword = Context::get('search_keyword');
42  if ($search_target == 'is_published' && $search_keyword == 'Y')
43  {
44  $args->status = 1;
45  }
46  if ($search_target == 'is_published' && $search_keyword == 'N')
47  {
48  $args->status = 0;
49  }
50  */
51 
52  // get a list by using comment->getCommentList.
53  $oCommentModel = getModel('comment');
54  $secretNameList = $oCommentModel->getSecretNameList();
55  $columnList = array('comment_srl', 'document_srl','module_srl','is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count');
56  $output = $oCommentModel->getTotalCommentList($args, $columnList);
57 
58  // $modules = $oCommentModel->getDistinctModules();
59  // $modules_list = $modules;
60 
61  // set values in the return object of comment_model:: getTotalCommentList() in order to use a template.
62  Context::set('total_count', $output->total_count);
63  Context::set('total_page', $output->total_page);
64  Context::set('page', $output->page);
65  Context::set('comment_list', $output->data);
66  // Context::set('modules_list', $modules_list);
67  Context::set('page_navigation', $output->page_navigation);
68  Context::set('secret_name_list', $secretNameList);
69 
70  $oModuleModel = getModel('module');
71  $module_list = array();
72  $mod_srls = array();
73  foreach($output->data as $val)
74  {
75  $mod_srls[] = $val->module_srl;
76  }
77  $mod_srls = array_unique($mod_srls);
78  // Module List
79  $mod_srls_count = count($mod_srls);
80  if($mod_srls_count)
81  {
82  $columnList = array('module_srl', 'mid', 'browser_title');
83  $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
84  if($module_output && is_array($module_output))
85  {
86  foreach($module_output as $module)
87  {
88  $module_list[$module->module_srl] = $module;
89  }
90  }
91  }
92  Context::set('module_list', $module_list);
93 
94  $security = new Security();
95  $security->encodeHTML('search_target', 'search_keyword');
96 
97  // set the template
98  $this->setTemplatePath($this->module_path . 'tpl');
99  $this->setTemplateFile('comment_list');
100  }
101 
107  {
108  // option to get a blacklist
109  $args = new stdClass();
110  $args->page = Context::get('page'); // /< Page
111  $args->list_count = 30; // /< the number of comment postings to appear on a single page
112  $args->page_count = 10; // /< the number of pages to appear on the page navigation
113 
114  $args->sort_index = 'comment_declared.declared_count'; // /< sorting values
115  $args->order_type = 'desc'; // /< sorted value
116  // get a list
117  $declared_output = executeQuery('comment.getDeclaredList', $args);
118  $oCommentModel = getModel('comment');
119 
120  if($declared_output->data && count($declared_output->data))
121  {
122  $comment_list = array();
123 
124  foreach($declared_output->data as $key => $comment)
125  {
126  $comment_list[$key] = new commentItem();
127  $comment_list[$key]->setAttribute($comment);
128  }
129  $declared_output->data = $comment_list;
130  }
131 
132  $secretNameList = $oCommentModel->getSecretNameList();
133 
134  // set values in the return object of comment_model:: getCommentList() in order to use a template.
135  Context::set('total_count', $declared_output->total_count);
136  Context::set('total_page', $declared_output->total_page);
137  Context::set('page', $declared_output->page);
138  Context::set('comment_list', $declared_output->data);
139  Context::set('page_navigation', $declared_output->page_navigation);
140  Context::set('secret_name_list', $secretNameList);
141  // set the template
142  $this->setTemplatePath($this->module_path . 'tpl');
143  $this->setTemplateFile('declared_list');
144  }
145 
146 }
147 /* End of file comment.admin.view.php */
148 /* Location: ./modules/comment/comment.admin.view.php */
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
$output
Definition: ko.install.php:193
set($key, $val, $set_to_get_vars=0)
$args
Definition: ko.install.php:185
getModel($module_name)
Definition: func.inc.php:145
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
$module
Class name of Xe Module that is identified by mid.