_buttons)) { $this->_buttons = array( array( 'link' => JRoute::_('index.php?option=com_mc&view=staffs'), 'image' => 'icon-stack', 'text' => JText::_('View Staffs'), 'access' => array('core.manage', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=opinions'), 'image' => 'icon-folder-close', 'text' => JText::_('View opinions'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=events'), 'image' => 'icon-folder-close', 'text' => JText::_('View events'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=announcements'), 'image' => 'icon-folder-close', 'text' => JText::_('View announcements'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=discussions'), 'image' => 'icon-folder-close', 'text' => JText::_('View discussions'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=policybriefs'), 'image' => 'icon-folder-close', 'text' => JText::_('View policy briefs'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=audios'), 'image' => 'icon-folder-close', 'text' => JText::_('View audios'), 'access' => array('core.admin', 'com_mc') ), array( 'link' => JRoute::_('index.php?option=com_mc&view=videos'), 'image' => 'icon-folder-close', 'text' => JText::_('View videos'), 'access' => array('core.admin', 'com_mc') ), ); } return $this->_buttons; } public function getBooks() { $_books = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abbook'); $query->where('state = 1'); $db->setQuery($query); $db->execute(); $_books['published'] = $db->getNumRows(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abbook'); $query->where('state = 0'); $db->setQuery($query); $db->execute(); $_books['unpublished'] = $db->getNumRows(); $_books['total'] = array_sum($_books); return $_books; } function getCategories() { $_categories = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abcategories'); $query->where('published = 1 AND extension="com_mc"'); $db->setQuery($query); $db->execute(); $_categories['published'] = $db->getNumRows(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abcategories'); $query->where('published = 0 AND extension="com_mc"'); $db->setQuery($query); $db->execute(); $_categories['unpublished'] = $db->getNumRows(); $_categories['total'] = array_sum($_categories); return $_categories; } function getAuthors() { $_authors = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abauthor'); $db->setQuery($query); $db->execute(); $_authors['total'] = $db->getNumRows(); return $_authors; } function getEditors() { $_editors = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__abeditor'); $db->setQuery($query); $db->execute(); $_editors['total'] = $db->getNumRows(); return $_editors; } function getLibraries() { $_libraries = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__ablibrary'); $db->setQuery($query); $db->execute(); $_libraries['total'] = $db->getNumRows(); return $_libraries; } function getLocations() { $_locations = array(); $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('id'); $query->from('#__ablocations'); $db->setQuery($query); $db->execute(); $_locations['total'] = $db->getNumRows(); return $_locations; } function getMostrated() { // Lets load the data if it doesn't already exist if (empty( $this->_mostrated )) { $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('a.title, a.id, ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count'); $query->from("#__abbook AS a"); $query->innerjoin('#__abrating AS v ON a.id = v.book_id'); $query->group('a.id'); $query->order('v.rating_count DESC'); $this->_mostrated = $this->_getList( $query, 0, 10 ); } return $this->_mostrated; } function getMostread() { // Lets load the data if it doesn't already exist if (empty( $this->_mostread )) { $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('title, id, hits'); $query->from('#__abbook'); $query->order('hits DESC'); $this->_mostread = $this->_getList( $query, 0, 10 ); } return $this->_mostread; } function getMostlent() { // Lets load the data if it doesn't already exist if (empty( $this->_mostlent )) { $db = $this->getDbo(); $query =$db->getQuery(true); $query->select('b.title, COUNT(*) AS amount'); $query->from('#__ablend AS l'); $query->leftjoin('#__abbook AS b ON b.id = l.book_id'); $query->group('l.book_id'); $query->order('amount DESC'); $this->_mostlent = $this->_getList( $query, 0, 10 ); } return $this->_mostlent; } }