[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/modules/mod_sections/ -> helper.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: helper.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   6  * @license        GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  /// no direct access
  15  defined('_JEXEC') or die('Restricted access');
  16  
  17  require_once  (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
  18  
  19  class modSectionsHelper
  20  {
  21  	function getList(&$params)
  22      {
  23          global $mainframe;
  24  
  25          $db        =& JFactory::getDBO();
  26          $user    =& JFactory::getUser();
  27  
  28          $count    = intval($params->get('count', 20));
  29          $contentConfig     = &JComponentHelper::getParams( 'com_content' );
  30          $access    = !$contentConfig->get('show_noauth');
  31  
  32          $gid         = $user->get('aid', 0);
  33          $now        = date('Y-m-d H:i:s', time() + $mainframe->getCfg('offset') * 60 * 60);
  34          $nullDate    = $db->getNullDate();
  35  
  36  
  37          $query = 'SELECT a.id AS id, a.title AS title, COUNT(b.id) as cnt' .
  38              ' FROM #__sections as a' .
  39              ' LEFT JOIN #__content as b ON a.id = b.sectionid' .
  40              ($access ? ' AND b.access <= '.(int) $gid : '') .
  41              ' AND ( b.publish_up = '.$db->Quote($nullDate).' OR b.publish_up <= '.$db->Quote($now).' )' .
  42              ' AND ( b.publish_down = '.$db->Quote($nullDate).' OR b.publish_down >= '.$db->Quote($now).' )' .
  43              ' WHERE a.scope = "content"' .
  44              ' AND a.published = 1' .
  45              ($access ? ' AND a.access <= '.(int) $gid : '') .
  46              ' GROUP BY a.id '.
  47              ' HAVING COUNT( b.id ) > 0' .
  48              ' ORDER BY a.ordering';
  49          $db->setQuery($query, 0, $count);
  50          $rows = $db->loadObjectList();
  51  
  52          return $rows;
  53      }
  54  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1