Source for file helper.php
Documentation is available at helper.php
* @package Joomla.Administrator
* @subpackage mod_popular
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @package Joomla.Administrator
* @subpackage mod_popular
* Get a list of the most popular articles
* @param JObject &$params The module parameters.
public static function getList(&$params)
// Get an instance of the generic articles model
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
$model->setState('list.ordering', 'a.hits');
$model->setState('list.direction', 'DESC');
$categoryId =
$params->get('catid');
$model->setState('filter.category_id', $categoryId);
$userId =
$user->get('id');
switch ($params->get('user_id'))
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id.include', false);
// Set the Start and Limit
$model->setState('list.start', 0);
$model->setState('list.limit', $params->get('count', 5));
$items =
$model->getItems();
if ($error =
$model->getError())
foreach ($items as &$item)
if ($user->authorise('core.edit', 'com_content.article.' .
$item->id))
$item->link =
JRoute::_('index.php?option=com_content&task=article.edit&id=' .
$item->id);
* Get the alternate title for the module
* @param JObject $params The module parameters.
* @return string The alternate title for the module.
public static function getTitle($params)
$who =
$params->get('user_id');
$catid = (int)
$params->get('catid');
$title =
$category->title;
$title =
JText::_('MOD_POPULAR_UNEXISTING');
return JText::plural('MOD_POPULAR_TITLE' .
($catid ?
"_CATEGORY" :
'') .
($who !=
'0' ?
"_$who" :
''), (int)
$params->get('count'), $title);
Documentation generated on Tue, 19 Nov 2013 15:04:27 +0100 by phpDocumentor 1.4.3