Beispiel #1
0
 function _buildQuery()
 {
     global $mainframe;
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     // If voting is turned on, get voting data as well for the content items
     $voting = ContentHelperQuery::buildVotingQuery($params);
     // Get the WHERE and ORDER BY clauses for the query $where		= $this->_buildContentWhere();
     $orderby = $this->_buildContentOrderBy();
     // Custom Properties join
     $helper = new comZonalesHelper();
     $cpjoin = $helper->_buildCustomPropertiesJoin();
     $query = 'SELECT a.id, a.title, a.alias, a.title_alias, a.introtext, a.sectionid, a.state, a.catid, a.created, a.created_by, a.created_by_alias, a.modified, a.modified_by,' . ' a.checked_out, a.checked_out_time, a.publish_up, a.publish_down, a.attribs, a.hits, a.images, a.urls, a.ordering, a.metakey, a.metadesc, a.access, cc.title AS category, s.title AS section,' . ' 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,' . ' CHAR_LENGTH( a.`fulltext` ) AS readmore, u.name AS author, u.usertype, g.name AS groups' . $voting['select'] . ' FROM #__content AS a' . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' LEFT JOIN #__sections AS s ON s.id = a.sectionid' . ' LEFT JOIN #__users AS u ON u.id = a.created_by' . ' LEFT JOIN #__groups AS g ON a.access = g.id' . $cpjoin . $voting['join'] . $where . ' GROUP BY a.id' . $orderby;
     return $query;
 }