$categBlock = $blockInfos['block_category']; } else { $categBlock = $module; } if (!isset($blocksCat[$categBlock])) { $blocksCat[$categBlock] = ''; } if (isset($blockInfos['description'])) { $description = ucfirst(s($blockInfos['description'])); } $blocksCat[$categBlock] .= '<div class="admin_core_block tooltip" data-title="' . trim(ucfirst(s($blockInfos['title']))) . '" data-tooltip="' . $description . '" draggable="true" id="' . str_replace('\\', '', $blockClassName) . '" data-block="' . $blockClassName . '" style="background:url(' . BASE_PATH . $module . '/blocks/' . $blockName . '/icon.png) center center no-repeat;"></div>'; } /* List default stylables selecteurs */ if (is_file('modules/' . $module . '/blocks/' . $blockName . '/default.css')) { $css = new css('modules/' . $module . '/blocks/' . $blockName . '/default.css'); $CSSValues = $css->getCSSValues(); if (!isset($stylableElements[$module . '_' . $blockName])) { $stylableElements[$module . '_' . $blockName] = array(); } foreach ($CSSValues as $selecteur => $components) { preg_match('@\\{(.*)\\}@', $components['b'], $res); if (!empty($res)) { $stylableElements[$module . '_' . $blockName][$res[1]] = $selecteur; } } } } } foreach ($blocksCat as $title => $blocks) { echo '<div class="titleTab ellipsis">' . t(ucfirst($title), FALSE) . '</div>'; echo '<div id="blocks_' . $title . '">' . $blocks . '</div>';
/** * Send content to client * @param mixed $body optional */ public function setContent($body = '', $status = FALSE) { if ($status !== FALSE) { $this->setStatus($status); } if ($body instanceof page) { /* If it's a page object */ $this->page = $body; /* Save page object */ /* Init defaults JS and CSS for CMS pages */ $this->addJSFile('core/js/parsimony.js'); $this->addCSSFile('core/css/parsimony.css'); \app::dispatchEvent('beforePageLoad'); $theme = $this->page->getTheme(); if ($theme instanceof theme) { define('THEMEMODULE', $theme->getModule()); define('THEME', $theme->getName()); $this->addCSSFile(THEMEMODULE . '/themes/' . THEME . '/style.css'); $body = $theme->display(); /* Display with theme */ } else { define('THEMEMODULE', ''); define('THEME', ''); $body = $body->display(); /* Display without theme */ } /* Set page infos to admin */ if (!defined('PARSI_ADMIN') && $_SESSION['permissions'] > 0 && \app::$request->getParam('popup') !== '') { $timer = isset($_SERVER['REQUEST_TIME_FLOAT']) ? round(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 4) : '~ ' . floor(microtime(true) - $_SERVER['REQUEST_TIME']); /* Be sure that editiniline can be used in edit mode */ \app::$response->addJSFile('core/js/editinline.js'); \app::$response->addCSSFile('core/css/editinline.css'); /* correct resMax with preview screen */ \app::$response->head .= '<script>document.cookie = "DW=" + (top.ParsimonyAdmin.getCookie("screenX") || screen.width) + ";path=/";document.cookie = "DH=" + (top.ParsimonyAdmin.getCookie("screenY") || screen.height) + ";path=/";</script>'; $body .= '<script>top.document.getElementById("infodev_timer").textContent="' . $timer . ' s";top.document.getElementById("infodev_module").textContent="' . MODULE . '";top.document.getElementById("infodev_theme").textContent="' . THEME . '";top.setActiveTheme("' . THEME . '");top.document.getElementById("infodev_page").textContent="' . $this->page->getId() . '";'; $pathTheme = THEMEMODULE . '/themes/' . THEME . '/style.css'; if ($_SESSION['permissions'] & 16) { /* Store on client side all CSS selectors from theme style */ $css = new css(stream_resolve_include_path($pathTheme)); $CSSValues = $css->getCSSValues(); $body .= 'top.Parsimony.blocks["admin_css"].CSSValues["' . $pathTheme . '"] = ' . json_encode($CSSValues) . ';'; } $body .= 'top.history.replaceState({url:document.location.pathname}, document.title, document.location.pathname.replace("?preview=ok","").replace("preview=ok",""));top.$_GET=' . json_encode($_GET) . ';top.$_POST=' . json_encode($_POST) . ';top.CSSTHEMEPATH = "' . $pathTheme . '";top.CSSPAGEPATH = "' . MODULE . '/css/' . DEVICE . '.css";document.addEventListener("DOMContentLoaded", function() {top.ParsimonyAdmin.initPreview();}); </script>'; } \app::dispatchEvent('afterPageLoad'); /* Wrap body with HTML structure */ ob_start(); include 'core/views/index.php'; $body = ob_get_clean(); \app::dispatchEvent('beforePageDisplay', array(&$body)); /* allow to process files before they are sent to the client */ } /* Set headers */ header($_SERVER['SERVER_PROTOCOL'] . ' ' . $this->status . ' ' . self::$HTTPstatus[$this->status], true, $this->status); header('Content-type: ' . \app::$config['ext'][$this->format] . '; charset=' . $this->charset); header('Vary: User-Agent'); /* Dynamically serving different HTML on the same URL */ foreach ($this->headers as $label => $header) { header($label . ': ' . $header); } /* Set body to client */ $this->body = $body; }