| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: categories.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Content 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * details. 13 */ 14 15 // Check to ensure this file is included in Joomla! 16 defined( '_JEXEC' ) or die( 'Restricted access' ); 17 18 jimport('joomla.application.component.model'); 19 20 /** 21 * Weblinks Component Categories Model 22 * 23 * @package Joomla 24 * @subpackage Weblinks 25 * @since 1.5 26 */ 27 class WeblinksModelCategories extends JModel 28 { 29 /** 30 * Categories data array 31 * 32 * @var array 33 */ 34 var $_data = null; 35 36 /** 37 * Categories total 38 * 39 * @var integer 40 */ 41 var $_total = null; 42 43 /** 44 * Constructor 45 * 46 * @since 1.5 47 */ 48 49 function __construct() 50 { 51 parent::__construct(); 52 53 } 54 55 /** 56 * Method to get weblink item data for the category 57 * 58 * @access public 59 * @return array 60 */ 61 function getData() 62 { 63 // Lets load the content if it doesn't already exist 64 if (empty($this->_data)) 65 { 66 $query = $this->_buildQuery(); 67 $this->_data = $this->_getList($query); 68 } 69 70 return $this->_data; 71 } 72 73 /** 74 * Method to get the total number of weblink items for the category 75 * 76 * @access public 77 * @return integer 78 */ 79 function getTotal() 80 { 81 // Lets load the content if it doesn't already exist 82 if (empty($this->_total)) 83 { 84 $query = $this->_buildQuery(); 85 $this->_total = $this->_getListCount($query); 86 } 87 88 return $this->_total; 89 } 90 91 function _buildQuery() 92 { 93 $user =& JFactory::getUser(); 94 $aid = $user->get('aid', 0); 95 96 //Query to retrieve all categories that belong under the web links section and that are published. 97 $query = 'SELECT cc.*, COUNT(a.id) AS numlinks,' 98 .' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as slug' 99 .' FROM #__categories AS cc' 100 .' LEFT JOIN #__weblinks AS a ON a.catid = cc.id' 101 .' WHERE a.published = 1' 102 .' AND section = \'com_weblinks\'' 103 .' AND cc.published = 1' 104 .' AND cc.access <= '.(int) $aid 105 .' GROUP BY cc.id' 106 .' ORDER BY cc.ordering'; 107 108 return $query; 109 } 110 } 111 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |