Esempio n. 1
0
 function getCategories()
 {
     static $cachedCategories;
     if ($cachedCategories != null) {
         return $cachedCategories;
     }
     list($major, $minor, $version) = explode('.', JVERSION);
     if ($major == 1 && $minor == 5) {
         $db =& JFactory::getDBO();
         $sql = 'SELECT id, cat_name FROM `#__aard_cats`';
         $db->setQuery($sql);
         $categories = $db->loadObjectList();
         for ($i = 0; $i < count($categories); $i++) {
             $cachedCategories[$i] = new JWFCategoryHandler();
             $cachedCategories[$i]->setId($categories[$i]->id);
             $cachedCategories[$i]->setTitle($categories[$i]->cat_name);
             $cachedCategories[$i]->setChildren(array());
         }
         $uncategorizedCategory = new JWFCategoryHandler();
         $uncategorizedCategory->setId(0);
         $uncategorizedCategory->setTitle(JText::_('uncategorized'));
         $uncategorizedCategory->setChildren(array());
         $cachedCategories[] = $uncategorizedCategory;
         $cachedCategories = array_reverse($cachedCategories);
     }
     if ($major == 1 && $minor == 6) {
         $db =& JFactory::getDBO();
         $sql = 'SELECT id, parent_id, title FROM #__categories WHERE extension = "com_content"';
         $db->setQuery($sql);
         $categories = $db->loadObjectList();
         $categories = $this->_arrangeCategories(array_reverse($categories), 1);
         $cachedCategories = $categories;
     }
     return $cachedCategories;
 }
Esempio n. 2
0
 function getCategories()
 {
     static $cachedCategories;
     if ($cachedCategories != null) {
         return $cachedCategories;
     }
     list($major, $minor, $version) = explode('.', JVERSION);
     if ($major == 1 && $minor == 5) {
         $db =& JFactory::getDBO();
         $sql = 'SELECT id, title FROM `#__categories` WHERE `section` = "com_contact_details"';
         $db->setQuery($sql);
         $categories = $db->loadObjectList();
         for ($i = 0; $i < count($categories); $i++) {
             $cachedCategories[$i] = new JWFCategoryHandler();
             $cachedCategories[$i]->setId($categories[$i]->id);
             $cachedCategories[$i]->setTitle($categories[$i]->title);
             $cachedCategories[$i]->setChildren(array());
         }
         $uncategorizedCategory = new JWFCategoryHandler();
         $uncategorizedCategory->setId(0);
         $uncategorizedCategory->setTitle('uncategorized');
         $uncategorizedCategory->setChildren(array());
         $cachedCategories[] = $uncategorizedCategory;
         $cachedCategories = array_reverse($cachedCategories);
     }
     if ($major == 1 && $minor == 6) {
         return array();
     }
 }