function getMtreeCategory (&$xmap, &$parent, &$params, &$catid ) { $database =& JFactory::getDBO(); $query = "SELECT cat_name, cat_id, UNIX_TIMESTAMP(cat_created) as `created` ". "FROM #__mt_cats WHERE cat_published='1' AND cat_approved='1' AND cat_parent = $catid " . "ORDER BY `" . $params['cats_order'] ."`"; $database->setQuery($query); $rows = $database->loadObjectList(); $xmap->changeLevel(1); foreach($rows as $row) { if( !$row->created ) { $row->created = $xmap->now; } $node = new stdclass; $node->name = $row->cat_name; $node->link = 'index.php?option=com_mtree&task=listcats&cat_id='.$row->cat_id; $node->id = $parent->id; $node->uid = $parent->uid .'c'.$row->cat_id; $node->browserNav = $parent->browserNav; $node->modified = $row->created; $node->priority = $params['cat_priority']; $node->changefreq = $params['cat_changefreq']; $node->expandible = true; if ( $xmap->printNode($node) !== FALSE) { xmap_com_mtree::getMtreeCategory($xmap,$parent,$params,$row->cat_id); } } /* Returns URLs of all listings in the current category */ if ($params['include_links']) { $query = " SELECT a.link_name, a.link_id, UNIX_TIMESTAMP(a.link_created) as `created`, UNIX_TIMESTAMP(a.link_modified) as `modified` \n". " FROM #__mt_links AS a, #__mt_cl as b \n". " WHERE a.link_id = b.link_id \n". " AND b.cat_id = $catid " . " AND ( link_published='1' AND link_approved='1' ) " . $params['days'] . " ORDER BY `" . $params['links_order'] ."` " . $params['limit']; $database->setQuery($query); $rows = $database->loadObjectList(); foreach($rows as $row) { if( !$row->modified ) { $row->modified = $row->created; } $node = new stdclass; $node->name = $row->link_name; $node->link = 'index.php?option=com_mtree&task=viewlink&link_id='.$row->link_id; $node->id = $parent->id; $node->uid = $parent->uid.'l'.$row->link_id; $node->browserNav = $parent->browserNav; $node->modified = ($row->modified? $row->modified : $row->created); $node->priority = $params['link_priority']; $node->changefreq = $params['link_changefreq']; $node->expandible = false; $xmap->printNode($node); } } $xmap->changeLevel(-1); }
static function getMtreeCategory($xmap, $parent, &$params, $catid) { $database =& JFactory::getDbo(); $query = "SELECT cat_name, cat_id " . "FROM #__mt_cats WHERE cat_published='1' AND cat_approved='1' AND cat_parent = {$catid} " . "ORDER BY " . $params['cats_order']; $database->setQuery($query); $rows = $database->loadObjectList(); $xmap->changeLevel(1); foreach ($rows as $row) { $node = new stdclass(); $node->name = $row->cat_name; $node->link = 'index.php?option=com_mtree&task=listcats&cat_id=' . $row->cat_id . '&Itemid=' . $parent->id; $node->id = $parent->id; $node->uid = $parent->uid . 'c' . $row->cat_id; $node->browserNav = $parent->browserNav; $node->modified = NULL; $node->priority = $params['cat_priority']; $node->changefreq = $params['cat_changefreq']; $node->expandible = true; $node->secure = $parent->secure; if ($xmap->printNode($node) !== FALSE) { xmap_com_mtree::getMtreeCategory($xmap, $parent, $params, $row->cat_id); } } /* Returns URLs of all listings in the current category */ if ($params['include_links']) { $query = " SELECT a.link_name, a.link_id, a.link_created as created, a.link_modified as modified \n" . " FROM #__mt_links AS a, #__mt_cl as b \n" . " WHERE a.link_id = b.link_id \n" . " AND b.cat_id = {$catid} " . " AND ( link_published='1' AND link_approved='1' ) " . $params['days'] . " ORDER BY " . $params['links_order'] . $params['limit']; $database->setQuery($query); $rows = $database->loadObjectList(); foreach ($rows as $row) { if (!$row->modified || $row->modified == $database->getNullDate()) { $row->modified = $row->created; } $node = new stdclass(); $node->name = $row->link_name; $node->link = 'index.php?option=com_mtree&task=viewlink&link_id=' . $row->link_id . '&Itemid=' . $parent->id; $node->id = $parent->id; $node->uid = $parent->uid . 'l' . $row->link_id; $node->browserNav = $parent->browserNav; $node->modified = $row->modified; $node->priority = $params['link_priority']; $node->changefreq = $params['link_changefreq']; $node->expandible = false; $node->secure = $parent->secure; $xmap->printNode($node); } } $xmap->changeLevel(-1); }