XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
page.admin.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class pageAdminView extends page
9 {
10  var $module_srl = 0;
11  var $list_count = 20;
12  var $page_count = 10;
13 
17  function init()
18  {
19  // Pre-check if module_srl exists. Set module_info if exists
20  $module_srl = Context::get('module_srl');
21  // Create module model object
22  $oModuleModel = getModel('module');
23  // module_srl two come over to save the module, putting the information in advance
24  if($module_srl)
25  {
26  $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
27  if(!$module_info)
28  {
29  Context::set('module_srl','');
30  $this->act = 'list';
31  }
32  else
33  {
34  ModuleModel::syncModuleToSite($module_info);
35  $this->module_info = $module_info;
36  Context::set('module_info',$module_info);
37  }
38  }
39  // Get a list of module categories
40  $module_category = $oModuleModel->getModuleCategories();
41  Context::set('module_category', $module_category);
42  //Security
43  $security = new Security();
44  $security->encodeHTML('module_category..title');
45 
46  // Get a template path (page in the administrative template tpl putting together)
47  $this->setTemplatePath($this->module_path.'tpl');
48  }
49 
54  {
55  $args = new stdClass();
56  $args->sort_index = "module_srl";
57  $args->page = Context::get('page');
58  $args->list_count = 40;
59  $args->page_count = 10;
60  $args->s_module_category_srl = Context::get('module_category_srl');
61 
62  $search_target_list = array('s_mid','s_browser_title');
63  $search_target = Context::get('search_target');
64  $search_keyword = Context::get('search_keyword');
65  if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword;
66 
67  $output = executeQuery('page.getPageList', $args);
68  $oModuleModel = getModel('module');
69  $page_list = $oModuleModel->addModuleExtraVars($output->data);
71 
72  $oModuleAdminModel = getAdminModel('module'); /* @var $oModuleAdminModel moduleAdminModel */
73 
74  $tabChoice = array('tab1'=>1, 'tab3'=>1);
75  $selected_manage_content = $oModuleAdminModel->getSelectedManageHTML($this->xml_info->grant, $tabChoice, $this->module_path);
76  Context::set('selected_manage_content', $selected_manage_content);
77 
78  // To write to a template context:: set
79  Context::set('total_count', $output->total_count);
80  Context::set('total_page', $output->total_page);
81  Context::set('page', $output->page);
82  Context::set('page_list', $output->data);
83  Context::set('page_navigation', $output->page_navigation);
84 
85  //Security
86  $security = new Security();
87  $security->encodeHTML('page_list..browser_title');
88  $security->encodeHTML('page_list..mid');
89  $security->encodeHTML('module_info.');
90 
91  // Set a template file
92  $this->setTemplateFile('index');
93  }
94 
98  function dispPageAdminInfo()
99  {
100  // Get module_srl by GET parameter
101  $module_srl = Context::get('module_srl');
102  $module_info = Context::get('module_info');
103  // If you do not value module_srl just showing the index page
104  if(!$module_srl) return $this->dispPageAdminContent();
105  // If the layout is destined to add layout information haejum (layout_title, layout)
106  if($module_info->layout_srl)
107  {
108  $oLayoutModel = getModel('layout');
109  $layout_info = $oLayoutModel->getLayout($module_info->layout_srl);
110  $module_info->layout = $layout_info->layout;
111  $module_info->layout_title = $layout_info->layout_title;
112  }
113  // Get a layout list
114  $oLayoutModel = getModel('layout');
115  $layout_list = $oLayoutModel->getLayoutList();
116  Context::set('layout_list', $layout_list);
117 
118  $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
119  Context::set('mlayout_list', $mobile_layout_list);
120  // Set a template file
121 
122  if($this->module_info->page_type == 'ARTICLE')
123  {
124  $oModuleModel = getModel('module');
125  $skin_list = $oModuleModel->getSkins($this->module_path);
126  Context::set('skin_list',$skin_list);
127 
128  $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
129  Context::set('mskin_list', $mskin_list);
130  }
131 
132  //Security
133  $security = new Security();
134  $security->encodeHTML('layout_list..layout');
135  $security->encodeHTML('layout_list..title');
136  $security->encodeHTML('mlayout_list..layout');
137  $security->encodeHTML('mlayout_list..title');
138  $security->encodeHTML('module_info.');
139 
140  $this->setTemplateFile('page_info');
141  }
142 
148  {
149  // call by reference content from other modules to come take a year in advance for putting the variable declaration
150  $content = '';
151 
152  $oEditorView = getView('editor');
153  $oEditorView->triggerDispEditorAdditionSetup($content);
154  Context::set('setup_content', $content);
155  // Set a template file
156  $this->setTemplateFile('addition_setup');
157 
158  $security = new Security();
159  $security->encodeHTML('module_info.');
160  }
161 
163  {
164  if($this->module_info->page_type == 'OUTSIDE')
165  {
166  return $this->stop(-1, 'msg_invalid_request');
167  }
168 
169  if($this->module_srl)
170  {
171  Context::set('module_srl',$this->module_srl);
172  }
173 
174  $oPageMobile = &getMobile('page');
175  $oPageMobile->module_info = $this->module_info;
176  $page_type_name = strtolower($this->module_info->page_type);
177  $method = '_get' . ucfirst($page_type_name) . 'Content';
178  if(method_exists($oPageMobile, $method))
179  {
180  if($method == '_getArticleContent' && $this->module_info->is_mskin_fix == 'N')
181  {
182  $oModuleModel = getModel('module');
183  $oPageMobile->module_info->mskin = $oModuleModel->getModuleDefaultSkin('page', 'M');
184  }
185  $page_content = $oPageMobile->{$method}();
186  }
187  else
188  {
189  return new BaseObject(-1, sprintf('%s method is not exists', $method));
190  }
191 
192  Context::set('module_info', $this->module_info);
193  Context::set('page_content', $page_content);
194 
195  $this->setTemplateFile('mcontent');
196  }
197 
199  {
200  Context::set('module_info', $this->module_info);
201 
202  if ($this->module_info->page_type == 'WIDGET')
203  {
204  $this->_setWidgetTypeContentModify(true);
205  }
206  else if ($this->module_info->page_type == 'ARTICLE')
207  {
208  $this->_setArticleTypeContentModify(true);
209  }
210  }
211 
216  {
217  // Set the module information
218  Context::set('module_info', $this->module_info);
219 
220  if ($this->module_info->page_type == 'WIDGET')
221  {
222  $this->_setWidgetTypeContentModify();
223  }
224  else if ($this->module_info->page_type == 'ARTICLE')
225  {
226  $this->_setArticleTypeContentModify();
227  }
228  }
229 
230  function _setWidgetTypeContentModify($isMobile = false)
231  {
232  // Setting contents
233  if($isMobile)
234  {
235  $content = Context::get('mcontent');
236  if(!$content) $content = $this->module_info->mcontent;
237  $templateFile = 'page_mobile_content_modify';
238  }
239  else
240  {
241  $content = Context::get('content');
242  if(!$content) $content = $this->module_info->content;
243  $templateFile = 'page_content_modify';
244  }
245 
246  Context::set('content', $content);
247  // Convert them to teach the widget
248  $oWidgetController = getController('widget');
249  $content = $oWidgetController->transWidgetCode($content, true, !$isMobile);
250  // $content = str_replace('$', '&#36;', $content);
251  Context::set('page_content', $content);
252  // Set widget list
253  $oWidgetModel = getModel('widget');
254  $widget_list = $oWidgetModel->getDownloadedWidgetList();
255  Context::set('widget_list', $widget_list);
256 
257  //Security
258  $security = new Security();
259  $security->encodeHTML('widget_list..title','module_info.mid');
260 
261  // Set a template file
262  $this->setTemplateFile($templateFile);
263  }
264 
265  function _setArticleTypeContentModify($isMobile = false)
266  {
267  $oDocumentModel = getModel('document');
268  $oDocument = $oDocumentModel->getDocument(0, true);
269 
270  if($isMobile)
271  {
272  Context::set('isMobile', 'Y');
273  $target = 'mdocument_srl';
274  }
275  else
276  {
277  Context::set('isMobile', 'N');
278  $target = 'document_srl';
279  }
280 
281  if($this->module_info->{$target})
282  {
283  $document_srl = $this->module_info->{$target};
284  $oDocument->setDocument($document_srl);
285  Context::set('document_srl', $document_srl);
286  }
287  else if(Context::get('document_srl'))
288  {
289  $document_srl = Context::get('document_srl');
290  $oDocument->setDocument($document_srl);
291  Context::set('document_srl', $document_srl);
292  }
293  else
294  {
295  $oDocument->add('module_srl', $this->module_info->module_srl);
296  }
297 
298  Context::addJsFilter($this->module_path.'tpl/filter', 'insert_article.xml');
299  Context::set('oDocument', $oDocument);
300  Context::set('mid', $this->module_info->mid);
301  $this->setTemplateFile('article_content_modify');
302  }
303 
308  {
309  $module_srl = Context::get('module_srl');
310  if(!$module_srl) return $this->dispContent();
311 
312  $oModuleModel = getModel('module');
313  $columnList = array('module_srl', 'module', 'mid');
314  $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
315  Context::set('module_info',$module_info);
316  // Set a template file
317  $this->setTemplateFile('page_delete');
318 
319  $security = new Security();
320  $security->encodeHTML('module_info.');
321  }
322 
327  {
328  // Common module settings page, call rights
329  $oModuleAdminModel = getAdminModel('module');
330  $grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
331  Context::set('grant_content', $grant_content);
332 
333  $this->setTemplateFile('grant_list');
334 
335  $security = new Security();
336  $security->encodeHTML('module_info.');
337  }
338 
343  {
344  $oModuleAdminModel = getAdminModel('module');
345  $skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
346  Context::set('skin_content', $skin_content);
347 
348  $this->setTemplateFile('skin_info');
349  }
350 
355  {
356  $oModuleAdminModel = getAdminModel('module');
357  $skin_content = $oModuleAdminModel->getModuleMobileSkinHTML($this->module_info->module_srl);
358  Context::set('skin_content', $skin_content);
359 
360  $this->setTemplateFile('skin_info');
361  }
362 }
363 /* End of file page.admin.view.php */
364 /* Location: ./modules/page/page.admin.view.php */
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
$output
Definition: ko.install.php:193
$module_info
Definition: ko.install.php:289
dispPageAdminContent()
Manage a list of pages showing.
high class of the module page
Definition: page.class.php:8
dispPageAdminMobileContentModify()
set($key, $val, $set_to_get_vars=0)
& getMobile($module_name)
Definition: func.inc.php:123
page admin view of the module class
dispPageAdminContentModify()
Edit Page Content.
getView($module_name)
Definition: func.inc.php:112
$args
Definition: ko.install.php:185
$module_info
an object containing the module information
$document_srl
Definition: ko.install.php:279
dispPageAdminDelete()
Delete page output.
getAdminModel($module_name)
Definition: func.inc.php:156
syncModuleToSite(&$data)
Combine module_srls with domain of sites Because XE DBHandler doesn&#39;t support left outer join...
$oDocumentModel
Definition: ko.install.php:259
dispPageAdminGrantInfo()
Rights Listing.
_setWidgetTypeContentModify($isMobile=false)
$obj module_srl
Definition: ko.install.php:270
dispPageAdminPageAdditionSetup()
Additional settings page showing For additional settings in a service module in order to establish li...
getModel($module_name)
Definition: func.inc.php:145
_setArticleTypeContentModify($isMobile=false)
$module_srl
Definition: ko.install.php:254
addJsFilter($path, $filename)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
init()
Initialization.
dispPageAdminInfo()
Information output of the selected page.