public static function initialize(&$params)
 {
     if (self::$_initialized) {
         return;
     }
     self::$_initialized = true;
     require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'models' . DS . 'category.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
 }
Example #2
0
 function getCategoryTree(&$xmap, &$parent, &$params, $catid)
 {
     $db =& JFactory::getDBO();
     if (!$catid) {
         // view=categories
         $query = ' SELECT a.id,a.title' . ' ,CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug' . ' FROM #__categories a ' . ' WHERE a.published=1 and a.section=\'com_weblinks\' and  a.access<=' . $xmap->gid . ' ORDER by a.ordering ';
         $db->setQuery($query);
         $cats = $db->loadObjectList();
         $xmap->changeLevel(1);
         foreach ($cats as $cat) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'c' . $cat->id;
             $node->name = $cat->title;
             $node->link = 'index.php?option=com_weblinks&amp;view=category&amp;id=' . $cat->slug;
             $node->priority = $params['cat_priority'];
             $node->changefreq = $params['cat_changefreq'];
             $node->expandible = true;
             if ($xmap->printNode($node) !== FALSE) {
                 xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $cat->id);
             }
         }
         $xmap->changeLevel(-1);
     } elseif ($params['include_links']) {
         //view=category&catid=...
         $query = ' SELECT a.id,a.title' . ' ,CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug' . ' ,CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug' . ' FROM #__weblinks a,#__categories c ' . ' WHERE a.catid = c.id AND c.published=1 and c.access<=' . $xmap->gid . ' AND ' . ' a.published=1 AND a.archived=0 AND a.approved=1' . ($catid ? ' AND a.catid=' . $catid . ' ' : ' ') . ' ORDER by a.ordering ' . $params['limit'];
         $db->setQuery($query);
         $links = $db->loadObjectList();
         $xmap->changeLevel(1);
         foreach ($links as $link) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'i' . $link->id;
             $node->name = $link->title;
             $node->link = 'index.php?option=com_weblinks&amp;view=weblink&amp;id=' . $link->slug . "&amp;catid=" . $link->catslug;
             $node->priority = $params['link_priority'];
             $node->changefreq = $params['link_changefreq'];
             $node->expandible = false;
             $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
     }
 }
 public function __construct()
 {
     self::$enabled = JComponentHelper::isEnabled('com_weblinks');
     JLoader::register('WeblinksHelperRoute', JPATH_SITE . '/components/com_weblinks/helpers/route.php');
 }
Example #4
0
 public static function initialize(&$params)
 {
     if (self::$_initialized) {
         return;
     }
     self::$_initialized = true;
     require_once JPATH_SITE . '/components/com_weblinks/models/category.php';
     require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
 }