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


PHP Kurogo::getSiteSections方法代码示例

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


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

示例1: initializeForCommand

 public function initializeForCommand()
 {
     switch ($this->command) {
         case 'notice':
             $response = null;
             $responseVersion = 1;
             if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
                 $noticeData = $this->getOptionalModuleSection('notice');
                 if ($noticeData) {
                     $response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
                     // notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
                     if (isset($noticeData['BANNER_ALERT_MODULE'])) {
                         $moduleID = $noticeData['BANNER_ALERT_MODULE'];
                         $controller = WebModule::factory($moduleID);
                         $response['moduleID'] = $moduleID;
                         $string = "Module {$moduleID}";
                     } elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
                         $controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
                         $string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
                     } elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
                         $controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
                         $string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
                     } else {
                         throw new KurogoConfigurationException("Banner alert not properly configured");
                     }
                     if (!$controller instanceof HomeAlertInterface) {
                         throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
                     }
                     $response['notice'] = $controller->getHomeScreenAlert();
                 }
             }
             $this->setResponse($response);
             $this->setResponseVersion($responseVersion);
             break;
         case 'modules':
             if ($setcontext = $this->getArg('setcontext')) {
                 Kurogo::sharedInstance()->setUserContext($setcontext);
             }
             $responseVersion = 2;
             $response = array('primary' => array(), 'secondary' => array(), 'customize' => $this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true), 'displayType' => $this->getOptionalModuleVar('display_type', 'springboard'));
             $allmodules = $this->getAllModules();
             $navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
             foreach ($navModules as $moduleID => $moduleData) {
                 if ($module = Kurogo::arrayVal($allmodules, $moduleID)) {
                     $title = Kurogo::arrayVal($moduleData, 'title', $module->getModuleVar('title'));
                     $type = Kurogo::arrayVal($moduleData, 'type', 'primary');
                     $visible = Kurogo::arrayVal($moduleData, 'visible', 1);
                     $response[$type][] = array('tag' => $moduleID, 'title' => $title, 'visible' => (bool) $visible);
                 }
             }
             $this->setResponse($response);
             $this->setResponseVersion($responseVersion);
             break;
         default:
             $this->invalidCommand();
     }
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:57,代码来源:HomeAPIModule.php

