XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
document.admin.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
12 {
17  function init()
18  {
19  // check current location in admin menu
20  $oModuleModel = getModel('module');
21  $info = $oModuleModel->getModuleActionXml('document');
22  foreach($info->menu AS $key => $menu)
23  {
24  if(in_array($this->act, $menu->acts))
25  {
26  Context::set('currentMenu', $key);
27  break;
28  }
29  }
30  }
31 
37  {
38  // option to get a list
39  $args = new stdClass();
40  $args->page = Context::get('page'); // /< Page
41  $args->list_count = 30; // /< the number of posts to display on a single page
42  $args->page_count = 5; // /< the number of pages that appear in the page navigation
43 
44  $args->search_target = Context::get('search_target'); // /< search (title, contents ...)
45  $args->search_keyword = Context::get('search_keyword'); // /< keyword to search
46 
47  $args->sort_index = 'list_order'; // /< sorting value
48 
49  $args->module_srl = Context::get('module_srl');
50 
51  // get a list
52  $oDocumentModel = getModel('document');
53  $columnList = array('document_srl', 'module_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status', 'category_srl', 'comment_count');
54  $output = $oDocumentModel->getDocumentList($args, false, true, $columnList);
55 
56  // get Status name list
57  $statusNameList = $oDocumentModel->getStatusNameList();
58 
59  // Set values of document_model::getDocumentList() objects for a template
60  Context::set('total_count', $output->total_count);
61  Context::set('total_page', $output->total_page);
62  Context::set('page', $output->page);
63  Context::set('document_list', $output->data);
64  Context::set('status_name_list', $statusNameList);
65  Context::set('page_navigation', $output->page_navigation);
66 
67  // set a search option used in the template
68  $count_search_option = count($this->search_option);
69  for($i=0;$i<$count_search_option;$i++)
70  {
71  $search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
72  }
73  Context::set('search_option', $search_option);
74 
75  $oModuleModel = getModel('module');
76  $module_list = array();
77  $mod_srls = array();
78  foreach($output->data as $oDocument)
79  {
80  $mod_srls[] = $oDocument->get('module_srl');
81  }
82  $mod_srls = array_unique($mod_srls);
83  // Module List
84  $mod_srls_count = count($mod_srls);
85  if($mod_srls_count)
86  {
87  $columnList = array('module_srl', 'mid', 'browser_title');
88  $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
89  if($module_output && is_array($module_output))
90  {
91  foreach($module_output as $module)
92  {
93  $module_list[$module->module_srl] = $module;
94  }
95  }
96  }
97  Context::set('module_list', $module_list);
98 
99  $security = new Security();
100  $security->encodeHTML('search_target', 'search_keyword');
101 
102  // Specify a template
103  $this->setTemplatePath($this->module_path.'tpl');
104  $this->setTemplateFile('document_list');
105  }
106 
112  {
113  $oDocumentModel = getModel('document');
114  $config = $oDocumentModel->getDocumentConfig();
115  Context::set('config', $config);
116 
117  $oModuleModel = getModel('module');
118  $pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
119  $mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'm.icons');
120 
121  Context::set('pcIconSkinList', $pcIconSkinList);
122  Context::set('mobileIconSkinList', $mobileIconSkinList);
123 
124  // Set the template file
125  $this->setTemplatePath($this->module_path.'tpl');
126  $this->setTemplateFile('document_config');
127  }
128 
134  {
135  // option for a list
136  $args =new stdClass();
137  $args->page = Context::get('page'); // /< Page
138  $args->list_count = 30; // /< the number of posts to display on a single page
139  $args->page_count = 10; // /< the number of pages that appear in the page navigation
140 
141  $args->sort_index = 'document_declared.declared_count'; // /< sorting values
142  $args->order_type = 'desc'; // /< sorting values by order
143 
144  // get Status name list
145  $oDocumentModel = getModel('document');
146  $statusNameList = $oDocumentModel->getStatusNameList();
147 
148  // get a list
149  $declared_output = executeQuery('document.getDeclaredList', $args);
150  if($declared_output->data && count($declared_output->data))
151  {
152  $document_list = array();
153 
154  foreach($declared_output->data as $key => $document)
155  {
156  $document_list[$key] = new documentItem();
157  $document_list[$key]->setAttribute($document);
158  }
159  $declared_output->data = $document_list;
160  }
161 
162  // Set values of document_model::getDocumentList() objects for a template
163  Context::set('total_count', $declared_output->total_count);
164  Context::set('total_page', $declared_output->total_page);
165  Context::set('page', $declared_output->page);
166  Context::set('document_list', $declared_output->data);
167  Context::set('page_navigation', $declared_output->page_navigation);
168  Context::set('status_name_list', $statusNameList);
169  // Set the template
170  $this->setTemplatePath($this->module_path.'tpl');
171  $this->setTemplateFile('declared_list');
172  }
173 
179  {
180  $args->document_srl = Context::get('document_srl');
181  if(!$args->document_srl) return $this->dispDocumentAdminList();
182 
183  $oModel = getModel('document');
184  $oDocument = $oModel->getDocument($args->document_srl);
185  if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
186  Context::set('oDocument', $oDocument);
187 
188  $output = executeQueryArray('document.getAliases', $args);
189  if(!$output->data)
190  {
191  $aliases = array();
192  }
193  else
194  {
195  $aliases = $output->data;
196  }
197 
198  Context::set('aliases', $aliases);
199 
200  $this->setTemplatePath($this->module_path.'tpl');
201  $this->setTemplateFile('document_alias');
202  }
203 
209  {
210  // options for a list
211  $args->page = Context::get('page'); // /< Page
212  $args->list_count = 30; // /< the number of posts to display on a single page
213  $args->page_count = 10; // /< the number of pages that appear in the page navigation
214 
215  $args->sort_index = 'list_order'; // /< sorting values
216  $args->order_type = 'desc'; // /< sorting values by order
217 
218  $args->module_srl = Context::get('module_srl');
219 
220  // get a list
221  $oDocumentAdminModel = getAdminModel('document');
222  $output = $oDocumentAdminModel->getDocumentTrashList($args);
223 
224  // Set values of document_admin_model::getDocumentTrashList() objects for a template
225  Context::set('total_count', $output->total_count);
226  Context::set('total_page', $output->total_page);
227  Context::set('page', $output->page);
228  Context::set('document_list', $output->data);
229  Context::set('page_navigation', $output->page_navigation);
230  // set the template
231  $this->setTemplatePath($this->module_path.'tpl');
232  $this->setTemplateFile('document_trash_list');
233  }
234 }
235 /* End of file document.admin.view.php */
236 /* Location: ./modules/document/document.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
getAdminModel($module_name)
Definition: func.inc.php:156
$oDocumentModel
Definition: ko.install.php:259
document the module&#39;s high class {
getLang($code)
getModel($module_name)
Definition: func.inc.php:145
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
$module
Class name of Xe Module that is identified by mid.