[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/modules/mod_archive/ -> 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  
  18  
  19  class modArchiveHelper
  20  {
  21  	function getList(&$params)
  22      {
  23          //get database
  24          $db =& JFactory::getDBO();
  25  
  26          $query = 'SELECT MONTH( created ) AS created_month, created, id, sectionid, title, YEAR(created) AS created_year' .
  27              ' FROM #__content' .
  28              ' WHERE ( state = -1 AND checked_out = 0 AND sectionid != 0)' .
  29              ' GROUP BY created_year DESC, created_month DESC';
  30          $db->setQuery($query, 0, intval($params->get('count')));
  31          $rows = $db->loadObjectList();
  32  
  33          $menu = &JSite::getMenu();
  34          $item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
  35          $itemid = isset($item) ? '&Itemid='.$item->id : '';
  36  
  37          $i        = 0;
  38          $lists    = array();
  39          foreach ( $rows as $row )
  40          {
  41              $date =& JFactory::getDate($row->created);
  42  
  43              $created_month    = $date->toFormat("%m");
  44              $month_name        = $date->toFormat("%B");
  45              $created_year    = $date->toFormat("%Y");
  46  
  47              $lists[$i]->link    = JRoute::_('index.php?option=com_content&view=archive&year='.$created_year.'&month='.$created_month.$itemid);
  48              $lists[$i]->text    = $month_name.', '.$created_year;
  49              $i++;
  50          }
  51          return $lists;
  52      }
  53  }


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