当前位置: 首页>>代码示例>>PHP>>正文


PHP Layout::getControllers方法代码示例

本文整理汇总了PHP中Layout::getControllers方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::getControllers方法的具体用法?PHP Layout::getControllers怎么用?PHP Layout::getControllers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Layout的用法示例。


在下文中一共展示了Layout::getControllers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexSection

 /**
  * Displays all layouts for a site type
  *
  * @param string $siteType
  * @return string
  */
 public function indexSection($siteType = null)
 {
     $this->setOutputType(self::_OT_CONFIG);
     // Check if there is a specified site type to manage layout for
     if (empty($siteType)) {
         try {
             $siteType = $this->_input->get('type');
         } catch (Input_KeyNoExist $e) {
             $siteType = $this->_router->getDefaultSiteType();
         }
     }
     $siteType = strtolower($siteType);
     if (!$this->_router->siteTypeExists($siteType)) {
         $this->_event->error(t('Selected site type does not exist'));
         return zula_redirect($this->_router->makeUrl('content_layout'));
     }
     $this->setTitle(sprintf(t('"%s" content layouts'), ucfirst($siteType)), false);
     // Find out what module is being used in the fpsc layout
     $fpsc = new Layout('fpsc-' . $siteType);
     $cntrlrs = $fpsc->getControllers('SC');
     $fpscCntrlr = reset($cntrlrs);
     // Get all modules for the user to choose from, with title
     $modules = array();
     foreach (Module::getModules() as $mod) {
         $modObj = new Module($mod);
         $modules[$modObj->name] = $modObj->title;
     }
     // Gather all layouts and build view
     $view = $this->loadView('index/main.html');
     $view->assign(array('SITE_TYPE' => $siteType, 'LAYOUTS' => Layout::getAll($siteType), 'FPSC_MODULE' => $fpscCntrlr['mod'], 'MODULES' => $modules));
     $view->assignHtml(array('CSRF' => $this->_input->createToken(true)));
     return $view->getOutput();
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:39,代码来源:index.php

示例2: Dispatcher

 * not enough data simply use the frontpage sc layout for the current site type
 */
Hooks::notifyAll('bootstrap_pre_request');
$dispatcher = new Dispatcher();
$dispatcher->setDisplayErrors($zula->getMode() == 'normal')->setStatusHeader($zula->getMode() != 'cli');
Registry::register('dispatcher', $dispatcher);
# For compatibility, not sure if we should still have this
$requestedUrl = $router->getParsedUrl();
if ($requestedUrl->module == null) {
    // Load data fron the fpsc (Front Page Sector Content) layout
    if ($zula->getState() == 'setup') {
        $fpsc = new Layout($zula->getDir('setup') . '/layout-fpsc.xml');
    } else {
        $fpsc = new Layout('fpsc-' . $requestedUrl->siteType);
    }
    $fpscCntrlr = $fpsc->getControllers('SC');
    $fpscCntrlr = array_shift($fpscCntrlr);
    $requestedUrl->module($fpscCntrlr['mod'])->controller($fpscCntrlr['con'])->section($fpscCntrlr['sec']);
    $dispatchConfig = (array) $fpscCntrlr['config'];
} else {
    $dispatchConfig = array();
}
if ($zula->getMode() == 'normal' && $config->get('theme/use_global')) {
    if ($zula->getState() == 'setup') {
        $themeName = 'purity';
    } else {
        $themeName = $config->get('theme/' . $router->getSiteType() . '_default');
    }
    define('_THEME_NAME', $themeName);
    try {
        $theme = new Theme($themeName);
开发者ID:jinshana,项目名称:tangocms,代码行数:31,代码来源:bootstrap.php

示例3: upgradeTo_260_alpha1

    /**
     * Upgrades to 2.6.0-alpha1 (2.5.60)
     *
     * @return bool|string
     */
    protected function upgradeTo_260_alpha1()
    {
        switch ($this->version) {
            case '2.5.0':
            case '2.5.1':
            case '2.5.2':
            case '2.5.3':
            case '2.5.4':
            case '2.5.5':
            case '2.5.6':
            case '2.5.50':
                foreach (array('main', 'admin') as $siteType) {
                    $layout = new Layout($siteType . '-default');
                    $sc = $layout->getControllers('SC');
                    $sc = array_shift($sc);
                    $layout->detachController($sc['id']);
                    $layout->save();
                    // Create the new FPSC (FrontPage Sector Content) layout
                    $layout = new Layout('fpsc-' . $siteType);
                    $layout->addController('SC', $sc, $sc['id']);
                    $layout->save();
                }
            case '2.5.51':
                $this->sqlFile('2.6.0-alpha1/2.5.52.sql');
            case '2.5.52':
                $this->sqlFile('2.6.0-alpha1/2.5.53.sql');
            case '2.5.53':
                $this->_config_sql->add('media/wm_position', 'bl');
            case '2.5.54':
                /**
                 * Update the ACL resources for the page changes (#247)
                 */
                $this->sqlFile('2.6.0-alpha1/2.5.55.sql');
                $addRoles = $editRoles = $manageRoles = array();
                foreach ($this->_acl->getAllRoles() as $role) {
                    if ($this->_acl->check('page_delete', $role['id'])) {
                        $editRoles[] = $role['name'];
                        $manageRoles[] = $role['name'];
                    } else {
                        if ($this->_acl->check('page_edit', $role['id'])) {
                            $editRoles[] = $role['name'];
                        }
                    }
                    if ($this->_acl->check('page_add', $role['id'])) {
                        $addRoles[] = $role['name'];
                    }
                }
                // Add in the new resources
                $query = $this->_sql->query('SELECT SUBSTRING(name, 11) AS pid FROM {PREFIX}acl_resources
													WHERE name LIKE "page-view_%"');
                foreach ($query->fetchAll(PDO::FETCH_COLUMN) as $pid) {
                    $this->_acl->allowOnly('page-edit_' . $pid, $editRoles);
                    $this->_acl->allowOnly('page-manage_' . $pid, $manageRoles);
                }
                $this->_acl->deleteResource(array('page_add', 'page_edit', 'page_delete'));
                $this->_acl->allowOnly('page_manage', $addRoles);
            case '2.5.55':
                $this->sqlFile('2.6.0-alpha1/2.5.56.sql');
            case '2.5.56':
            default:
                return '2.5.60';
        }
    }
开发者ID:jinshana,项目名称:tangocms,代码行数:68,代码来源:migrate.php

示例4: loadLayout

 /**
  * Loads all needed controllers from the layout into the correct sectors.
  *
  * @param object $layout
  * @return int
  */
 public function loadLayout(Layout $layout)
 {
     // Work out what file the modules output will be wrapped in
     $moduleWrapFile = $this->getDetail('path') . '/module_wrap.html';
     if (($style = $this->getDetail('style')) != false) {
         $tmpFile = $this->getDetail('path') . '/styles/' . $style . '/module_wrap.html';
         if (file_exists($tmpFile)) {
             $moduleWrapFile = $tmpFile;
         }
     }
     // Load all of the controllers into the correct sector
     $cntrlrCount = 0;
     foreach ($this->getSectors() as $sector) {
         foreach ($layout->getControllers($sector['id']) as $cntrlr) {
             if ($cntrlr['sector'] == 'SC') {
                 continue;
             }
             $resource = 'layout_controller_' . $cntrlr['id'];
             if (_ACL_ENABLED && ($this->_acl->resourceExists($resource) && !$this->_acl->check($resource, null, false))) {
                 continue;
             }
             $cntrlrOutput = false;
             try {
                 $module = new Module($cntrlr['mod']);
                 $ident = $cntrlr['mod'] . '::' . $cntrlr['con'] . '::' . $cntrlr['sec'];
                 $tmpCntrlr = $module->loadController($cntrlr['con'], $cntrlr['sec'], $cntrlr['config'], $sector['id']);
                 if ($tmpCntrlr['output'] !== false) {
                     /**
                      * Wrap the cntrlr in the module_wrap.html file
                      */
                     if ($cntrlr['config']['displayTitle'] === 'custom' && !empty($cntrlr['config']['customTitle'])) {
                         $title = $cntrlr['config']['customTitle'];
                     } else {
                         $title = isset($tmpCntrlr['title']) ? $tmpCntrlr['title'] : t('Oops!', I18n::_DTD);
                     }
                     $wrap = new View($moduleWrapFile);
                     $wrap->assign(array('ID' => $cntrlr['id'], 'TITLE' => $title, 'DISPLAY_TITLE' => !empty($cntrlr['config']['displayTitle']), 'WRAP_CLASS' => $cntrlr['config']['htmlWrapClass']));
                     $wrap->assignHtml(array('CONTENT' => $tmpCntrlr['output']));
                     $this->loadIntoSector($cntrlr['sector'], $wrap->getOutput());
                     ++$cntrlrCount;
                 }
             } catch (Module_NoExist $e) {
                 $this->_log->message('sector module "' . (isset($ident) ? $ident : $cntrlr['mod']) . '" does not exist', Log::L_WARNING);
             } catch (Module_ControllerNoExist $e) {
                 $this->_log->message($e->getMessage(), Log::L_WARNING);
             } catch (Module_UnableToLoad $e) {
                 // Could also be a Module_NoPermission
             }
         }
         if (!$this->isAssigned($sector['id'])) {
             $this->loadIntoSector($sector['id'], '');
         }
     }
     return $cntrlrCount;
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:61,代码来源:Theme.php

示例5: fpscSection

 /**
  * Updates which module to use in the FPSC layout (module used in the homepage)
  *
  * @return bool
  */
 public function fpscSection()
 {
     try {
         $siteType = $this->_input->post('content_layout/siteType');
         $module = $this->_input->post('content_layout/module');
         if ($this->_router->siteTypeExists($siteType)) {
             $layout = new Layout('fpsc-' . $siteType);
             $fpscCntrlr = $layout->getControllers('SC');
             $fpscCntrlr = reset($fpscCntrlr);
             if ($module != $fpscCntrlr['mod']) {
                 // User is changing the module, remove and add new
                 $layout->detachController($fpscCntrlr['id']);
                 $cntrlrId = $layout->addController('SC', array('mod' => $module));
                 $layout->save();
                 $this->_event->success(t('Updated homepage module'));
             } else {
                 $cntrlrId = $fpscCntrlr['id'];
             }
             return zula_redirect($this->_router->makeUrl('content_layout', 'edit', 'fpsc-' . $siteType, null, array('id' => $cntrlrId)));
         } else {
             $this->_event->error(t('Selected site type does not exist'));
         }
     } catch (Input_KeyNoExist $e) {
     }
     return zula_redirect($this->_router->makeUrl('content_layout'));
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:31,代码来源:manage.php


注:本文中的Layout::getControllers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。