コード例 #1
0
ファイル: Page.php プロジェクト: ngardner/BentoCMS
 function actionIndex($params = '')
 {
     $objPage = new PagesModel();
     $objLayout = new LayoutModel();
     $page_id = !empty($params['page_id']) ? intval($params['page_id']) : 0;
     $previewPage = !empty($params['preview']) ? true : false;
     if (empty($params['page_id'])) {
         $page_id = $objPage->getPageId('home');
     }
     $pageInfo = $objPage->loadPage($page_id);
     if (!empty($pageInfo) && $pageInfo['status'] == 'published' && $pageInfo['type'] == 'page' || $previewPage == true) {
         // load additional page info
         $sideBars = $objPage->getPageSidebars($page_id);
         $layoutInfo = $objLayout->loadLayout($pageInfo['layout_id']);
         // used to set active state in menu
         $this->view->current_page = $pageInfo['keyName'];
         //assign template vars
         $this->view->assign('pageTitle', $pageInfo['title']);
         $this->view->assign('content', $this->view->fetch('fromstring:' . $pageInfo['content']));
         if (!empty($sideBars)) {
             $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $sideBars['left']['content']));
             $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $sideBars['right']['content']));
         }
         $this->view->assign('layout', $this->view->fetch('fromstring:' . $layoutInfo['code']));
     } else {
         // page not found
         $this->view->assign('layout', '404 - ' . print_r($params, true));
     }
     $this->finish();
 }
コード例 #2
0
ファイル: Search.php プロジェクト: ngardner/BentoCMS
 function actionIndex($params = '')
 {
     $objSearch = new SearchModel();
     $searchQuery = !empty($params['searchQuery']) ? $params['searchQuery'] : '';
     $searchOptions = array();
     $searchResults = false;
     // load templates
     $objLayout = new LayoutModel();
     $objTemplate = new TemplatesModel();
     $layoutInfo = $objLayout->loadLayout();
     $template = $objTemplate->loadTemplateFromKeyname('search');
     // doing search?
     if (!empty($searchQuery)) {
         // add search options
         if (!empty($params['searchForType'])) {
             foreach ($params['searchForType'] as $typeSearch) {
                 $searchOptions[] = array('type' => 'type', 'value' => $typeSearch);
             }
         }
         // do search
         $searchResults = $objSearch->performSearch($searchQuery, $searchOptions);
     }
     // assign to template
     $this->view->assign('searchQuery', $searchQuery);
     $this->view->assign('searchOptions', $searchOptions);
     $this->view->assign('searchResults', $searchResults);
     // render template
     $this->view->assign('content', $this->view->fetch('fromstring:' . $template['content']));
     $this->view->assign('sidebar_left', $this->view->fetch('fromstring:' . $template['left_sidebar']));
     $this->view->assign('sidebar_right', $this->view->fetch('fromstring:' . $template['right_sidebar']));
     $this->view->assign('layout', $this->view->fetch('fromstring:' . $layoutInfo['code']));
     $this->finish();
 }
コード例 #3
0
ファイル: Error.php プロジェクト: ngardner/BentoCMS
 function actionRequiresaccount($params = '')
 {
     $objLayout = new LayoutModel();
     $layoutInfo = $objLayout->loadLayout();
     $this->view->assign('content', 'To view this page, you must have an account. Please login or register.');
     $this->view->assign('layout', $this->view->fetch('fromstring:' . $layoutInfo['code']));
     $this->finish();
 }
コード例 #4
0
ファイル: Design.php プロジェクト: ngardner/BentoCMS
 function actionDeletelayout($params = '')
 {
     if (!empty($params['layout_id'])) {
         $objLayouts = new LayoutModel();
         if ($objLayouts->safeToDelete($params['layout_id'])) {
             $objLayouts->deleteLayout($params['layout_id']);
             $this->messages[] = array('type' => 'success', 'message' => 'Layout has been deleted.');
         } else {
             $this->messages[] = array('type' => 'error', 'message' => 'Cannot delete. There are still pages assigned to this layout.');
         }
     } else {
         $this->messages[] = array('type' => 'error', 'message' => 'Unknown layout to delete.');
     }
     $this->actionLayouts();
 }
コード例 #5
0
    /**
     * Include the JavaScript SDK library
     * @param string
     */
    public static function includeJavascriptSDK($strLanguage = 'en_US')
    {
        $strKey = '';
        // Use the TL_BODY if available
        if (version_compare(VERSION, '3.1', '>=')) {
            $strKey = 'TL_BODY';
        } else {
            global $objPage;
            $objLayout = \LayoutModel::findByPk($objPage->layout);
            if ($objLayout !== null) {
                // Use jQuery
                if ($objLayout->addJQuery) {
                    $strKey = 'TL_JQUERY';
                }
                // Use MooTools
                if ($objLayout->addMooTools) {
                    $strKey = 'TL_MOOTOOLS';
                }
            }
        }
        if ($strKey == '') {
            return;
        }
        $GLOBALS[$strKey]['FB_JSSDK'] = '<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/' . $strLanguage . '/all.js#xfbml=1&status=0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));</script>';
    }
