You've already forked joomla_test
first commit
This commit is contained in:
141
administrator/modules/mod_latest/helper.php
Normal file
141
administrator/modules/mod_latest/helper.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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_latest
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class ModLatestHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of articles.
|
||||
*
|
||||
* @param JRegistry $params The module parameters.
|
||||
*
|
||||
* @return mixed An array of articles, or false on error.
|
||||
*/
|
||||
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.access, a.created, a.created_by, a.created_by_alias, a.featured, a.state');
|
||||
|
||||
// Set Ordering filter
|
||||
switch ($params->get('ordering'))
|
||||
{
|
||||
case 'm_dsc':
|
||||
$model->setState('list.ordering', 'modified DESC, created');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
break;
|
||||
|
||||
case 'c_dsc':
|
||||
default:
|
||||
$model->setState('list.ordering', 'created');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
break;
|
||||
}
|
||||
|
||||
// Set Category Filter
|
||||
$categoryId = $params->get('catid');
|
||||
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$model->setState('filter.category_id', $categoryId);
|
||||
}
|
||||
|
||||
// Set User Filter.
|
||||
$userId = $user->get('id');
|
||||
|
||||
switch ($params->get('user_id'))
|
||||
{
|
||||
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 JRegistry $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');
|
||||
$type = $params->get('ordering') == 'c_dsc' ? '_CREATED' : '_MODIFIED';
|
||||
|
||||
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_LATEST_TITLE' . $type . ($catid ? "_CATEGORY" : '') . ($who != '0' ? "_$who" : ''), (int) $params->get('count'), $title);
|
||||
}
|
||||
}
|
1
administrator/modules/mod_latest/index.html
Normal file
1
administrator/modules/mod_latest/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
16
administrator/modules/mod_latest/mod_latest.php
Normal file
16
administrator/modules/mod_latest/mod_latest.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include dependancies.
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModLatestHelper::getList($params);
|
||||
require JModuleHelper::getLayoutPath('mod_latest', $params->get('layout', 'default'));
|
111
administrator/modules/mod_latest/mod_latest.xml
Normal file
111
administrator/modules/mod_latest/mod_latest.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="administrator">
|
||||
<name>mod_latest</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2004</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</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_LATEST_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_latest">mod_latest.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_latest.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_latest.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_LATEST" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_LATEST_FIELD_COUNT_LABEL"
|
||||
description="MOD_LATEST_FIELD_COUNT_DESC" />
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="c_dsc"
|
||||
label="MOD_LATEST_FIELD_ORDERING_LABEL"
|
||||
description="MOD_LATEST_FIELD_ORDERING_DESC">
|
||||
<option
|
||||
value="c_dsc">MOD_LATEST_FIELD_VALUE_ORDERING_ADDED</option>
|
||||
<option
|
||||
value="m_dsc">MOD_LATEST_FIELD_VALUE_ORDERING_MODIFIED</option>
|
||||
</field>
|
||||
<field
|
||||
id="catid"
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
label="JCATEGORY"
|
||||
description="MOD_LATEST_FIELD_CATEGORY_DESC"
|
||||
default=""
|
||||
class="inputbox">
|
||||
<option
|
||||
value="">JOPTION_ANY_CATEGORY</option>
|
||||
</field>
|
||||
<field
|
||||
name="user_id"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_LATEST_FIELD_AUTHORS_LABEL"
|
||||
description="MOD_LATEST_FIELD_AUTHORS_DESC">
|
||||
<option
|
||||
value="0">MOD_LATEST_FIELD_VALUE_AUTHORS_ANYONE</option>
|
||||
<option
|
||||
value="by_me">MOD_LATEST_FIELD_VALUE_AUTHORS_BY_ME</option>
|
||||
<option
|
||||
value="not_me">MOD_LATEST_FIELD_VALUE_AUTHORS_NOT_BY_ME</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="0"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="automatic_title"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL"
|
||||
description="COM_MODULES_FIELD_AUTOMATIC_TITLE_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
50
administrator/modules/mod_latest/tmpl/default.php
Normal file
50
administrator/modules/mod_latest/tmpl/default.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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) : ?>
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<?php echo JHtml::_('jgrid.published', $item->state, $i, '', false); ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<strong class="row-title">
|
||||
<?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>
|
||||
|
||||
<small class="hasTooltip" title="<?php echo JHtml::tooltipText('MOD_LATEST_CREATED_BY'); ?>">
|
||||
<?php echo $item->author_name;?>
|
||||
</small>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<span class="small"><i
|
||||
class="icon-calendar"></i> <?php echo JHtml::_('date', $item->created, 'Y-m-d'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="alert"><?php echo JText::_('MOD_LATEST_NO_MATCHING_RESULTS');?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
1
administrator/modules/mod_latest/tmpl/index.html
Normal file
1
administrator/modules/mod_latest/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user