示例2: getAllModuleNavigationData

 protected function getAllModuleNavigationData()
 {
     $modules = $moduleNavData = array('primary' => array(), 'secondary' => array());
     $navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
     foreach ($navModules as $moduleID => $moduleData) {
         $type = Kurogo::arrayVal($moduleData, 'type', 'primary');
         $moduleNavData[$type][$moduleID] = $moduleData;
     }
     return $moduleNavData;
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:10,代码来源:APIModule.php

示例3: getAllModuleNavigationData

 protected function getAllModuleNavigationData()
 {
     $modules = $moduleNavData = array('primary' => array(), 'secondary' => array());
     $navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
     foreach ($navModules as $moduleID => $moduleData) {
         $type = Kurogo::arrayVal($moduleData, 'type', 'primary');
         if (isset($moduleData['minAPIClientVersion'])) {
             if (version_compare($this->clientVersion, $moduleData['minAPIClientVersion'], 'lt')) {
                 continue;
             }
         }
         if (isset($moduleData['maxAPIClientVersion'])) {
             if (version_compare($this->clientVersion, $moduleData['maxAPIClientVersion'], 'gt')) {
                 continue;
             }
         }
         if (isset($moduleData['pagetype'])) {
             if (!is_array($moduleData['pagetype'])) {
                 $moduleData['pagetype'] = array($moduleData['pagetype']);
             }
             if (!in_array($this->clientPagetype, $moduleData['pagetype'])) {
                 continue;
             }
         }
         if (isset($moduleData['browser'])) {
             if (!is_array($moduleData['browser'])) {
                 $moduleData['browser'] = array($moduleData['browser']);
             }
             if (!in_array($this->clientBrowser, $moduleData['browser'])) {
                 continue;
             }
         }
         if (isset($moduleData['platform'])) {
             if (!is_array($moduleData['platform'])) {
                 $moduleData['platform'] = array($moduleData['platform']);
             }
             if (!in_array($this->clientPlatform, $moduleData['platform'])) {
                 continue;
             }
         }
         $moduleNavData[$type][$moduleID] = $moduleData;
     }
     return $moduleNavData;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:44,代码来源:APIModule.php

示例4: getAllModuleNavigationData

 protected function getAllModuleNavigationData($includeHidden = self::INCLUDE_HIDDEN_MODULES, $iconSetType = 'navigation')
 {
     $modules = $moduleNavData = array('primary' => array(), 'secondary' => array());
     $navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
     foreach ($navModules as $moduleID => $moduleData) {
         $type = Kurogo::arrayVal($moduleData, 'type', 'primary');
         $moduleNavData[$type][$moduleID] = $moduleData;
     }
     if ($iconSet = $this->getOptionalThemeVar($iconSetType . '_icon_set')) {
         $iconSetSize = $this->getOptionalThemeVar($iconSetType . '_icon_size');
         $imgPrefix = "/common/images/iconsets/{$iconSet}/{$iconSetSize}/";
     } else {
         $homeModuleID = $this->getHomeModuleID();
         $imgPrefix = "/modules/{$homeModuleID}/images/";
     }
     //this is fixed for now
     $modulesThatCannotBeHidden = array('customize');
     $allModuleData = array();
     $userNavData = $this->getUserNavData();
     foreach ($moduleNavData as $type => $modulesOfType) {
         foreach ($modulesOfType as $moduleID => $navData) {
             $icon = $moduleID;
             $selected = $this->configModule == $moduleID;
             $primary = $type == 'primary';
             $classes = array();
             if ($selected) {
                 $classes[] = 'selected';
             }
             if (!$primary) {
                 $classes[] = 'utility';
             }
             $hidable = !in_array($moduleID, $modulesThatCannotBeHidden);
             $imgSuffix = $this->pagetype == 'tablet' && $selected ? '' : '';
             $linkTarget = Kurogo::arrayVal($navData, 'linkTarget');
             // customize is implemented as a page on the home module
             if ($moduleID == 'customize') {
                 $visible = true;
                 $icon = $moduleID;
                 $moduleData = array('type' => $type, 'selected' => $selected, 'title' => $this->getLocalizedString('CUSTOMIZE_TITLE'), 'shortTitle' => $this->getLocalizedString('CUSTOMIZE_SHORT_TITLE'), 'url' => "/" . $this->getHomeModuleID() . "/customize", 'hideable' => $hidable, 'visible' => true, 'img' => $imgPrefix . "{$icon}{$imgSuffix}" . $this->imageExt, 'class' => implode(' ', $classes), 'linkTarget' => $linkTarget);
             } else {
                 //this will throw an exception if a module is not available, so watch out
                 $moduleConfig = Kurogo::getModuleConfig('module', $moduleID);
                 $title = Kurogo::arrayVal($navData, 'title', $moduleConfig->getVar('title'));
                 $shortTitle = Kurogo::arrayVal($navData, 'shortTitle', $title);
                 $icon = $moduleConfig->getOptionalVar('icon', $moduleID);
                 $visible = Kurogo::arrayVal($userNavData, $moduleID, Kurogo::arrayVal($navData, 'visible', 1));
                 $moduleData = array('type' => $type, 'selected' => $selected, 'title' => $title, 'shortTitle' => $shortTitle, 'url' => "/{$moduleID}/", 'hideable' => $hidable, 'visible' => $visible, 'img' => $imgPrefix . "{$icon}{$imgSuffix}" . $this->imageExt, 'class' => implode(' ', $classes), 'linkTarget' => $linkTarget);
                 if (Kurogo::getOptionalSiteVar('DYNAMIC_MODULE_NAV_DATA', false)) {
                     $module = WebModule::factory($moduleID, false, array(), false);
                     // do not initialize
                     $moduleData = $module->getModuleNavigationData($moduleData);
                 }
             }
             if ($visible || $includeHidden || $type == 'primary' && isset($userNavData['visible'])) {
                 $modules[$type][$moduleID] = $moduleData;
             }
         }
     }
     if (isset($userNavData['visible'])) {
         $userModuleNavData = array();
         foreach ($userNavData['visible'] as $moduleID => $visible) {
             if (isset($modules['primary'][$moduleID])) {
                 if ($visible || $includeHidden) {
                     $userModuleNavData[$moduleID] = $modules['primary'][$moduleID];
                     $userModuleNavData[$moduleID]['visible'] = $visible;
                 }
             }
         }
         // make sure all primary modules are defined in userNavData
         // this ensures that new modules show up if a user has customized their layout
         $userModules = array_keys($userNavData['visible']);
         $navModules = array_keys($modules['primary']);
         if ($diff = array_diff($navModules, $userModules)) {
             foreach ($diff as $moduleID) {
                 $userModuleNavData[$moduleID] = $modules['primary'][$moduleID];
             }
         }
         $modules['primary'] = $userModuleNavData;
     }
     return $modules;
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:81,代码来源:WebModule.php


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