コード例 #6
0
 public function addRules(CreateManipulatorEvent $event)
 {
     if (($rules = RuleModel::findPublishedByActiveTheme()) === null) {
         return;
     }
     // No need to check for null values again as already done by Rule::findPublishedByActiveTheme()
     global $objPage;
     $layout = \LayoutModel::findByPk($objPage->layout);
     // Do not modify anything if the template name is not the one of the current page layout
     // e.g. when a developer calls Template::output() manually
     if ($layout->template !== $event->getTemplateName()) {
         return;
     }
     $factory = $event->getFactory();
     /**
      * @var $ruleModel RuleModel
      */
     foreach ($rules as $ruleModel) {
         $query = new XPathQuery($ruleModel->getXPathExpr());
         $rule = new AttributeRule($query, 'class');
         $rule->addFilter(new CssClassFilter($ruleModel->getDirectives()));
         $rule->addFilter(new TrimWhitespacesFilter());
         $factory->addRule($rule);
     }
 }
コード例 #7
0
ファイル: Article.php プロジェクト: bit3/contao-merger2
 public function getActiveLayoutSections(\DataContainer $dc)
 {
     $callback = $GLOBALS['TL_DCA']['tl_article']['fields']['inColumn']['bit3_merger_original_options_callback'];
     if (is_array($callback)) {
         $object = \System::importStatic($callback[0]);
         $methodName = $callback[1];
         $sections = $object->{$methodName}($dc);
     } else {
         $sections = call_user_func($callback, $dc);
     }
     if ($dc->activeRecord->pid) {
         $page = \PageModel::findWithDetails($dc->activeRecord->pid);
         // Get the layout sections
         foreach (array('layout', 'mobileLayout') as $key) {
             if (!$page->{$key}) {
                 continue;
             }
             $layout = \LayoutModel::findByPk($page->{$key});
             if ($layout === null) {
                 continue;
             }
             $modules = deserialize($layout->modules);
             if (empty($modules) || !is_array($modules)) {
                 continue;
             }
             // Find all sections with an article module (see #6094)
             foreach ($modules as $module) {
                 if ($module['mod'] != 0 && $module['enable']) {
                     $this->joinModule($module['col'], $module['mod'], $sections);
                 }
             }
         }
     }
     return array_values(array_unique($sections));
 }
コード例 #8
0
 public static function isJQueryEnabled()
 {
     global $objPage;
     $blnMobile = $objPage->mobileLayout && \Environment::get('agent')->mobile;
     $intId = $blnMobile && $objPage->mobileLayout ? $objPage->mobileLayout : $objPage->layout;
     $objLayout = \LayoutModel::findByPk($intId);
     return $objLayout->addJQuery;
 }
コード例 #9
0
 /**
  * get current layout of current page
  *
  * @return \LayoutModel|\Model|null
  */
 public static function getLayout()
 {
     if (self::$pageLayout === null) {
         global $objPage;
         if ($objPage !== null) {
             self::$pageLayout = \LayoutModel::findByPk($objPage->layout);
         }
     }
     return self::$pageLayout;
 }
コード例 #10
0
ファイル: Pa2.php プロジェクト: craffft/contao-photoalbums2
 /**
  * addCssFile function.
  *
  * @access public
  * @return void
  */
 public function addCssFile()
 {
     global $objPage;
     // Get layout skipPhotoalbums2 to disable photoalbums2 css file
     $objLayout = \LayoutModel::findByPk($objPage->layout);
     // Add css
     if (TL_MODE == 'FE' && $objLayout->skipPhotoalbums2 != '1' || TL_MODE == 'BE') {
         $GLOBALS['TL_CSS'][] = TL_FILES_URL . 'system/modules/photoalbums2/assets/photoalbums2.css';
     }
 }
