コード例 #1
0
ファイル: view.php プロジェクト: mined-gatech/hubzero-cms
 /**
  * Output menu
  * 
  * @param  [type] $pageArray [description]
  * @return [type]            [description]
  */
 public static function buildRecursivePageMenu($group, $pageArray)
 {
     // get overview section access
     $access = \Hubzero\User\Group\Helper::getPluginAccess($group, 'overview');
     $out = '';
     if (sizeof($pageArray) > 0) {
         $out = '<ul>';
         foreach ($pageArray as $key => $page) {
             // dont show page links if there isnt an approved version
             if ($page->approvedVersion() === null) {
                 continue;
             }
             // page access settings
             $pageAccess = $page->get('privacy') == 'default' ? $access : $page->get('privacy');
             // is this the active page?
             $cls = Pages::isPageActive($page) ? 'active' : '';
             //page menu item
             if ($pageAccess == 'registered' && User::isGuest() || $pageAccess == 'members' && !in_array(User::get("id"), $group->get('members'))) {
                 $out .= "<li class=\"protected\"><span class=\"page\">" . $page->get('title') . "</span></li>";
             } else {
                 $out .= '<li class="' . $cls . '">';
                 $out .= '<a class="page" title="' . $page->get('title') . '" href="' . $page->url() . '">' . $page->get('title') . '</a>';
             }
             // do we have child menu items
             if (!is_array($page->get('children'))) {
                 $out .= '</li>';
             } else {
                 $out .= self::buildRecursivePageMenu($group, $page->get('children')) . '</li>';
             }
         }
         $out .= '</ul>';
     }
     return $out;
 }