| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/mod_popular.tar |
mod_popular.php 0000604 00000001214 15245561175 0007603 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_popular
*
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the mod_popular functions only once.
JLoader::register('ModPopularHelper', __DIR__ . '/helper.php');
// Get module data.
$list = ModPopularHelper::getList($params);
if ($params->get('automatic_title', 0))
{
$module->title = ModPopularHelper::getTitle($params);
}
// Render the module
require JModuleHelper::getLayoutPath('mod_popular', $params->get('layout', 'default'));
mod_popular.xml 0000604 00000005076 15245561175 0007626 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="administrator" method="upgrade">
<name>mod_popular</name>
<author>Joomla! Project</author>
<creationDate>July 2004</creationDate>
<copyright>(C) 2005 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_POPULAR_XML_DESCRIPTION</description>
<files>
<filename module="mod_popular">mod_popular.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_popular.ini</language>
<language tag="en-GB">en-GB.mod_popular.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_POPULAR" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="count"
type="number"
label="MOD_POPULAR_FIELD_COUNT_LABEL"
description="MOD_POPULAR_FIELD_COUNT_DESC"
default="5"
filter="integer"
/>
<field
name="catid"
type="category"
label="JCATEGORY"
description="MOD_POPULAR_FIELD_CATEGORY_DESC"
id="catid"
extension="com_content"
default=""
filter="integer"
>
<option value="">JOPTION_ANY_CATEGORY</option>
</field>
<field
name="user_id"
type="list"
label="MOD_POPULAR_FIELD_AUTHORS_LABEL"
description="MOD_POPULAR_FIELD_AUTHORS_DESC"
default="0"
>
<option value="0">MOD_POPULAR_FIELD_VALUE_ANYONE</option>
<option value="by_me">MOD_POPULAR_FIELD_VALUE_ADDED_OR_MODIFIED_BY_ME</option>
<option value="not_me">MOD_POPULAR_FIELD_VALUE_NOT_ADDED_OR_MODIFIED_BY_ME</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
validate="moduleLayout"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="automatic_title"
type="radio"
label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL"
description="COM_MODULES_FIELD_AUTOMATIC_TITLE_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
</fields>
</config>
</extension>
helper.php 0000604 00000005415 15245561175 0006550 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_popular
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel');
/**
* Helper for mod_popular
*
* @since 1.6
*/
abstract class ModPopularHelper
{
/**
* Get a list of the most popular articles
*
* @param JObject &$params The module parameters.
*
* @return array
*/
public static function getList(&$params)
{
$user = JFactory::getuser();
// Get an instance of the generic articles model
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
// Set List SELECT
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
' a.created, a.hits');
// Set Ordering filter
$model->setState('list.ordering', 'a.hits');
$model->setState('list.direction', 'DESC');
// Set Category Filter
$categoryId = $params->get('catid', null);
if (is_numeric($categoryId))
{
$model->setState('filter.category_id', $categoryId);
}
// Set User Filter.
$userId = $user->get('id');
switch ($params->get('user_id', '0'))
{
case 'by_me':
$model->setState('filter.author_id', $userId);
break;
case 'not_me':
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id.include', false);
break;
}
// 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())
{
JError::raiseError(500, $error);
return false;
}
// Set the links
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);
}
else
{
$item->link = '';
}
}
return $items;
}
/**
* 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', '0');
$catid = (int) $params->get('catid', null);
if ($catid)
{
$category = JCategories::getInstance('Content')->get($catid);
if ($category)
{
$title = $category->title;
}
else
{
$title = JText::_('MOD_POPULAR_UNEXISTING');
}
}
else
{
$title = '';
}
return JText::plural(
'MOD_POPULAR_TITLE' . ($catid ? '_CATEGORY' : '') . ($who != '0' ? "_$who" : ''),
(int) $params->get('count', 5),
$title
);
}
}
tmpl/default.php 0000604 00000003611 15245561175 0007665 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage mod_popular
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('bootstrap.tooltip');
?>
<div class="row-striped">
<?php if (count($list)) : ?>
<?php foreach ($list as $i => $item) : ?>
<?php // Calculate popular items ?>
<?php $hits = (int) $item->hits; ?>
<?php $hits_class = ($hits >= 10000 ? 'important' : ($hits >= 1000 ? 'warning' : ($hits >= 100 ? 'info' : ''))); ?>
<div class="row-fluid">
<div class="span8 truncate">
<span class="badge badge-<?php echo $hits_class; ?> hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JGLOBAL_HITS'); ?>"><?php echo $item->hits; ?></span>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time); ?>
<?php endif; ?>
<strong class="row-title" title="<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
<?php if ($item->link) : ?>
<a href="<?php echo $item->link; ?>">
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?></a>
<?php else : ?>
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
<?php endif; ?>
</strong>
</div>
<div class="span4">
<div class="small pull-right hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JGLOBAL_FIELD_CREATED_LABEL'); ?>">
<span class="icon-calendar" aria-hidden="true"></span> <?php echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC5')); ?>
</div>
</div>
</div>
<?php endforeach; ?>
<?php else : ?>
<div class="row-fluid">
<div class="span12">
<div class="alert"><?php echo JText::_('MOD_POPULAR_NO_MATCHING_RESULTS'); ?></div>
</div>
</div>
<?php endif; ?>
</div>