當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。