26 $type = ($type !=
'M') ?
'P' :
'M';
30 $layout_list = $oLayoutModel->getDownloadedLayoutList($type,
true);
31 if(!is_array($layout_list))
33 $layout_list = array();
40 $themeList = $oAdminModel->getThemeList();
41 $themeLayoutList = array();
42 foreach($themeList as $themeInfo)
44 if(strpos($themeInfo->layout_info->name,
'.') ===
false)
continue;
45 $themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null,
'P');
47 $layout_list = array_merge($layout_list, $themeLayoutList);
48 $layout_list[] = $oLayoutModel->getLayoutInfo(
'faceoff', null,
'P');
51 $pcLayoutCount = $oLayoutModel->getInstalledLayoutCount(
'P');
52 $mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount(
'M');
57 $security =
new Security($layout_list);
58 $layout_list = $security->encodeHTML(
'..',
'..author..');
62 $security->encodeHTML(
'layout_list..layout',
'layout_list..title');
64 foreach($layout_list as $no => $layout_info)
66 $layout_list[$no]->description = nl2br(trim($layout_info->description));
79 if(!in_array($type, array(
'P',
'M'))) $type =
'P';
83 $pcLayoutCount = $oLayoutModel->getInstalledLayoutCount(
'P');
84 $mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount(
'M');
88 $columnList = array(
'layout_srl',
'layout',
'module_srl',
'title',
'regdate');
89 $_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
91 $layout_list = array();
92 foreach($_layout_list as $item)
94 if(!$layout_list[$item->layout])
96 $layout_list[$item->layout] = array();
97 $layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
100 $layout_list[$item->layout][
'title'] = $layout_info->title;
104 $layout_list[$item->layout][] = $item;
107 usort($layout_list, array($this,
'sortLayoutInstance'));
114 $security->encodeHTML(
'layout_list..');
122 $aTitle = strtolower($a[
'title']);
123 $bTitle = strtolower($b[
'title']);
125 if($aTitle == $bTitle)
130 return ($aTitle < $bTitle) ? -1 : 1;
142 if(!in_array($type, array(
'P',
'M'))) $type =
'P';
143 if(!$layout)
return $this->
stop(
'msg_invalid_request');
146 $layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
147 if(!$layout_info)
return $this->
stop(
'msg_invalid_request');
151 $columnList = array(
'layout_srl',
'layout',
'module_srl',
'title',
'regdate');
152 $layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, $layout, $columnList);
158 $security->encodeHTML(
'layout_list..');
170 if(!in_array($type, array(
'P',
'M'))) $type =
'P';
174 $security->encodeHTML(
'layout_list..layout',
'layout_list..title');
178 if($layout ==
'faceoff')
return $this->
stop(
'not supported');
180 $layout_info = $oModel->getLayoutInfo($layout, null, $type);
181 if(!$layout_info)
return $this->
stop(
'msg_invalid_request');
185 $menu_list = $oMenuAdminModel->getMenus();
189 $security->encodeHTML(
'menu_list..');
191 $security =
new Security($layout_info);
192 $layout_info = $security->encodeHTML(
'.',
'author..',
'extra_var..',
'extra_var....');
194 $layout_info->description = nl2br(trim($layout_info->description));
195 if(!is_object($layout_info->extra_var)) $layout_info->extra_var =
new StdClass();
196 foreach($layout_info->extra_var as $var_name => $val)
198 if(isset($layout_info->{$var_name}->description))
199 $layout_info->{$var_name}->description = nl2br(trim($val->description));
203 $this->setTemplateFile(
'layout_modify');
213 $oLayoutAdminModel->setLayoutAdminSetInfoView();
216 $script =
'<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
218 $content = $oTemplate->compile($this->module_path.
'tpl/',
'layout_info_view');
222 $this->setTemplateFile(
'layout_modify');
235 $layout_info = $oLayoutModel->getLayout(
$layout_srl);
237 if(!$layout_info)
return $this->dispLayoutAdminInstalledList();
240 if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
242 $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243 $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
247 $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
248 $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
250 if(!file_exists($layout_file)) $layout_file = $layout_info->path .
'layout.html';
251 if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path .
'layout.css';
254 if(file_exists($layout_css_file))
264 $layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_info->layout_srl);
267 $layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
271 $widget_list = $oWidgetModel->getDownloadedWidgetList();
274 $this->setTemplateFile(
'layout_edit');
276 $security =
new Security($layout_info);
277 $layout_info = $security->encodeHTML(
'.',
'.author..');
282 $security->encodeHTML(
'layout_list..');
283 $security->encodeHTML(
'layout_list..author..');
286 $security->encodeHTML(
'layout_code_css',
'layout_code',
'widget_list..title');
301 $layout_info = $oLayoutModel->getLayout(
$layout_srl);
302 if(!$layout_info)
return new BaseObject(-1,
'msg_invalid_request');
304 if($layout_info && $layout_info->type ==
'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
308 if($layout_info->extra_var_count)
310 foreach($layout_info->extra_var as $var_id => $val)
312 $layout_info->{$var_id} = $val->value;
316 if($layout_info->menu_count)
318 foreach($layout_info->menu as $menu_id => $menu)
329 $edited_layout_file = sprintf(
'./files/cache/layout/tmp.tpl');
335 $layout_path = $layout_info->path;
336 $layout_file =
'layout';
338 $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
345 $this->setTemplateFile(
'layout_preview');
357 $current_module_info =
Context::get(
'current_module_info');
362 if($delete_tmp ==
'Y')
370 $oLayoutModel->setUseUserLayoutTemp();
372 $faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
376 preg_match_all(
'/([^\{]+)\{([^\}]*)\}/is',$css,$match);
377 for($i=0,$c=count($match[1]);$i<$c;$i++)
379 $name = trim($match[1][$i]);
380 $css = trim($match[2][$i]);
383 $style[] .= sprintf(
'"%s":"%s"',$name,$css);
388 $script =
'<script type="text/javascript"> var faceOffStyle = {'.implode(
',',$style).
'}; </script>';
393 Context::set(
'content', $oTemplate->compile($this->module_path.
'tpl',
'about_faceoff'));
396 $oWidgetController->setWidgetCodeInJavascriptMode();
398 $this->setTemplateFile(
'faceoff_layout_edit');
410 $layout = $oLayoutModel->getLayout($layoutSrl);
413 $this->setTemplateFile(
'copy_layout');
setTemplateFile($filename)
getController($module_name)
sortLayoutInstance($a, $b)
set($key, $val, $set_to_get_vars=0)
writeFile($filename, $buff, $mode="w")
$oContext
Include the necessary configuration files.
dispLayoutAdminLayoutModify()
getAdminModel($module_name)
dispLayoutAdminAllInstanceList()
dispLayoutAdminCopyLayout()
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
dispLayoutAdminInstalledList()
getAdminController($module_name)
dispLayoutAdminInstanceList()