/** Return an array with all Items in a Section */ function getContentBlogSection(&$xmap, &$parent, $secid, &$params, &$menuparams) { $database =& JFactory::getDBO(); $order_pri = isset($menuparams['orderby_pri']) ? $menuparams['orderby_pri'] : ''; $order_sec = isset($menuparams['orderby_sec']) && !empty($menuparams['orderby_sec']) ? $menuparams['orderby_sec'] : 'rdate'; $order_pri = xmap_com_content::orderby_pri($order_pri); $order_sec = xmap_com_content::orderby_sec($order_sec); if ($secid == 0) { // Multi section $secid = xmap_com_content::getParam($menuparams, 'sectionid', $secid); } $where = xmap_com_content::where(1, $xmap->access, $xmap->noauth, $xmap->gid, $secid, date('Y-m-d H:i:s', $xmap->now)); $query = "SELECT a.id, a.title, a.modified, a.created,a.sectionid" . ',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' . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . "\n WHERE " . implode("\n AND ", $where) . "\n AND s.access <= " . $xmap->gid . "\n AND cc.access <= " . $xmap->gid . "\n AND s.published = 1" . "\n AND cc.published = 1" . ($xmap->view != 'xmal' ? "\n ORDER BY {$order_pri} {$order_sec}" : ''); $database->setQuery($query); $items = $database->loadObjectList(); $xmap->changeLevel(1); foreach ($items as $item) { $node = new stdclass(); $node->id = $parent->id; $node->uid = $parent->uid . 'a' . $item->id; $node->browserNav = $parent->browserNav; $node->priority = $params['art_priority']; $node->changefreq = $params['art_changefreq']; $node->name = $item->title; $node->expandible = false; if ($item->modified == '0000-00-00 00:00:00') { $item->modified = $item->created; } $node->modified = xmap_com_content::toTimestamp($item->modified); $node->link = ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid); # $node->link = 'index.php?option=com_content&task=view&id='.$item->slug; $xmap->printNode($node); } $xmap->changeLevel(-1); return true; }
/** Return an array with all Items in a Section */ function getContentBlogSection(&$xmap, &$parent, $secid, &$params, &$menuparams) { $db =& JFactory::getDBO(); if ($params['articles_order'] == 'menu') { $order_sec = $menuparams->get('orderby_sec', 'rdate'); } else { $order_sec = $params['articles_order']; } $order_pri = $menuparams->get('orderby_pri'); $order_pri = xmap_com_content::orderby_pri($order_pri); $order_sec = xmap_com_content::orderby_sec($order_sec); $now = date('Y-m-d H:i:s', $xmap->now); $query = "SELECT a.id, a.title,a.access,a.metakey, UNIX_TIMESTAMP(a.modified) AS modified, UNIX_TIMESTAMP(a.created) AS created,a.sectionid" . ',CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug' . ',CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug' . ',cc.title as category' . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . "\n WHERE a.sectionid = '" . $secid . "'" . "\n AND s.access <= " . $xmap->gid . "\n AND cc.access <= " . $xmap->gid . "\n AND a.state = '1'" . "\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '{$now}' )" . "\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '{$now}' )" . ($params['show_unauth'] ? '' : "\n AND a.access <= " . $xmap->gid) . ($params['max_art_age'] ? "\n AND ( a.created >= '" . date('Y-m-d H:i:s', time() - $params['max_art_age'] * 86400) . "' ) " : '') . "\n AND s.published = 1" . "\n AND cc.published = 1" . ($xmap->view != 'xmal' ? "\n ORDER BY {$order_pri} {$order_sec}" : ''); return xmap_com_content::showArticles($xmap, $parent, $params, $query); }