예제 #1
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $aparams = $mainframe->getPageParameters('com_fss');
     $this->template = $aparams->get('template');
     if ($this->template == "") {
         $this->template = "grid";
     }
     $this->show_desc = $aparams->get('show_desc');
     $this->mainwidth = $aparams->get('mainwidth');
     $this->maincolums = $aparams->get('maincolums');
     if ($this->maincolums == 0 || $this->maincolums == "") {
         $this->maincolums = 3;
     }
     $this->hideicons = $aparams->get('hideicons');
     $this->imagewidth = $aparams->get('imagewidth');
     if ($this->imagewidth == 0 || $this->imagewidth == "") {
         $this->imagewidth = 128;
     }
     $this->imageheight = $aparams->get('imageheight');
     if ($this->imageheight == 0 || $this->imageheight == "") {
         $this->imageheight = 128;
     }
     $this->border = $aparams->get('border');
     $this->info_top = $aparams->get('info_top');
     $this->info_well = $aparams->get('info_well');
     if ($this->info_top === null) {
         $this->info_top = 1;
     }
     if ($this->info_well === null) {
         $this->info_well = 1;
     }
     $db = JFactory::getDBO();
     $query = 'SELECT * FROM #__menu';
     $db->setQuery($query);
     $this->joomlamenus = $db->loadAssocList('id');
     // work out permissions, and if to show admin or not
     $showadmin = false;
     $showgroups = false;
     if (FSS_Permission::AnyAdmin()) {
         $showadmin = true;
     }
     if (FSS_Permission::AdminGroups()) {
         $showgroups = true;
     }
     $this->showadmin = $showadmin;
     if ($showadmin) {
         $this->getSupportOverView();
     }
     $query = 'SELECT * FROM #__fss_main_menu ';
     $where = array();
     if (!$showadmin) {
         $where[] = 'itemtype != 9';
     }
     if (!$showgroups) {
         $where[] = 'itemtype != 10';
     }
     // add language and access to query where
     $where[] = 'language in (' . $db->Quote(JFactory::getLanguage()->getTag()) . ',' . $db->Quote('*') . ')';
     $user = JFactory::getUser();
     $where[] = 'access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')';
     $where[] = "published = 1";
     if (count($where) > 0) {
         $query .= " WHERE " . implode(" AND ", $where);
     }
     $query .= " ORDER BY ordering";
     $db->setQuery($query);
     $this->menus = $db->loadAssocList('id');
     FSS_Translate_Helper::Tr($this->menus);
     $this->ValidateMenuLinks();
     parent::display();
 }