XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
editor.admin.controller.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
9 {
13  function init()
14  {
15  }
16 
21  {
22  $site_module_info = Context::get('site_module_info');
23  $enables = Context::get('enables');
24  $component_names = Context::get('component_names');
25 
26  if(!is_array($component_names)) $component_names = array();
27  if(!is_array($enables)) $enables = array();
28 
29  $unables = array_diff($component_names, $enables);
30  $componentList = array();
31 
32  foreach($enables as $component_name)
33  {
34  $componentList[$component_name] = 'Y';
35  }
36  foreach($unables as $component_name)
37  {
38  $componentList[$component_name] = 'N';
39  }
40 
41  $output = $this->editorListOrder($component_names,$site_module_info->site_srl);
42  if(!$output->toBool()) return new BaseObject();
43 
44  $output = $this->editorCheckUse($componentList,$site_module_info->site_srl);
45  if(!$output->toBool()) return new BaseObject();
46 
47  $oEditorController = getController('editor');
48  $oEditorController->removeCache($site_module_info->site_srl);
49  $this->setRedirectUrl(Context::get('error_return_url'));
50  }
51 
55  function editorCheckUse($componentList, $site_srl = 0)
56  {
57  $args = new stdClass();
58  $args->site_srl = $site_srl;
59 
60  foreach($componentList as $componentName => $value)
61  {
62  $args->component_name = $componentName;
63  $args->enabled = $value;
64  if($site_srl == 0)
65  {
66  $output = executeQuery('editor.updateComponent', $args);
67  }
68  else
69  {
70  $output = executeQuery('editor.updateSiteComponent', $args);
71  }
72  }
73  if(!$output->toBool()) return new BaseObject();
74 
75  unset($componentList);
76  return $output;
77  }
78 
82  function editorListOrder($component_names, $site_srl = 0)
83  {
84  $args = new stdClass();
85  $args->site_srl = $site_srl;
86  $list_order_num = '30';
87  if(is_array($component_names))
88  {
89  foreach($component_names as $name)
90  {
91  $args->list_order = $list_order_num;
92  $args->component_name = $name;
93  if($site_srl == 0)
94  {
95  $output = executeQuery('editor.updateComponent', $args);
96  }
97  else
98  {
99  $output = executeQuery('editor.updateSiteComponent', $args);
100  }
101 
102  if(!$output->toBool()) return new BaseObject();
103  $list_order_num++;
104  }
105  }
106  unset($component_names);
107  return $output;
108  }
109 
114  {
115  $site_module_info = Context::get('site_module_info');
116 
117  $component_name = Context::get('component_name');
119  unset($extra_vars->component_name);
120  unset($extra_vars->module);
121  unset($extra_vars->act);
122  unset($extra_vars->body);
123 
124  $args = new stdClass;
125  $args->component_name = $component_name;
126  $args->extra_vars = serialize($extra_vars);
127  $args->site_srl = (int)$site_module_info->site_srl;
128 
129  if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args);
130  else $output = executeQuery('editor.updateSiteComponent', $args);
131  if(!$output->toBool()) return $output;
132 
133  $oEditorController = getController('editor');
134  $oEditorController->removeCache($args->site_srl);
135 
136  $this->setMessage('success_updated');
137  $this->setRedirectUrl(Context::get('error_return_url'));
138  }
139 
144  {
145  $oModuleController = getController('module');
146  $configVars = Context::getRequestVars();
147 
148  $config = new stdClass;
149  if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N';
150  else $config->font_defined = 'Y';
151 
152  if($config->font_defined == 'Y')
153  $config->content_font = $configVars->content_font_defined;
154  else
155  $config->content_font = $configVars->content_font;
156 
157  $config->editor_skin = $configVars->editor_skin;
158  $config->editor_height = $configVars->editor_height;
159  $config->comment_editor_skin = $configVars->comment_editor_skin;
160  $config->comment_editor_height = $configVars->comment_editor_height;
161  $config->content_style = $configVars->content_style;
162 
163  $config->content_font_size= $configVars->content_font_size.'px';
164  $config->sel_editor_colorset= $configVars->sel_editor_colorset;
165  $config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset;
166 
167  $oModuleController->insertModuleConfig('editor',$config);
168  $this->setRedirectUrl(Context::get('error_return_url'));
169  }
170 
174  function insertComponent($component_name, $enabled = false, $site_srl = 0)
175  {
176  if($enabled) $enabled = 'Y';
177  else $enabled = 'N';
178 
179  $args = new stdClass;
180  $args->component_name = $component_name;
181  $args->enabled = $enabled;
182  $args->site_srl = $site_srl;
183  // Check if the component exists
184  if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
185  else $output = executeQuery('editor.isSiteComponentInserted', $args);
186  if($output->data->count) return new BaseObject(-1, 'msg_component_is_not_founded');
187  // Inert a component
188  $args->list_order = getNextSequence();
189  if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
190  else $output = executeQuery('editor.insertSiteComponent', $args);
191 
192  $oEditorController = getController('editor');
193  $oEditorController->removeCache($site_srl);
194  return $output;
195  }
196 }
197 /* End of file editor.admin.controller.php */
198 /* Location: ./modules/editor/editor.admin.controller.php */
setMessage($message= 'success', $type=NULL)
getController($module_name)
Definition: func.inc.php:90
$output
Definition: ko.install.php:193
foreach($sitemap as $id=> &$val) $extra_vars
Definition: ko.install.php:180
procEditorAdminSetupComponent()
Set components.
procEditorAdminGeneralConfig()
Config components.
$args
Definition: ko.install.php:185
setRedirectUrl($url= './', $output=NULL)
editor of the module admin controller class
insertComponent($component_name, $enabled=false, $site_srl=0)
Add a component to DB.
editorListOrder($component_names, $site_srl=0)
list order componet
high class of the editor odule
Definition: editor.class.php:8
getNextSequence()
Definition: func.inc.php:236
procEditorAdminCheckUseListOrder()
컴포넌트 사용설정, 목록 순서 변경
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
$oModuleController
Definition: ko.install.php:287
editorCheckUse($componentList, $site_srl=0)
check use component