- Error
-
- Model class contentModelCategory not found in file.
function _buildQuery($state = 1)
{
global $mainframe;
$params = &$mainframe->getParams();
$voting = ContentHelperQuery::buildVotingQuery($params);
$where = $this->_buildContentWhere($state);
$orderby = $this->_buildContentOrderBy($state);
$query = 'SELECT cc.title AS category, a.id, a.title, a.alias, a.title_alias, a.introtext, a.fulltext, 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,' .
' 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, u.email as author_email' . $voting['select'] .
' FROM #__content AS a' .
' LEFT JOIN #__categories AS cc ON a.catid = cc.id' .
' LEFT JOIN #__users AS u ON u.id = a.created_by' .
' LEFT JOIN #__groups AS g ON a.access = g.id' .
$voting['join'] .
$where .
$orderby;
return $query;
}
function _buildContentOrderBy($state = 1)
{
global $mainframe;
$params = &$mainframe->getParams();
$itemid = JRequest::getInt('id', 0) . ':' . JRequest::getInt('Itemid', 0);
$filter_order = $mainframe->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
if (!in_array($filter_order, array('a.title', 'author', 'a.hits', 'a.created', 'a.publish_up', 'a.publish_down', 'a.modified'))) {
$filter_order = '';
}
if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) {
$filter_order_Dir = 'ASC';
}
$orderby = ' ORDER BY ';
if ($filter_order && $filter_order_Dir) {
$orderby .= $filter_order .' '. $filter_order_Dir.', ';
}
if ($filter_order == 'author') {
$orderby .= 'created_by_alias '. $filter_order_Dir.', ';
}
switch ($state) {
case -1:
$orderby_sec = $params->def('orderby', 'rdate');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec).', ';
$primary = '';
break;
case 1:
default:
$orderby_sec = $params->def('orderby_sec', 'rdate');
$orderby_sec = ($orderby_sec == 'front') ? '' : $orderby_sec;
$orderby_pri = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($orderby_sec).', ';
$primary = ContentHelperQuery::orderbyPrimary($orderby_pri);
break;
}
$orderby .= $primary .' '. $secondary .' a.created DESC';
return $orderby;
}
function _buildContentWhere($state = 1)
{
global $mainframe;
$user =& JFactory::getUser();
$gid = $user->get('aid', 0);
$jnow =& JFactory::getDate();
$now = $jnow->toMySQL();
$params = &$mainframe->getParams();
$noauth = !$params->get('show_noauth');
$nullDate = $this->_db->getNullDate();
$where = ' WHERE 1';
if ($noauth) {
$where .= ' AND a.access <= '.(int) $gid;
}
if ($this->_id) {
$where .= ' AND a.catid = '.(int) $this->_id;
}
switch ($state) {
case 1:
if ($user->authorize('com_content', 'edit', 'content', 'all')) {
$where .= ' AND a.state >= 0';
} else {
$where .= ' AND a.state = 1' .
' AND ( publish_up = '.$this->_db->Quote($nullDate).' OR publish_up <= '.$this->_db->Quote($now).' )' .
' AND ( publish_down = '.$this->_db->Quote($nullDate).' OR publish_down >= '.$this->_db->Quote($now).' )';
}
break;
case -1:
$year = JRequest::getInt('year', date('Y'));
$month = JRequest::getInt('month', date('m'));
$where .= ' AND a.state = -1';
$where .= ' AND YEAR(a.created) = '.(int) $year;
$where .= ' AND MONTH(a.created) = '.(int) $month;
break;
default:
$where .= ' AND a.state = '.(int) $state;
break;
}
if ($params->get('filter')) {
$filter = JRequest::getString('filter', '', 'request');
if ($filter) {
$filter = JString::strtolower($filter);
$hitsFilter = intval($filter);
$filter = $this->_db->Quote('%'.$this->_db->getEscaped($filter, true).'%', false);
switch ($params->get('filter_type')) {
case 'author':
$where .= ' AND ( ( LOWER(u.name) LIKE '.$filter.' ) OR ( LOWER(a.created_by_alias) LIKE '.$filter.' ) )';
break;
case 'hits':
$where .= ' AND a.hits >= '.$hitsFilter.' ';
break;
case 'title':
default:
$where .= ' AND LOWER(a.title) LIKE '.$filter;
break;
}
}
}
return $where;
}