function getJDownloadsTree(&$xmap, &$parent, &$params, &$catid)
 {
     $db = JFactory::getDBO();
     $db->setQuery("select cat_id, cat_title, parent_id from #__jdownloads_cats where parent_id={$catid} and published = '1' order by cat_title");
     $cats = $db->loadObjectList();
     $xmap->changeLevel(1);
     foreach ($cats as $cat) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->uid = $parent->uid . 'c' . $cat->cat_id;
         // Uniq ID for the category
         $node->pid = $cat->parent_id;
         $node->name = $cat->cat_title ? $cat->cat_title : $cat->cat_title;
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->link = 'index.php?option=com_jdownloads&task=viewcategory&catid=' . $cat->cat_id;
         $node->expandible = true;
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_jdownloads::getJDownloadsTree($xmap, $parent, $params, $cat->cat_id);
         }
     }
     if ($params['include_files']) {
         $db->setQuery("select file_id, file_title, cat_id from #__jdownloads_files where cat_id IN ({$catid}) and published = '1' order by file_title");
         $cats = $db->loadObjectList();
         foreach ($cats as $file) {
             $node = new stdclass();
             $node->id = $parent->id;
             // Itemid
             $node->uid = $parent->uid . 'd' . $file->file_id;
             // Uniq ID for the download
             $node->name = $file->file_title ? $file->file_title : $file->file_title;
             $node->link = 'index.php?option=com_jdownloads&task=view.download&cid=' . $file->file_id;
             $node->priority = $params['file_priority'];
             $node->changefreq = $params['file_changefreq'];
             $node->expandible = false;
             $xmap->printNode($node);
         }
     }
     $xmap->changeLevel(-1);
 }
 public function __construct()
 {
     self::$enabled = JComponentHelper::isEnabled('com_jdownloads');
 }