コード例 #11
0
ファイル: Layout.php プロジェクト: bit3/contao-xyaml
 public function load($dc)
 {
     $layout = \LayoutModel::findByPk($dc->id);
     if (!$layout->xyaml) {
         return;
     }
     \MetaPalettes::appendAfter('tl_layout', 'default', 'style', array('xyaml' => array('xyaml_iehacks', 'xyaml_addons', 'xyaml_forms', 'xyaml_navigation', 'xyaml_print', 'xyaml_screen', 'xyaml_subcolumns_linearize'), 'xyaml_files' => array('xyaml_auto_include')));
     if (version_compare(VERSION, '3', '>=') && $layout->xyaml_path_source != $GLOBALS['TL_CONFIG']['uploadPath']) {
         $GLOBALS['TL_DCA']['tl_layout']['fields']['xyaml_path']['inputType'] = 'fileSelector';
     }
     $GLOBALS['TL_DCA']['tl_layout']['fields']['xyaml_path']['eval']['path'] = $layout->xyaml_path_source;
 }
コード例 #12
0
 public function hookReplaceDynamicScriptTagsHook($strBuffer)
 {
     global $objPage;
     if (!$objPage) {
         return $strBuffer;
     }
     $objLayout = \LayoutModel::findByPk($objPage->layout);
     if (!$objLayout) {
         return $strBuffer;
     }
     \HeimrichHannot\Bootstrapper\BootstrapperAssets::registerComponents($objLayout);
     return $strBuffer;
 }
コード例 #13
0
ファイル: FontLoader.php プロジェクト: pdir/contao-fontloader
 /**
  * Add font tags
  * @param PageModel $objPage
  * @param LayoutModel $objLayout
  * @param PageRegular $objThis
  */
 public function hookGetPageLayout($objPage, &$objLayout, $objThis)
 {
     global $objPage;
     if (!$objPage) {
         return $strBuffer;
     }
     $objLayout = \LayoutModel::findByPk($objPage->layout);
     if (!$objLayout) {
         return $strBuffer;
     }
     // the dynamic script replacement array
     $arrReplace = array();
     $this->parseFontGroup($objLayout, $arrReplace);
     return $strBuffer;
 }
コード例 #14
0
ファイル: Content.php プロジェクト: ngardner/BentoCMS
 function actionEditpage($params = '')
 {
     $objPage = new PagesModel();
     $objLayouts = new LayoutModel();
     $page_id = !empty($params['page_id']) ? intval($params['page_id']) : false;
     if (!empty($params['dosave'])) {
         $page_id = $this->savePage($params);
         if (!empty($params['ajaxsave'])) {
             $pageInfo = $objPage->loadPage($page_id);
             echo json_encode($pageInfo);
             return;
         }
         $this->messages[] = array('type' => 'success', 'message' => 'Page has been saved.');
         if ($params['submit'] == 'Save and Close') {
             $this->actionPages();
             return;
         }
     }
     $pageList = $objPage->getPages();
     $this->view->assign('pageList', $pageList);
     $layouts = $objLayouts->getLayouts();
     $this->view->assign('layouts', $layouts);
     if (!empty($page_id)) {
         $pageInfo = $objPage->loadPage($page_id);
         $pageInfo['sidebars'] = $objPage->getPageSidebars($pageInfo['id']);
         $this->view->assign('pageInfo', $pageInfo);
     }
     if (!empty($params['type']) && $params['type'] == 'link') {
         $tpl = 'tpl/content/link.tpl';
     } else {
         $tpl = 'tpl/content/page.tpl';
     }
     $this->view->assign('content', $this->view->fetch($tpl));
     $this->view->assign('messages', $this->messages);
     $this->finish();
 }
コード例 #15
0
 /**
  * Return all testimonials templates as array
  * @param DataContainer
  * @return array
  */
 public function getTestimonialsTemplates(DataContainer $dc)
 {
     $intPid = $dc->activeRecord->pid;
     if ($this->Input->get('act') == 'overrideAll') {
         $intPid = $this->Input->get('id');
     }
     // Get the page ID
     $objArticle = $this->Database->prepare("SELECT pid FROM tl_article WHERE id=?")->limit(1)->execute($intPid);
     // Inherit the page settings
     $objPage = $this->getPageDetails($objArticle->pid);
     // Get the theme ID
     $objLayout = LayoutModel::findByPk($objPage->layout);
     // Return all templates
     return $this->getTemplateGroup('testimonial_', $objLayout->pid);
 }
コード例 #16
0
 public function hookReplaceDynamicScriptTags($strBuffer)
 {
     global $objPage;
     if (!$objPage) {
         return $strBuffer;
     }
     $objLayout = \LayoutModel::findByPk($objPage->layout);
     if (!$objLayout) {
         return $strBuffer;
     }
     // the dynamic script replacement array
     $arrReplace = array();
     $this->parseExtJs($objLayout, $arrReplace);
     return $strBuffer;
 }
