XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
module.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class moduleView extends module
9 {
13  function init()
14  {
15  // Set the template path
16  $this->setTemplatePath($this->module_path.'tpl');
17  }
18 
22  function dispModuleSkinInfo()
23  {
24  $selected_module = Context::get('selected_module');
25  $skin = Context::get('skin');
26  // Get modules/skin information
27  $module_path = sprintf("./modules/%s/", $selected_module);
28  if(!is_dir($module_path)) $this->stop("msg_invalid_request");
29 
30  $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31  if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
32 
33  $oModuleModel = getModel('module');
34  $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
35  Context::set('skin_info',$skin_info);
36 
37  $this->setLayoutFile("popup_layout");
38  $this->setTemplateFile("skin_info");
39  }
40 
45  {
46  if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
47 
48  $oModuleModel = getModel('module');
49  $logged_info = Context::get('logged_info');
50  $selected_module = Context::get('selected_module');
51  $site_module_info = Context::get('site_module_info');
52  $site_keyword = Context::get('site_keyword');
53 
54  $output = executeQuery('module.getSiteCount');
55  $site_count = $output->data->count;
56  Context::set('site_count', $site_count);
57 
58  $args = new stdClass();
59  $module_category_exists = false;
60  if($logged_info->is_admin == 'Y' && $site_keyword)
61  {
62  $args->site_keyword = $site_keyword;
63  }
64  else
65  {
66  $args->site_srl = (int)$site_module_info->site_srl;
67  Context::set('site_keyword', null);
68  }
69 
70  if($logged_info->is_admin == 'Y')
71  {
72  $module_category_exists = true;
73  }
74 
75  // Get a list of modules at the site
76  $mid_list = array();
77  $output = executeQueryArray('module.getSiteModules', $args);
78  if(!$output->data) $output->data = array();
79 
80  foreach($output->data as $key => $val)
81  {
82  $module = trim($val->module);
83  if(!$module) continue;
84 
85  if(!$oModuleModel->getGrant($val, $logged_info)->access)
86  {
87  continue;
88  }
89 
90  $category = $val->category;
91  $obj = new stdClass();
92  $obj->module_srl = $val->module_srl;
93  $obj->browser_title = $val->browser_title;
94  $mid_list[$module]->list[$category][$val->mid] = $obj;
95 
96  if(!$selected_module) $selected_module = $module;
97  if(!$mid_list[$module]->title)
98  {
99  $xml_info = $oModuleModel->getModuleInfoXml($module);
100  $mid_list[$module]->title = $xml_info->title;
101  }
102  }
103 
104  Context::set('mid_list', $mid_list);
105  Context::set('selected_module', $selected_module);
106  Context::set('selected_mids', $mid_list[$selected_module]->list);
107  Context::set('module_category_exists', $module_category_exists);
108 
109  $security = new Security();
110  $security->encodeHTML('id', 'type', 'site_keyword');
111 
112  $this->setLayoutFile('popup_layout');
113  $this->setTemplateFile('module_selector');
114  }
115 
116  // See the file box
117  function dispModuleFileBox()
118  {
119  $logged_info = Context::get('logged_info');
120  if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
121 
122  $input_name = Context::get('input');
123  if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
124  {
125  return new BaseObject(-1, 'msg_invalid_request');
126  }
127 
128  if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
129 
130  $addscript = sprintf('<script>//<![CDATA[
131  var selected_filebox_input_name = "%s";
132  //]]></script>',$input_name);
133  Context::addHtmlHeader($addscript);
134 
135  $oModuleModel = getModel('module');
136  $output = $oModuleModel->getModuleFileBoxList();
137  Context::set('filebox_list', $output->data);
138 
139  $filter = Context::get('filter');
140  if($filter) Context::set('arrfilter',explode(',',$filter));
141 
142  Context::set('page_navigation', $output->page_navigation);
143  $this->setLayoutFile('popup_layout');
144  $this->setTemplateFile('filebox_list');
145  }
146 
147  // Screen to add a file box
149  {
150  $logged_info = Context::get('logged_info');
151  if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
152 
153  $filter = Context::get('filter');
154  if($filter) Context::set('arrfilter',explode(',',$filter));
155 
156  $this->setLayoutFile('popup_layout');
157  $this->setTemplateFile('filebox_add');
158  }
159 }
160 /* End of file module.view.php */
161 /* Location: ./modules/module/module.view.php */
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
dispModuleFileBoxAdd()
$args title
Definition: ko.install.php:189
$obj
Definition: ko.install.php:262
view class of the module module
Definition: module.view.php:8
addHtmlHeader($header)
$output
Definition: ko.install.php:193
setLayoutFile($filename)
set($key, $val, $set_to_get_vars=0)
$xml_info
an object containing the module description extracted from XML file
$module_path
a path to directory where module source code resides
$args
Definition: ko.install.php:185
dispModuleSkinInfo()
Display skin information.
Definition: module.view.php:22
getModel($module_name)
Definition: func.inc.php:145
init()
Initialization.
Definition: module.view.php:13
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.
dispModuleSelectList()
Select a module.
Definition: module.view.php:44
high class of the module module
Definition: module.class.php:8