27 $layout_info = $oLayoutModel->getLayoutInfo(
Context::get(
'selected_layout'));
28 if(!$layout_info) exit();
70 for($i = 0; $i < 4; $i++)
73 for($j = 0; $j < 20; $j++)
80 $attr =
new stdClass();
83 $attr->document_srl = -1;
84 $oDocument->setAttribute($attr, FALSE);
90 $templatePath =
_XE_PATH_ .
'modules/page/m.skins/' . $skin;
91 $templateFile =
'mobile';
95 $templatePath =
_XE_PATH_ .
'modules/page/skins/' . $skin;
96 $templateFile =
'content';
100 $content = $oTemplate->compile($templatePath, $templateFile);
106 $content = $this->procRealModule(
$module,
$mid, $skin, $skinType);
115 $site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
116 $designInfoFile = sprintf(
_XE_PATH_ .
'files/site_design/design_%s.php', $site_srl);
117 include($designInfoFile);
130 $layoutInfo = $oLayoutModel->getLayout($layoutSrl);
138 if($layoutInfo->extra_var_count)
141 foreach($layoutInfo->extra_var as $var_id => $val)
143 if($val->type ==
'image')
145 if(strncmp(
'./files/attach/images/', $val->value, 22) === 0)
150 $layoutInfo->{$var_id} = $val->value;
155 if($layoutInfo->menu_count)
157 foreach($layoutInfo->menu as $menu_id => $menu)
160 if(!$menu->menu_srl || $menu->menu_srl == -1)
165 if(file_exists($homeMenuCacheFile))
167 include($homeMenuCacheFile);
172 $menu->xml_file = str_replace(
'.xml.php', $homeMenuSrl .
'.xml.php', $menu->xml_file);
173 $menu->php_file = str_replace(
'.php', $homeMenuSrl .
'.php', $menu->php_file);
174 $layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl;
178 $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
179 $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
186 include($menu->php_file);
198 $content =
'<div class="message error"><p id="preview_error">' . $e->getMessage() .
'</p></div>';
209 $layout_path = $layoutInfo->path;
210 $editLayoutTPL = $this->getRealLayoutFile($layoutSrl);
211 $editLayoutCSS = $this->getRealLayoutCSS($layoutSrl);
212 if($editLayoutCSS !=
'')
216 $layout_file =
'layout';
218 $part_config =
$oModuleModel->getModulePartConfig(
'layout', $layoutSrl);
223 $layout_path =
'./common/tpl';
224 $layout_file =
'default_layout';
227 $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL);
233 $this->setTemplatePath($this->module_path.
'tpl');
234 $this->setTemplateFile(
'layout_preview');
246 private function procRealModule($module, $mid, $skin, $skinType)
251 $args =
new stdClass();
252 $args->module = $module;
256 throw new Exception(
$output->getMessage());
265 $mid = current(
$output->data)->mid;
269 elseif(!$module && !$mid)
272 $columnList = array(
'modules.mid',
'sites.index_module_srl');
273 $startModuleInfo =
$oModuleModel->getSiteInfo(0, $columnList);
274 $mid = $startModuleInfo->mid;
280 $oModuleHandler->act =
'';
282 $oModuleHandler->init();
285 $oModuleHandler->module_info->use_mobile =
'Y';
286 $oModuleHandler->module_info->is_skin_fix =
'Y';
287 $oModuleHandler->module_info->is_mskin_fix =
'Y';
292 $oModuleHandler->module_info->mskin = $skin;
297 $oModuleHandler->module_info->skin = $skin;
301 $oModule = $oModuleHandler->procModule();
302 if(!$oModule->toBool())
308 require_once(
_XE_PATH_ .
"classes/display/HTMLDisplayHandler.php");
310 return $handler->toDoc($oModule);
321 $this->stop(
'msg_invalid_request');
322 return new BaseObject(-1,
'msg_invalid_request');
328 if(
$logged_info->is_admin !=
'Y')
return $this->stop(
'msg_invalid_request');
337 $layout_info = $oLayoutModel->getLayout(
$layout_srl);
338 if(!$layout_info)
return new BaseObject(-1,
'msg_invalid_request');
340 if($layout_info && $layout_info->type ==
'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
344 if($layout_info->extra_var_count)
346 foreach($layout_info->extra_var as $var_id => $val)
348 $layout_info->{$var_id} = $val->value;
352 if($layout_info->menu_count)
354 foreach($layout_info->menu as $menu_id => $menu)
366 $edited_layout_file =
_XE_PATH_ .
'files/cache/layout/tmp.tpl';
372 $layout_path = $layout_info->path;
373 $layout_file =
'layout';
375 $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
382 $this->setTemplateFile(
'layout_preview');
385 private function getRealLayoutFile($layoutSrl)
388 $layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl);
390 if(file_exists($layoutFile))
401 private function getRealLayoutCSS($layoutSrl)
404 $cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl);
406 if(file_exists($cssFile))
setTemplateFile($filename)
set($key, $val, $set_to_get_vars=0)
writeFile($filename, $buff, $mode="w")
$oContext
Include the necessary configuration files.
$mid
string to represent run-time instance of Module (XE Module)
addCSSFile($file, $optimized=FALSE, $media= 'all', $targetie= '', $index=0)
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
dispLayoutPreviewWithModule()
getAdminController($module_name)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
$module
Class name of Xe Module that is identified by mid.