public function action_set() { $mTemplates = M_Templates::Instance(); $this->messages = array(); $this->currentTemplate = $mTemplates->getCurrentTemplate(); if ($this->isPost()) { if (isset($_POST['templ'])) { if ($mTemplates->setTemplate($_POST)) { $this->redirect(M_Link::ToAdminTemplates('set')); } } elseif (isset($_POST['region'])) { unset($_POST['region']); $mTemplates->updateRegionsBlocks($_POST, $this->currentTemplate); } $this->messages = $mTemplates->errors(); } $this->listTemplates = $mTemplates->get_templates(); $this->regions = M_Regions::Instance()->getByTemplate($this->currentTemplate); $this->blocks = $mTemplates->regionsBlocks($this->currentTemplate); //var_dump($this->regions, $this->blocks); die(); // Получение пути к шаблону $templateName = $this->getTemplate('components/templates/v_set_template.php', $this); // Формирование контента страницы $this->content = $this->Template($templateName, $this); }
function __construct() { $this->needLogin = true; $this->styles = array('bootstrap', 'dashboard', 'video-js.min'); $this->scripts = array('jquery-1.11.2.min', 'bootstrap.min', 'custom/main_script', 'video.min'); $this->user = M_Users::Instance()->Get(); $this->template_name = M_Templates::Instance()->getCurrentTemplate(); $this->templateDir = BASE_URL . TEMPLATE_DIR . $this->template_name; $this->template = $this->getTemplate('v_admin.php'); $this->getMediaTemplate(substr($this->templateDir, iconv_strlen(BASE_URL)) . '/media_admin.info'); }
public function render() { $mTemplates = M_Templates::Instance(); // Загружаем данные блоков $this->loadBlocks(); //Получаем блоки который есть регионах $blocks = $mTemplates->regionsBlocks($this->template_name); // Список всех регионов $_regions = M_Regions::Instance()->getByTemplate($this->template_name); $regions = array(); // Подключаем хлебные крошки(навигацию) $this->blocks['_content_page'] = $this->getBreadCrumbs($this->menuLinkId) . "" . $this->blocks['_content_page']; // Наполняем регионы содержимым блоков foreach ($_regions as $region) { $rid = $region['region_id']; if ($rid == 0) { continue; } if (isset($blocks[$rid])) { foreach ($blocks[$rid] as $block) { $regions[$region['region_name']][] = isset($this->blocks[$block['block_name']]) ? $this->blocks[$block['block_name']] : ""; } } else { $regions[$region['region_name']] = array(); } } $regions_s = array(); // Делаем каждый регион строкой foreach ($regions as $key => $region) { $regions_s[$key] = implode("\n", $region); } $this->regions = $regions_s; $page = $this->Template($this->template, $this); //print_r($page); //echo $page; echo $this->replace_widgets($page); }
public function before() { $this->template_name = M_Templates::Instance()->getCurrentTemplate(); $this->templateDir = BASE_URL . TEMPLATE_DIR . $this->template_name; }