get('aid', 0); if (empty($this->_category)) { global $mainframe; $user = &JFactory::getUser(); $aid = $user->get('aid', 0); $query = $this->_getCategoryListQuery( $sectionId, $aid, $params ); $this->_category= $this->_getList( $query ); } return $this->_category; } function _getCategoryListQuery( $sectionId, $aid, $params ) { // Filter Sections / Categories ? $paramsC = JComponentHelper::getParams('com_sql2excel'); $section_ids_where = $paramsC->get( 'display_sections', '' ); $section_ids_not_where = $paramsC->get( 'hide_sections', '' ); $category_ids_where = $paramsC->get( 'display_categories', '' ); $category_ids_not_where = $paramsC->get( 'hide_categories', '' ); $orderBy = $this->_getCategoryOrdering(); $wheres[] = " a.section= ".(int)$sectionId; $query = Sql2excelQuery::getBaseQuery( "e.id, e.title ,e.alias, e.ordering, COUNT(distinct a.id) as numdoc", $wheres, 'GROUP BY e.id', $orderBy, $section_ids_where, $section_ids_not_where, $category_ids_where, $category_ids_not_where); return $query; } function getSection($sectionId, $params) { $user =& JFactory::getUser(); $aid = $user->get('aid', 0); //$wheres[] = " cc.published = 1 "; if (empty($this->_category)) { global $mainframe; $user = &JFactory::getUser(); $aid = $user->get('aid', 0); $query = $this->_getSectionQuery( $sectionId, $aid, $params ); $this->_section= $this->_getList( $query, 0, 1 ); } return $this->_section; } function _getSectionQuery( $sectionId, $aid, $params ) { $wheres[] = " s.id= ".(int)$sectionId; if ($aid !== null) { $wheres[] = "s.access <= " . (int) $aid; } $wheres[] = " s.published = 1"; $query = " SELECT s.id, s.title, s.description, s.alias" . " FROM #__sql2excel_sections AS s" . " WHERE " . implode( " AND ", $wheres ) . " ORDER BY s.ordering"; return $query; } function getMostViewedDocsList($sectionId, $params) { $user =& JFactory::getUser(); $aid = $user->get('aid', 0); if (empty($this->_most_viewed_docs)) { global $mainframe; $user = &JFactory::getUser(); $aid = $user->get('aid', 0); $query = $this->_getMostViewedDocsListQuery( $sectionId, $aid, $params ); $this->_most_viewed_docs = $this->_getList( $query ); } return $this->_most_viewed_docs; } function _getCategoryOrdering() { if (empty($this->_category_ordering)) { $params = Sql2excelParms::getParms(); $ordering = Sql2excelParms::get($params,'category_ordering', 1); $this->_category_ordering = Sql2excelQuery::getOrderingText($ordering); } return $this->_category_ordering; } } ?>