コード例 #17
0
 public function loadArticleDca($dc)
 {
     $layout = null;
     $article = \ArticleModel::findByPk($dc->id);
     $page = \PageModel::findWithDetails($article->pid);
     while (!$layout && $page) {
         if ($page->includeLayout) {
             $layout = \LayoutModel::findByPk($page->layout);
         } else {
             $page = \PageModel::findWithDetails($page->pid);
         }
     }
     if ($layout && $layout->useRevealJs) {
         \MetaPalettes::appendFields('tl_article', 'default', 'template', array('revealVerticalSlide'));
     }
 }
コード例 #18
0
 public function run()
 {
     try {
         $objChildLayouts = LayoutModel::findBy(array('isChild=1', 'specificFields<>\'\'', 'specificLegends=\'\''), array());
     } catch (Exception $e) {
         return;
     }
     while (null !== $objChildLayouts && $objChildLayouts->next()) {
         $arrFields = deserialize($objChildLayouts->specificFields);
         $arrLegends = array();
         foreach ($arrFields as $section) {
             preg_match('/\\{([^\\}]+?)\\}/', $section, $matches);
             $arrLegends[] = strstr($matches[1], ':', true) ?: $matches[1];
         }
         $objChildLayouts->specificLegends = implode(',', $arrLegends);
         $objChildLayouts->save();
     }
 }
コード例 #19
0
ファイル: tl_content.php プロジェクト: rburch/core
 /**
  * Return all comments templates as array
  * @param \DataContainer
  * @return array
  */
 public function getCommentsTemplates(DataContainer $dc)
 {
     // Only look for a theme in the articles module (see #4808)
     if (Input::get('do') == 'article') {
         $intPid = $dc->activeRecord->pid;
         if (Input::get('act') == 'overrideAll') {
             $intPid = Input::get('id');
         }
         // Get the page ID
         $objArticle = $this->Database->prepare("SELECT pid FROM tl_article WHERE id=?")->limit(1)->execute($intPid);
         // Inherit the page settings
         $objPage = $this->getPageDetails($objArticle->pid);
         // Get the theme ID
         $objLayout = LayoutModel::findByPk($objPage->layout);
         if ($objLayout === null) {
             return array();
         }
     }
     // Return all gallery templates
     return $this->getTemplateGroup('com_', $objLayout->pid);
 }
コード例 #20
0
ファイル: tl_content.php プロジェクト: RockKeeper/tabcontrol
 /**
  * Return all tabcontrol templates as array
  */
 public function getTabcontrolTemplates(DataContainer $dc)
 {
     // Only look for a theme in the articles module (see #4808)
     if (Input::get('do') == 'article') {
         $intPid = $dc->activeRecord->pid;
         if (Input::get('act') == 'overrideAll') {
             $intPid = Input::get('id');
         }
         // Get the page ID
         $objArticle = $this->Database->prepare("SELECT pid FROM tl_article WHERE id=?")->limit(1)->execute($intPid);
         // Inherit the page settings
         $objPage = $this->getPageDetails($objArticle->pid);
         // Get the theme ID
         $objLayout = LayoutModel::findByPk($objPage->layout);
         if ($objLayout === null) {
             return array();
         }
     }
     $templateSnip = '';
     switch ($dc->activeRecord->tabType) {
         case 'tabcontrolstart':
             $templateSnip = 'start';
             break;
         case 'tabcontrolstop':
             $templateSnip = 'stop';
             break;
         case 'tabcontrol_end':
             $templateSnip = 'end';
             break;
         case 'tabcontroltab':
         default:
             $templateSnip = 'tab';
             break;
     }
     // Return all gallery templates
     return $this->getTemplateGroup('ce_tabcontrol_' . $templateSnip, $objLayout->pid);
 }
