private static function getCategoryTree(XmapDisplayer &$xmap, stdClass &$parent, array &$params, $parent_id) { $db = JFactory::getDbo(); $query = $db->getQuery(true)->select(array('c.id', 'c.alias', 'c.title', 'c.parent_id'))->from('#__categories AS c')->where('c.parent_id = ' . $db->quote($parent_id ? $parent_id : 1))->where('c.extension = ' . $db->quote('com_garyscookbook'))->where('c.published = 1')->order('c.lft'); if (!$params['show_unauth']) { $query->where('c.access IN(' . $params['groups'] . ')'); } if ($params['language_filter']) { $query->where('c.language IN(' . $db->quote(JFactory::getLanguage()->getTag()) . ', ' . $db->quote('*') . ')'); } $db->setQuery($query); $rows = $db->loadObjectList(); if (empty($rows)) { return; } $xmap->changeLevel(1); foreach ($rows as $row) { $node = new stdclass(); $node->id = $parent->id; $node->name = $row->title; $node->uid = $parent->uid . '_cid_' . $row->id; $node->browserNav = $parent->browserNav; $node->priority = $params['category_priority']; $node->changefreq = $params['category_changefreq']; $node->pid = $row->parent_id; $node->link = GaryscookbookHelperRoute::getCategoryRoute($row->id); if ($xmap->printNode($node) !== false) { self::getRecipes($xmap, $parent, $params, $row->id); } } $xmap->changeLevel(-1); }
function __construct($config, $sitemap) { $this->view = 'html'; parent::__construct($config, $sitemap); $this->_parent_children = array(); $this->_last_child = array(); $this->live_site = substr_replace(JURI::root(), "", -1, 1); $user = JFactory::getUser(); }
function __construct($config, $sitemap) { parent::__construct($config, $sitemap); $this->uids = array(); $this->defaultLanguage = strtolower(JFactory::getLanguage()->getTag()); if (preg_match('/^([a-z]+)-.*/', $this->defaultLanguage, $matches) && !in_array($this->defaultLanguage, array(' zh-cn', ' zh-tw'))) { $this->defaultLanguage = $matches[1]; } $this->showTitle = JRequest::getBool('filter_showtitle', 0); }
function setJView($view) { parent::setJView($view); $columns = $this->sitemap->params->get('columns', 0); if ($columns > 1) { // calculate column widths $total = count($view->items); $columns = $total < $columns ? $total : $columns; $this->_width = 100 / $columns - 1; $this->sitemap->params->set('columns', $columns); } }
function toggleItem($uid, $itemid) { $app = JFactory::getApplication('site'); $sitemap = $this->getItem(); $displayer = new XmapDisplayer($app->getParams(), $sitemap); $excludedItems = $displayer->getExcludedItems(); if (isset($excludedItems[$itemid])) { $excludedItems[$itemid] = (array) $excludedItems[$itemid]; } if (!$displayer->isExcluded($itemid, $uid)) { $excludedItems[$itemid][] = $uid; $state = 0; } else { if (is_array($excludedItems[$itemid]) && count($excludedItems[$itemid])) { $excludedItems[$itemid] = array_filter($excludedItems[$itemid], create_function('$var', 'return ($var != \'' . $uid . '\');')); } else { unset($excludedItems[$itemid]); } $state = 1; } $registry = new JRegistry('_default'); $registry->loadArray($excludedItems); $str = $registry->toString(); $db =& JFactory::getDBO(); $query = "UPDATE #__xmap_sitemap set excluded_items='" . $db->escape($str) . "' where id=" . $sitemap->id; $db->setQuery($query); $db->query(); return $state; }
function __construct(&$config, &$sitemap) { $this->_list = array(); $this->view = 'navigator'; parent::__construct($config, $sitemap); }
/** * @param XmapDisplayer $xmap * @param $parent * @param $params * @param $subnodes */ protected static function printNodes(XmapDisplayer $xmap, $parent, &$params, &$subnodes) { $xmap->changeLevel(1); $i = 0; foreach ($subnodes as $subnode) { $i++; $subnode->id = $parent->id; $subnode->uid = $parent->uid . 'p' . $i; $subnode->browserNav = $parent->browserNav; $subnode->priority = $params['art_priority']; $subnode->changefreq = $params['art_changefreq']; $subnode->secure = $parent->secure; $xmap->printNode($subnode); } $xmap->changeLevel(-1); }
function __construct($config, $sitemap) { parent::__construct($config, $sitemap); $this->uids = array(); }