示例#1
0
 function mygosu_menu_items($database, $mygid, &$params, $parentID, $level, $cssRepeatNum)
 {
     /**
     /* Function Desc- loads mygosu menu items (calls recursively)
     */
     if (!$parentID) {
         $parentID = 0;
     }
     // necessary for root sections
     if (!$level) {
         $level = 0;
     }
     // necessary for root sections
     $query = "SELECT * FROM #__menu " . "\n WHERE menutype = '" . $params->get('menu') . "' " . "\n AND access <= {$mygid} " . "\n AND published = '1' " . "\n AND parent = '{$parentID}'" . "\n ORDER BY '" . $params->get('order') . "' ASC ";
     $cssNumMenus = $params->get('css_num_menus');
     // max number of css repeat val
     if ($cssRepeatNum == 0 || $cssRepeatNum > $cssNumMenus) {
         $cssRepeatNum = 1;
     }
     $database->setQuery($query);
     $menus = $database->loadObjectList();
     $numRows = 0;
     foreach ($menus as $row) {
         // MambelFish Support - Converts menu items if necessary
         $numRows++;
         if (isset($GLOBALS['mosConfig_mbf_content']) && $GLOBALS['$mosConfig_mbf_content']) {
             // FIX by Eric Benzacar 2005/07/05 ~ bug reported by Kevin McNally 2005/06/30
             $row = MambelFish::translate($row, 'menu', $GLOBALS['$mosConfig_lang']);
         }
         $name = htmlentities($row->name, ENT_QUOTES);
         // remove ilegal characters
         $link = $row->link ? $row->link : NULL;
         $currentID = $row->id;
         /**
         /* Does this menu item have sub menu items?
         */
         $subMenus = mygosu_menus::checkSubMenus($currentID, $mygid, $params, $database);
         /**
          * Adds Itemid if link is not a url
          */
         if ($row->type != 'url') {
             $link .= '&Itemid=' . $row->id;
         }
         /**
          * Controls the page the link will be opened in
          */
         if ($row->browserNav) {
             $target = "'_blank'";
         } else {
             $target = "'_self'";
         }
         if ($numRows == 1) {
             //open menu
             $this->menuObject->StartMenu($level);
         }
         // create new menu item
         $this->menuObject->NewItem($level, $params, $row, $subMenus, $name, $cssRepeatNum, $target, $link);
         // recurrsive call
         $this->mygosu_menu_items($database, $mygid, &$params, $currentID, $level + 2, $cssRepeatNum + 1);
         // close menu item
         $this->menuObject->CloseItem($level);
         // close list after recurrsive call to get subsections
     }
     if ($numRows > 0) {
         // close section of menu
         $this->menuObject->CloseMenuSection($level);
     }
 }