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


PHP ThemeHelper::getAll方法代码示例

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


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

示例1: view

 public function view()
 {
     $c = Page::getCurrentPage();
     parent::view();
     $this->set('im', Loader::helper('image'));
     $this->set('u', new User());
     $this->set('rssUrl', $showRss ? $controller->getRssUrl($b) : '');
     $this->set('show', $_REQUEST['show']);
     /* Set the page lists which are walk related, as they have json we need */
     switch ($this->block->getBlockFilename()) {
         case 'walkcards':
             $this->set('cards', $this->loadCards());
             break;
         case 'walk_filters':
             Loader::helper('theme');
             $cards = $this->loadCards();
             // Build a separate walk card for each date
             $walksByDate = [];
             foreach ($cards as $walk) {
                 foreach ((array) $walk->time['slots'] as $slot) {
                     $dateWalk = clone $walk;
                     $dateWalk->time['slots'] = [$slot];
                     $walksByDate[] = $dateWalk;
                 }
             }
             usort($walksByDate, function ($a, $b) {
                 $ta = $a->time['slots'][0][0];
                 $tb = $b->time['slots'][0][0];
                 return $ta < $tb ? -1 : 1;
             });
             $this->set('cards', $walksByDate);
             break;
     }
     // Set walk-filter specific filtering data
     if ($this->block->getBlockFilename() === 'walk_filters') {
         // Set up walk filters
         // Wards
         $wards = array();
         $wardObjects = $c->getAttribute('city_wards');
         if ($wardObjects !== false) {
             foreach ($wardObjects->getOptions() as $ward) {
                 $val = $ward->value;
                 $wards[] = $val;
             }
         }
         natcasesort($wards);
         // Themes
         $themes = ThemeHelper::getAll('themes');
         asort($themes);
         // Accessibility
         $accessibilities = ThemeHelper::getAll('accessibilities');
         asort($accessibilities);
         // Initiatives
         $initiatives = [];
         if (strpos($c->getCollectionPath(), 'burlington') !== false) {
             $initAttr = $c->getAttribute('walk_initiatives');
             if ($initAttr) {
                 foreach ($c->getAttribute('walk_initiatives') as $initiative) {
                     $initiatives[$initiative->ID] = $initiative->value;
                 }
                 unset($initiative);
             }
         }
         // Ward semantics
         $wardName = 'Region';
         if ($c->getCollectionName() === 'Toronto') {
             $wardName = 'Ward';
         }
         /* Set variables needed for rendering show all walks */
         $this->set('wardName', $wardName);
         $this->set('initiatives', $initiatives);
         $this->set('accessibilities', $accessibilities);
         $this->set('themes', $themes);
         $this->set('wards', $wards);
     }
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:76,代码来源:controller.php


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