Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  mod_articles_archive
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Helper for mod_articles_archive
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  mod_articles_archive
  17.  * @since       1.5
  18.  */
  19. {
  20.     /*
  21.      * @since  1.5
  22.      */
  23.     public static function getList(&$params)
  24.     {
  25.         //get database
  26.         $db JFactory::getDbo();
  27.         $query $db->getQuery(true);
  28.         $query->select($query->month($db->quoteName('created')) ' AS created_month')
  29.             ->select('created, id, title')
  30.             ->select($query->year($db->quoteName('created')) ' AS created_year')
  31.             ->from('#__content')
  32.             ->where('state = 2 AND checked_out = 0')
  33.             ->group('created_year DESC, created_month DESC');
  34.  
  35.         // Filter by language
  36.         if (JFactory::getApplication()->getLanguageFilter())
  37.         {
  38.             $query->where('language in (' $db->quote(JFactory::getLanguage()->getTag()) ',' $db->quote('*'')');
  39.         }
  40.  
  41.         $db->setQuery($query0(int) $params->get('count'));
  42.         $rows = (array) $db->loadObjectList();
  43.  
  44.         $app JFactory::getApplication();
  45.         $menu $app->getMenu();
  46.         $item $menu->getItems('link''index.php?option=com_content&view=archive'true);
  47.         $itemid (isset($item&& !empty($item->id)) '&Itemid=' $item->id '';
  48.  
  49.         $i 0;
  50.         $lists array();
  51.         foreach ($rows as $row)
  52.         {
  53.             $date JFactory::getDate($row->created);
  54.  
  55.             $created_month $date->format('n');
  56.             $created_year $date->format('Y');
  57.  
  58.             $created_year_cal JHTML::_('date'$row->created'Y');
  59.             $month_name_cal JHTML::_('date'$row->created'F');
  60.  
  61.             $lists[$inew stdClass;
  62.  
  63.             $lists[$i]->link JRoute::_('index.php?option=com_content&view=archive&year=' $created_year '&month=' $created_month $itemid);
  64.             $lists[$i]->text JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE'$month_name_cal$created_year_cal);
  65.  
  66.             $i++;
  67.         }
  68.         return $lists;
  69.     }
  70. }

Documentation generated on Tue, 19 Nov 2013 15:04:31 +0100 by phpDocumentor 1.4.3