public function __construct()
 {
     self::$enabled = JComponentHelper::isEnabled('com_adsmanager');
 }
Example #2
0
 function getCategoryTree(&$xmap, &$parent, $catid, &$params)
 {
     $database = JFactory::getDBO();
     $database->setQuery(" SELECT * FROM #__adsmanager_categories " . " WHERE parent='{$catid}' and published = 1");
     $cats = $database->loadObjectList();
     $xmap->changeLevel(1);
     if (count($cats)) {
         foreach ($cats as $cat) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'c' . $cat->id;
             $node->browserNav = $parent->browserNav;
             $node->name = stripslashes(JText::_($cat->name));
             $node->priority = $params['cat_priority'];
             $node->changefreq = $params['cat_changefreq'];
             $node->link = 'index.php?option=com_adsmanager&view=list&catid=' . $cat->id . '&Itemid=' . $parent->id;
             $node->pid = $cat->id;
             $node->expandible = true;
             $pid = $cat->id;
             if ($xmap->printNode($node) !== FALSE) {
                 if ($params['include_entries']) {
                     $database->setQuery(" SELECT a.id,a.name,a.ad_headline FROM #__adsmanager_ads AS a " . " INNER JOIN #__adsmanager_adcat as adcat ON a.id = adcat.adid " . " WHERE a.published = 1 AND adcat.catid = '{$cat->id}' ORDER BY a.id DESC " . $params['limit']);
                     $ads = $database->loadObjectList();
                     $xmap->changeLevel(1);
                     if (count($ads)) {
                         foreach ($ads as $ad) {
                             $node = new stdclass();
                             $node->id = $parent->id;
                             $node->uid = $parent->uid . 'c' . $ad->id;
                             $node->browserNav = $parent->browserNav;
                             $node->name = stripslashes($ad->ad_headline);
                             $node->priority = $params['entry_priority'];
                             $node->changefreq = $params['entry_changefreq'];
                             $node->link = 'index.php?option=com_adsmanager&view=details&id=' . $ad->id . '&catid=' . $cat->id . '&Itemid=' . $parent->id;
                             $node->pid = $ad->id;
                             $node->expandible = false;
                             $xmap->printNode($node);
                         }
                     }
                     $xmap->changeLevel(-1);
                 }
                 // see children category recursiv...
                 xmap_com_adsmanager::getCategoryTree($xmap, $parent, $cat->id, $params);
             }
         }
     }
     $xmap->changeLevel(-1);
     return true;
 }