コード例 #21
0
 /**
  * Load all section label from used page layout.
  *
  * @param string         $value         Active used column.
  * @param \DataContainer $dataContainer Data container driver.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function loadSectionLabels($value, $dataContainer)
 {
     // Show only active sections
     if ($dataContainer->activeRecord->pid) {
         $page = \PageModel::findWithDetails($dataContainer->activeRecord->pid);
         // Get the layout sections
         foreach (array('layout', 'mobileLayout') as $key) {
             if (!$page->{$key}) {
                 continue;
             }
             $objLayout = \LayoutModel::findByPk($page->{$key});
             if ($objLayout === null) {
                 continue;
             }
             $sections = deserialize($objLayout->flexible_sections, true);
             foreach ($sections as $section) {
                 if (!isset($GLOBALS['TL_LANG']['tl_article'][$section['id']])) {
                     $GLOBALS['TL_LANG']['tl_article'][$section['id']] = $section['label'] ?: $section['id'];
                 }
             }
         }
     }
     return $value;
 }
コード例 #22
0
 /**
  * Update all child layouts belonging to parent layout
  * @category onsubmit_callback
  *
  * @param \DataContainer $dc
  */
 public function updateChildLayouts(\DataContainer $dc)
 {
     if ($dc->activeRecord->isChild) {
         /** @type \Model $objParentLayout */
         $objParentLayout = \LayoutModel::findByPk($dc->activeRecord->parentLayout);
         $arrData = $objParentLayout->row();
         // Delete columns that must not be overridden
         foreach (self::getColumnsToPersist() as $v) {
             unset($arrData[$v]);
         }
         // Delete columns specific for this child layout
         if ($dc->activeRecord->specificLegends) {
             $this->deleteSpecificColumns($dc->activeRecord->specificLegends, $arrData, $dc->activeRecord->row());
         }
         // Save parent data in database
         // Do not use the LayoutModel here
         \Database::getInstance()->prepare("UPDATE tl_layout %s WHERE id=?")->set($arrData)->execute($dc->id);
     } else {
         $objChildLayouts = \LayoutModel::findBy(array('tl_layout.isChild=1', 'tl_layout.id IN (SELECT tl_layout.id FROM tl_layout WHERE tl_layout.parentLayout=?)'), array($dc->id));
         if (null !== $objChildLayouts) {
             $arrData = $dc->activeRecord->row();
             // Delete columns specific for each layout
             foreach (self::getColumnsToPersist() as $v) {
                 unset($arrData[$v]);
             }
             while ($objChildLayouts->next()) {
                 if ($objChildLayouts->specificLegends) {
                     $this->deleteSpecificColumns($objChildLayouts->specificLegends, $arrData, $objChildLayouts->row());
                 }
                 // Update child layout row
                 // Do not use the LayoutModel here
                 \Database::getInstance()->prepare("UPDATE tl_layout %s WHERE id=?")->set($arrData)->execute($objChildLayouts->id);
             }
         }
     }
 }
