XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
board.admin.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
10 class boardAdminView extends board {
11 
17  function init() {
18  // check module_srl is existed or not
19  $module_srl = Context::get('module_srl');
20  if(!$module_srl && $this->module_srl) {
22  Context::set('module_srl', $module_srl);
23  }
24 
25  // generate module model object
26  $oModuleModel = getModel('module');
27 
28  // get the module infomation based on the module_srl
29  if($module_srl) {
30  $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
31  if(!$module_info) {
32  Context::set('module_srl','');
33  $this->act = 'list';
34  } else {
35  ModuleModel::syncModuleToSite($module_info);
36  $this->module_info = $module_info;
37  $this->module_info->use_status = explode('|@|', $module_info->use_status);
38  Context::set('module_info',$module_info);
39  }
40  }
41 
42  if($module_info && $module_info->module != 'board') return $this->stop("msg_invalid_request");
43 
44  // get the module category list
45  $module_category = $oModuleModel->getModuleCategories();
46  Context::set('module_category', $module_category);
47 
48  $security = new Security();
49  $security->encodeHTML('module_info.');
50  $security->encodeHTML('module_category..');
51 
52  // setup template path (board admin panel templates is resided in the tpl folder)
53  $template_path = sprintf("%stpl/",$this->module_path);
55 
56  // install order (sorting) options
57  foreach($this->order_target as $key) $order_target[$key] = Context::getLang($key);
58  $order_target['list_order'] = Context::getLang('document_srl');
59  $order_target['update_order'] = Context::getLang('last_update');
60  Context::set('order_target', $order_target);
61  }
62 
66  function dispBoardAdminContent() {
67  // setup the board module general information
68  $args = new stdClass();
69  $args->sort_index = "module_srl";
70  $args->page = Context::get('page');
71  $args->list_count = 20;
72  $args->page_count = 10;
73  $args->s_module_category_srl = Context::get('module_category_srl');
74 
75  $search_target = Context::get('search_target');
76  $search_keyword = Context::get('search_keyword');
77 
78  switch ($search_target){
79  case 'mid':
80  $args->s_mid = $search_keyword;
81  break;
82  case 'browser_title':
83  $args->s_browser_title = $search_keyword;
84  break;
85  }
86 
87  $output = executeQueryArray('board.getBoardList', $args);
88  ModuleModel::syncModuleToSite($output->data);
89 
90  // get the skins path
91  $oModuleModel = getModel('module');
92  $skin_list = $oModuleModel->getSkins($this->module_path);
93  Context::set('skin_list',$skin_list);
94 
95  $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
96  Context::set('mskin_list', $mskin_list);
97 
98  // get the layouts path
99  $oLayoutModel = getModel('layout');
100  $layout_list = $oLayoutModel->getLayoutList();
101  Context::set('layout_list', $layout_list);
102 
103  $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
104  Context::set('mlayout_list', $mobile_layout_list);
105 
106  $oModuleAdminModel = getAdminModel('module');
107  $selected_manage_content = $oModuleAdminModel->getSelectedManageHTML($this->xml_info->grant);
108  Context::set('selected_manage_content', $selected_manage_content);
109 
110  // use context::set to setup variables on the templates
111  Context::set('total_count', $output->total_count);
112  Context::set('total_page', $output->total_page);
113  Context::set('page', $output->page);
114  Context::set('board_list', $output->data);
115  Context::set('page_navigation', $output->page_navigation);
116 
117  $security = new Security();
118  $security->encodeHTML('board_list..browser_title','board_list..mid');
119  $security->encodeHTML('skin_list..title','mskin_list..title');
120  $security->encodeHTML('layout_list..title','layout_list..layout');
121  $security->encodeHTML('mlayout_list..title','mlayout_list..layout');
122 
123  // 템플릿 파일 지정
124  $this->setTemplateFile('index');
125  }
126 
131  $this->dispBoardAdminInsertBoard();
132  }
133 
138  if(!in_array($this->module_info->module, array('admin', 'board','blog','guestbook'))) {
139  return $this->alertMessage('msg_invalid_request');
140  }
141 
142  // get the skins list
143  $oModuleModel = getModel('module');
144  $skin_list = $oModuleModel->getSkins($this->module_path);
145  Context::set('skin_list',$skin_list);
146 
147  $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
148  Context::set('mskin_list', $mskin_list);
149 
150  // get the layouts list
151  $oLayoutModel = getModel('layout');
152  $layout_list = $oLayoutModel->getLayoutList();
153  Context::set('layout_list', $layout_list);
154 
155  $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
156  Context::set('mlayout_list', $mobile_layout_list);
157 
158  $security = new Security();
159  $security->encodeHTML('skin_list..title','mskin_list..title');
160  $security->encodeHTML('layout_list..title','layout_list..layout');
161  $security->encodeHTML('mlayout_list..title','mlayout_list..layout');
162 
163  // get document status list
164  $oDocumentModel = getModel('document');
165  $documentStatusList = $oDocumentModel->getStatusNameList();
166  Context::set('document_status_list', $documentStatusList);
167 
168  $oBoardModel = getModel('board');
169 
170  // setup the extra vaiables
171  $extra_vars = $oBoardModel->getDefaultListConfig($this->module_info->module_srl);
172  Context::set('extra_vars', $extra_vars);
173 
174  // setup the list config (install the default value if there is no list config)
175  Context::set('list_config', $oBoardModel->getListConfig($this->module_info->module_srl));
176 
177  // setup extra_order_target
178  $module_extra_vars = $oDocumentModel->getExtraKeys($this->module_info->module_srl);
179  $extra_order_target = array();
180  foreach($module_extra_vars as $oExtraItem)
181  {
182  $extra_order_target[$oExtraItem->eid] = $oExtraItem->name;
183  }
184  Context::set('extra_order_target', $extra_order_target);
185 
186  $security = new Security();
187  $security->encodeHTML('extra_vars..name','list_config..name');
188 
189  // set the template file
190  $this->setTemplateFile('board_insert');
191  }
192 
198  // sice content is obtained from other modules via call by reference, declare it first
199  $content = '';
200 
201  // get the addtional setup trigger
202  // the additional setup triggers can be used in many modules
203  $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
204  $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
205  Context::set('setup_content', $content);
206 
207  // setup the template file
208  $this->setTemplateFile('addition_setup');
209  }
210 
215  if(!Context::get('module_srl')) return $this->dispBoardAdminContent();
216  if(!in_array($this->module_info->module, array('admin', 'board','blog','guestbook'))) {
217  return $this->alertMessage('msg_invalid_request');
218  }
219 
220  $module_info = Context::get('module_info');
221 
222  $oDocumentModel = getModel('document');
223  $document_count = $oDocumentModel->getDocumentCount($module_info->module_srl);
224  $module_info->document_count = $document_count;
225 
226  Context::set('module_info',$module_info);
227 
228  $security = new Security();
229  $security->encodeHTML('module_info..mid','module_info..module','module_info..document_count');
230 
231  // setup the template file
232  $this->setTemplateFile('board_delete');
233  }
234 
239  $oDocumentModel = getModel('document');
240  $category_content = $oDocumentModel->getCategoryHTML($this->module_info->module_srl);
241  Context::set('category_content', $category_content);
242 
243  Context::set('module_info', $this->module_info);
244  $this->setTemplateFile('category_list');
245  }
246 
251  // get the grant infotmation from admin module
252  $oModuleAdminModel = getAdminModel('module');
253  $grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
254  Context::set('grant_content', $grant_content);
255 
256  $this->setTemplateFile('grant_list');
257  }
258 
263  $oDocumentModel = getModel('document');
264  $extra_vars_content = $oDocumentModel->getExtraVarsHTML($this->module_info->module_srl);
265  Context::set('extra_vars_content', $extra_vars_content);
266 
267  $this->setTemplateFile('extra_vars');
268  }
269 
274  // get the grant infotmation from admin module
275  $oModuleAdminModel = getAdminModel('module');
276  $skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
277  Context::set('skin_content', $skin_content);
278 
279  $this->setTemplateFile('skin_info');
280  }
281 
286  // get the grant infotmation from admin module
287  $oModuleAdminModel = getAdminModel('module');
288  $skin_content = $oModuleAdminModel->getModuleMobileSkinHTML($this->module_info->module_srl);
289  Context::set('skin_content', $skin_content);
290 
291  $this->setTemplateFile('skin_info');
292  }
293 
297  function alertMessage($message) {
298  $script = sprintf('<script> xAddEventListener(window,"load", function() { alert("%s"); } );</script>', Context::getLang($message));
299  Context::addHtmlHeader( $script );
300  }
301 }
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
$template_path
a path of directory where template files reside
addHtmlHeader($header)
$output
Definition: ko.install.php:193
dispBoardAdminExtraVars()
display extra variables
foreach($sitemap as $id=> &$val) $extra_vars
Definition: ko.install.php:180
set($key, $val, $set_to_get_vars=0)
dispBoardAdminBoardInfo()
display the selected board module admin information
$module_srl
integer value to represent a run-time instance of Module (XE Module)
$args
Definition: ko.install.php:185
init()
initialization
$module_info
an object containing the module information
dispBoardAdminDeleteBoard()
display the board mdoule delete page
dispBoardAdminBoardAdditionSetup()
display the additional setup panel additonal setup panel is for connecting the service modules with o...
getAdminModel($module_name)
Definition: func.inc.php:156
$oDocumentModel
Definition: ko.install.php:259
dispBoardAdminSkinInfo()
display the module skin information
getLang($code)
$obj module_srl
Definition: ko.install.php:270
getModel($module_name)
Definition: func.inc.php:145
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
$order_target
Definition: board.class.php:14
alertMessage($message)
board module message
dispBoardAdminInsertBoard()
display the module insert form
dispBoardAdminContent()
display the board module admin contents
board module high class
Definition: board.class.php:10
triggerCall($trigger_name, $called_position, &$obj)
board module admin view class
dispBoardAdminGrantInfo()
display the grant information
dispBoardAdminCategoryInfo()
display category information