コード例 #23
0
 /**
  * getArticle hook
  *
  * insert custom template when
  * getArticle hook is called
  *
  */
 public function insertCustomTemplate($tpl, $data, $article)
 {
     global $objPage;
     $layoutID = $objPage->layout;
     $objLayout = \LayoutModel::findByID($layoutID);
     if ($objLayout->activateCArticles) {
         $template = new \FrontendTemplate('mod_customarticle');
         $count = count($tpl->elements);
         $containertype = 'container';
         $article_color = \Contao\StringUtil::deserialize($tpl->article_color);
         $article_width = \Contao\StringUtil::deserialize($tpl->article_width);
         $article_minheight = \Contao\StringUtil::deserialize($tpl->article_minheight);
         $article_image = $tpl->article_image;
         $article_image_position = $tpl->article_image_position;
         $article_image_repeat = $tpl->article_image_repeat;
         $article_image_cover = $tpl->article_image_cover;
         $article_image_fixed = $tpl->article_image_fixed;
         $inner_article_width = \Contao\StringUtil::deserialize($tpl->inner_article_width);
         $inner_article_space = $tpl->inner_article_space;
         $inner_article_overflow = $tpl->inner_article_overflow;
         $inner_article_color = \Contao\StringUtil::deserialize($tpl->inner_article_color);
         $inner_article_float = $tpl->inner_article_float;
         $inner_article_minheight = \Contao\StringUtil::deserialize($tpl->inner_article_minheight);
         if ($tpl->article_visible != '') {
             $tmpclasses = $article->cssID;
             $article_visible = @unserialize($tpl->article_visible);
             if ($article_visible === 'b:0;' || $article_visible !== false) {
                 foreach (\Contao\StringUtil::deserialize($tpl->article_hidden) as $key => $value) {
                     $tmpclasses[1] .= ' ' . $value;
                 }
             } else {
                 $tmpclasses[1] .= ' ' . $tpl->article_visible;
             }
             $article->cssID = $tmpclasses;
         }
         if ($tpl->article_hidden != '') {
             $tmpclasses = $article->cssID;
             $article_hidden = @unserialize($tpl->article_hidden);
             if ($article_hidden === 'b:0;' || $article_hidden !== false) {
                 foreach (\Contao\StringUtil::deserialize($tpl->article_hidden) as $key => $value) {
                     $tmpclasses[1] .= ' ' . $value;
                 }
             } else {
                 $tmpclasses[1] .= ' ' . $tpl->article_hidden;
             }
             $article->cssID = $tmpclasses;
         }
         $customstyle = ".mod_article.customarticle_{$tpl->id} { ";
         if (isset($article_width['value']) && $article_width['value'] != '') {
             if ($article_width['value'] == 100 && $article_width['unit'] == "%") {
                 $containertype = 'container-fluid';
             } else {
                 $containertype = 'container';
             }
             $customstyle .= "width:" . $article_width['value'] . $article_width['unit'] . " !important;";
             $customstyle .= "max-width:" . $article_width['value'] . $article_width['unit'] . " !important;";
         }
         if (isset($article_minheight['value']) && $article_minheight['value'] != '') {
             $customstyle .= "min-height:" . $article_minheight['value'] . $article_minheight['unit'] . " !important;";
         }
         if (isset($article_color[0]) && $article_color[0] != '') {
             $customstyle .= "background-color:" . $this->cHex2rgba($article_color[0], $article_color[1]) . " !important;";
         }
         if (isset($article_image) && $article_image != '') {
             $customstyle .= "background-image:url('" . $article_image . "') !important;";
         }
         if (isset($article_image_repeat) && $article_image_repeat != '') {
             $customstyle .= "background-repeat:" . $article_image_repeat . " !important;";
         }
         if (isset($article_image_position) && $article_image_position != '') {
             $customstyle .= "background-position:" . $article_image_position . " !important;";
         }
         if ($article_image_cover) {
             $customstyle .= "\n\t\t\t\t\t\t-webkit-background-size: cover;\n\t\t\t\t\t\t-moz-background-size: cover;\n\t\t\t\t\t\t-o-background-size: cover;\n\t\t\t\t\t\tbackground-size: cover;\n\t\t\t\t\t\tfilter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src={$img}-uri, sizingMethod='scale');\n\t\t\t\t\t\t-ms-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src={$img}-uri, sizingMethod='scale') !important;";
             if ($article_image_fixed) {
                 $customstyle .= "background-attachment: fixed";
             } else {
                 $customstyle .= "background-attachment: initial";
             }
         }
         $customstyle .= "\t}";
         $customstyle .= ".mod_article.customarticle_{$tpl->id} .outer { ";
         if (isset($inner_article_color[0]) && $inner_article_color[0] != '') {
             $customstyle .= "background-color:" . $this->cHex2rgba($inner_article_color[0], $inner_article_color[1]) . " !important;";
         }
         if (isset($inner_article_width['value']) && $inner_article_width['value'] != '') {
             $customstyle .= "width:" . $inner_article_width['value'] . $inner_article_width['unit'] . " !important;";
             $customstyle .= "max-width:" . $inner_article_width['value'] . $inner_article_width['unit'] . " !important;";
         }
         if (isset($inner_article_height['value']) && $inner_article_height['value'] != '') {
             $customstyle .= "min-height:" . $inner_article_height['value'] . $inner_article_height['unit'] . " !important;";
         }
         $customstyle .= "\t}";
         $customstyle .= ".mod_article.customarticle_{$tpl->id} .inner { ";
         if (isset($inner_article_space) && $inner_article_space != '') {
             if ($inner_article_space == 'top_spaceing') {
                 $customstyle .= "padding-bottom:0 !important;";
             }
             if ($inner_article_space == 'bottom_spaceing') {
                 $customstyle .= "padding-top:0 !important;";
             }
             if ($inner_article_space == 'no_spaceing') {
                 $customstyle .= "padding-bottom:0 !important;";
                 $customstyle .= "padding-top:0 !important;";
             }
         }
         if (isset($inner_article_overflow) && $inner_article_overflow != '') {
             if ($inner_article_overflow == 'overflow_hidden') {
                 $customstyle .= "overflow:hidden !important;";
             }
             if ($inner_article_overflow == 'overflow_visible') {
                 $customstyle .= "overflow:visible !important;";
             }
         }
         $customstyle .= "\t}";
         $tpl->customstyle = $customstyle;
         $tpl->gridcount = $count;
         $tpl->containertype = $containertype;
         $template->setData($tpl->getData());
         $article->Template = $template;
     }
 }
コード例 #24
0
ファイル: PageRegular.php プロジェクト: bytehead/contao-core
 /**
  * Get a page layout and return it as database result object
  *
  * @param \PageModel $objPage
  *
  * @return \LayoutModel
  */
 protected function getPageLayout($objPage)
 {
     $blnMobile = $objPage->mobileLayout && \Environment::get('agent')->mobile;
     // Set the cookie
     if (isset($_GET['toggle_view'])) {
         if (\Input::get('toggle_view') == 'mobile') {
             $this->setCookie('TL_VIEW', 'mobile', 0);
         } else {
             $this->setCookie('TL_VIEW', 'desktop', 0);
         }
         $this->redirect($this->getReferer());
     }
     // Override the autodetected value
     if (\Input::cookie('TL_VIEW') == 'mobile') {
         $blnMobile = true;
     } elseif (\Input::cookie('TL_VIEW') == 'desktop') {
         $blnMobile = false;
     }
     $intId = $blnMobile && $objPage->mobileLayout ? $objPage->mobileLayout : $objPage->layout;
     $objLayout = \LayoutModel::findByPk($intId);
     // Die if there is no layout
     if (null === $objLayout) {
         header('HTTP/1.1 501 Not Implemented');
         $this->log('Could not find layout ID "' . $intId . '"', __METHOD__, TL_ERROR);
         die_nicely('be_no_layout', 'No layout specified');
     }
     $objPage->hasJQuery = $objLayout->addJQuery;
     $objPage->hasMooTools = $objLayout->addMooTools;
     $objPage->isMobile = $blnMobile;
     return $objLayout;
 }
コード例 #25
0
ファイル: tl_article.php プロジェクト: Mozan/core-bundle
 /**
  * Return all active layout sections as array
  *
  * @param DataContainer $dc
  *
  * @return array
  */
 public function getActiveLayoutSections(DataContainer $dc)
 {
     // Show only active sections
     if ($dc->activeRecord->pid) {
         $arrSections = array();
         $objPage = PageModel::findWithDetails($dc->activeRecord->pid);
         // Get the layout sections
         foreach (array('layout', 'mobileLayout') as $key) {
             if (!$objPage->{$key}) {
                 continue;
             }
             $objLayout = LayoutModel::findByPk($objPage->{$key});
             if ($objLayout === null) {
                 continue;
             }
             $arrModules = deserialize($objLayout->modules);
             if (empty($arrModules) || !is_array($arrModules)) {
                 continue;
             }
             // Find all sections with an article module (see #6094)
             foreach ($arrModules as $arrModule) {
                 if ($arrModule['mod'] == 0 && $arrModule['enable']) {
                     $arrSections[] = $arrModule['col'];
                 }
             }
         }
     } else {
         $arrSections = array('header', 'left', 'right', 'main', 'footer');
         $objLayout = $this->Database->query("SELECT sections FROM tl_layout WHERE sections!=''");
         while ($objLayout->next()) {
             $arrCustom = trimsplit(',', $objLayout->sections);
             // Add the custom layout sections
             if (!empty($arrCustom) && is_array($arrCustom)) {
                 $arrSections = array_merge($arrSections, $arrCustom);
             }
         }
     }
     return array_values(array_unique($arrSections));
 }
コード例 #26
0
ファイル: Googlemap.php プロジェクト: Olli/dlh_googlemaps
 /**
  * Inject CSS
  */
 public static function cssInjection()
 {
     global $objPage;
     $objLayout = \LayoutModel::findByPk($objPage->layout);
     $objLayout->framework = deserialize($objLayout->framework);
     if (is_array($objLayout->framework) && count($objLayout->framework) > 0) {
         $GLOBALS['TL_FRAMEWORK_CSS'][] = 'system/modules/dlh_googlemaps/assets/frontend.css';
     } else {
         $GLOBALS['TL_CSS'][] = 'system/modules/dlh_googlemaps/assets/frontend.css';
     }
 }
コード例 #27
0
 /**
  * [insertCustomGrid description]
  * @param  Database_Result $objElement
  * @param  [string]          $strBuffer
  * @return [string]
  */
 public function insertCustomGrid($objElement, $strBuffer)
 {
     global $objPage;
     $layoutID = $objPage->layout;
     $objLayout = \LayoutModel::findByID($layoutID);
     if ($objLayout->activateCArticles) {
         $strClass = $this->findContentElement($objElement->type);
         $newObjElement = new $strClass($objElement);
         $classes = ' col';
         $arrClasses = ['grid_xs' => 'col-xs-', 'grid_sm' => 'col-sm-', 'grid_md' => 'col-md-', 'grid_lg' => 'col-lg-', 'offset_xs' => 'col-xs-offset-', 'offset_sm' => 'col-sm-offset-', 'offset_md' => 'col-md-offset-', 'offset_lg' => 'col-lg-offset-', 'pull_xs' => 'col-xs-pull-', 'pull_sm' => 'col-sm-pull-', 'pull_md' => 'col-md-pull-', 'pull_lg' => 'col-lg-pull-', 'push_xs' => 'col-xs-push-', 'push_sm' => 'col-sm-push-', 'push_md' => 'col-md-push-', 'push_lg' => 'col-lg-push-'];
         foreach ($arrClasses as $key => $classPart) {
             if ($objElement->{$key} != '' && $objElement->{$key} != -1) {
                 $classes .= ' ' . $classPart . $objElement->{$key};
             }
         }
         if ($objElement->grid_visible != '') {
             $grid_visible = @unserialize($objElement->grid_visible);
             if ($grid_visible === 'b:0;' || $grid_visible !== false) {
                 foreach (\Contao\StringUtil::deserialize($objElement->grid_visible) as $key => $value) {
                     $classes .= ' ' . $value;
                 }
             } else {
                 $classes .= ' ' . $objElement->grid_visible;
             }
         }
         if ($objElement->grid_hidden != '') {
             $grid_hidden = @unserialize($objElement->grid_hidden);
             if ($grid_hidden === 'b:0;' || $grid_hidden !== false) {
                 foreach (\Contao\StringUtil::deserialize($objElement->grid_hidden) as $key => $value) {
                     $classes .= ' ' . $value;
                 }
             } else {
                 $classes .= ' ' . $objElement->grid_hidden;
             }
         }
         if ($objElement->col_no_padding || $objElement->col_no_padding != '') {
             if ($objElement->col_no_padding == 'padding_no_top_bottom') {
                 $classes .= ' col-no-padding-top-bottom';
             }
             if ($objElement->col_no_padding == 'padding_no_left_right') {
                 $classes .= ' col-no-padding-left-right';
             }
             if ($objElement->col_no_padding == 'padding_no_all') {
                 $classes .= ' col-no-padding';
             }
         }
         if ($objElement->col_centered) {
             $classes .= ' col-centered';
         }
         if ($objElement->col_newline) {
             $classes .= ' col-newline';
         }
         if ($classes != '') {
             $arrCss = \Contao\StringUtil::deserialize($objElement->cssID);
             $arrCss[1] .= $classes;
             $newObjElement->cssID = $arrCss;
         }
         $strBuffer = $newObjElement->generate();
     }
     return $strBuffer;
 }
コード例 #28
0
ファイル: tl_article.php プロジェクト: rikaix/core
 /**
  * Return all active page sections as array
  * @param \DataContainer
  * @return array
  */
 public function getActivePageSections(DataContainer $dc)
 {
     $arrCustom = array();
     $arrSections = array('header', 'left', 'right', 'main', 'footer');
     // Show only active sections
     if ($dc->activeRecord->pid) {
         // Inherit the page settings
         $objPage = $this->getPageDetails($dc->activeRecord->pid);
         // Get the layout settings
         $objLayout = LayoutModel::findByPk($objPage->layout);
         // No layout specified
         if ($objLayout === null) {
             return array('main');
         }
         $arrSections = array();
         // Header
         if ($objLayout->header) {
             $arrSections[] = 'header';
         }
         // Left column
         if ($objLayout->cols == '2cll' || $objLayout->cols == '3cl') {
             $arrSections[] = 'left';
         }
         // Right column
         if ($objLayout->cols == '2clr' || $objLayout->cols == '3cl') {
             $arrSections[] = 'right';
         }
         // Main column
         $arrSections[] = 'main';
         // Footer
         if ($objLayout->footer) {
             $arrSections[] = 'footer';
         }
         $arrCustom = deserialize($objLayout->sections);
     }
     // Always add the custom layout sections in "override all" mode
     if (Input::get('act') == 'overrideAll') {
         $arrCustom = trimsplit(',', $GLOBALS['TL_CONFIG']['customSections']);
     }
     // Add the custom layout sections
     if (is_array($arrCustom) && !empty($arrCustom)) {
         $arrSections = array_merge($arrSections, $arrCustom);
     }
     return $arrSections;
 }
コード例 #29
0
 /**
  * Get Page layout.
  *
  * @return \Model|null
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 private static function getPageLayout()
 {
     if (TL_MODE === 'FE' && isset($GLOBALS['objPage'])) {
         $layoutIdKey = $GLOBALS['objPage']->isMobile ? 'mobileLayout' : 'layout';
         return \LayoutModel::findByPk($GLOBALS['objPage']->{$layoutIdKey});
     }
     return null;
 }
コード例 #30
0
 public function buildArticleSections(CreateOptionsEvent $event)
 {
     $options = $event->getOptions();
     $sections = $options->getArrayCopy();
     $sections['header'] = 'header';
     $sections['left'] = 'left';
     $sections['right'] = 'right';
     $sections['main'] = 'main';
     $sections['footer'] = 'footer';
     $layouts = \LayoutModel::findBy(array('sections!=?'), array(''));
     if ($layouts) {
         foreach ($layouts as $layout) {
             $temp = trimsplit(',', $layout->sections);
             foreach ($temp as $section) {
                 if (!in_array($section, $sections)) {
                     $sections[$section] = $section;
                 }
             }
         }
     }
     $options->exchangeArray($sections);
 }