You've already forked joomla_test
first commit
This commit is contained in:
105
modules/mod_articles_news/helper.php
Normal file
105
modules/mod_articles_news/helper.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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;
|
||||
|
||||
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
|
||||
|
||||
JModelLegacy::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_news
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*/
|
||||
abstract class ModArticlesNewsHelper
|
||||
{
|
||||
public static function getList(&$params)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
|
||||
|
||||
// Set application parameters in model
|
||||
$appParams = JFactory::getApplication()->getParams();
|
||||
$model->setState('params', $appParams);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', (int) $params->get('count', 5));
|
||||
|
||||
$model->setState('filter.published', 1);
|
||||
|
||||
$model->setState('list.select', 'a.fulltext, a.id, a.title, a.alias, a.introtext, a.state, a.catid, a.created, a.created_by, a.created_by_alias,' .
|
||||
' a.modified, a.modified_by, a.publish_up, a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access,' .
|
||||
' a.hits, a.featured' );
|
||||
|
||||
// Access filter
|
||||
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
|
||||
$model->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$model->setState('filter.category_id', $params->get('catid', array()));
|
||||
|
||||
// Filter by language
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// Set ordering
|
||||
$ordering = $params->get('ordering', 'a.publish_up');
|
||||
$model->setState('list.ordering', $ordering);
|
||||
if (trim($ordering) == 'rand()')
|
||||
{
|
||||
$model->setState('list.direction', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$model->setState('list.direction', 'DESC');
|
||||
}
|
||||
|
||||
// Retrieve Content
|
||||
$items = $model->getItems();
|
||||
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$item->readmore = strlen(trim($item->fulltext));
|
||||
$item->slug = $item->id.':'.$item->alias;
|
||||
$item->catslug = $item->catid.':'.$item->category_alias;
|
||||
|
||||
if ($access || in_array($item->access, $authorised))
|
||||
{
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
|
||||
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE');
|
||||
}
|
||||
else {
|
||||
$item->link = JRoute::_('index.php?option=com_users&view=login');
|
||||
$item->linkText = JText::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
|
||||
}
|
||||
|
||||
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_news.content');
|
||||
|
||||
//new
|
||||
if (!$params->get('image'))
|
||||
{
|
||||
$item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
|
||||
}
|
||||
|
||||
$results = $app->triggerEvent('onContentAfterDisplay', array('com_content.article', &$item, &$params, 1));
|
||||
$item->afterDisplayTitle = trim(implode("\n", $results));
|
||||
|
||||
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_content.article', &$item, &$params, 1));
|
||||
$item->beforeDisplayContent = trim(implode("\n", $results));
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
1
modules/mod_articles_news/index.html
Normal file
1
modules/mod_articles_news/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
18
modules/mod_articles_news/mod_articles_news.php
Normal file
18
modules/mod_articles_news/mod_articles_news.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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 the syndicate functions only once
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
$list = ModArticlesNewsHelper::getList($params);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_news', $params->get('layout', 'horizontal'));
|
196
modules/mod_articles_news/mod_articles_news.xml
Normal file
196
modules/mod_articles_news/mod_articles_news.xml
Normal file
@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension
|
||||
type="module"
|
||||
version="3.1"
|
||||
client="site"
|
||||
method="upgrade">
|
||||
<name>mod_articles_news</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>July 2006</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_ARTICLES_NEWS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_news">mod_articles_news.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_news.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_news.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_news.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_NEWSFLASH" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
default=""
|
||||
size="10"
|
||||
label="JCATEGORY"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_CATEGORY_DESC" >
|
||||
<option value="">JOPTION_ALL_CATEGORIES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_IMAGES_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_IMAGES_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_title"
|
||||
class="btn-group"
|
||||
type="radio"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_TITLE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_TITLE_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_LINKTITLE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_LINKTITLE_DESC">
|
||||
<option
|
||||
value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_heading"
|
||||
type="list"
|
||||
default="h4"
|
||||
label="MOD_ARTICLES_NEWS_TITLE_HEADING"
|
||||
description="MOD_ARTICLES_NEWS_TITLE_HEADING_DESCRIPTION">
|
||||
<option
|
||||
value="h1">JH1</option>
|
||||
<option
|
||||
value="h2">JH2</option>
|
||||
<option
|
||||
value="h3">JH3</option>
|
||||
<option
|
||||
value="h4">JH4</option>
|
||||
<option
|
||||
value="h5">JH5</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="showLastSeparator"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_SEPARATOR_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_SEPARATOR_DESC">
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="0"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_READMORE_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_READMORE_DESC">
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_ITEMS_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_ITEMS_DESC" />
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="a.publish_up"
|
||||
label="MOD_ARTICLES_NEWS_FIELD_ORDERING_LABEL"
|
||||
description="MOD_ARTICLES_NEWS_FIELD_ORDERING_DESC">
|
||||
<option
|
||||
value="a.publish_up">MOD_ARTICLES_NEWS_FIELD_ORDERING_PUBLISHED_DATE</option>
|
||||
<option
|
||||
value="a.created">MOD_ARTICLES_NEWS_FIELD_ORDERING_CREATED_DATE</option>
|
||||
<option
|
||||
value="a.ordering">MOD_ARTICLES_NEWS_FIELD_ORDERING_ORDERING</option>
|
||||
<option
|
||||
value="rand()">MOD_ARTICLES_NEWS_FIELD_ORDERING_RANDOM</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="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid">
|
||||
<option
|
||||
value="itemid"></option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
36
modules/mod_articles_news/tmpl/_item.php
Normal file
36
modules/mod_articles_news/tmpl/_item.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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;
|
||||
$item_heading = $params->get('item_heading', 'h4');
|
||||
?>
|
||||
<?php if ($params->get('item_title')) : ?>
|
||||
|
||||
<<?php echo $item_heading; ?> class="newsflash-title<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php if ($params->get('link_titles') && $item->link != '') : ?>
|
||||
<a href="<?php echo $item->link;?>">
|
||||
<?php echo $item->title;?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
</<?php echo $item_heading; ?>>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$params->get('intro_only')) :
|
||||
echo $item->afterDisplayTitle;
|
||||
endif; ?>
|
||||
|
||||
<?php echo $item->beforeDisplayContent; ?>
|
||||
|
||||
<?php echo $item->introtext; ?>
|
||||
|
||||
<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) :
|
||||
echo '<a class="readmore" href="'.$item->link.'">'.$item->linkText.'</a>';
|
||||
endif; ?>
|
18
modules/mod_articles_news/tmpl/default.php
Normal file
18
modules/mod_articles_news/tmpl/default.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<div class="newsflash<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
foreach ($list as $item) :
|
||||
require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
26
modules/mod_articles_news/tmpl/horizontal.php
Normal file
26
modules/mod_articles_news/tmpl/horizontal.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
|
||||
<ul class="newsflash-horiz<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) :
|
||||
$item = $list[$i]; ?>
|
||||
<li>
|
||||
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
|
||||
if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
|
||||
|
||||
<span class="article-separator"> </span>
|
||||
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
1
modules/mod_articles_news/tmpl/index.html
Normal file
1
modules/mod_articles_news/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
22
modules/mod_articles_news/tmpl/vertical.php
Normal file
22
modules/mod_articles_news/tmpl/vertical.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_news
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<ul class="newsflash-vert<?php echo $params->get('moduleclass_sfx'); ?>">
|
||||
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) :
|
||||
$item = $list[$i]; ?>
|
||||
<li class="newsflash-item">
|
||||
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item');
|
||||
if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
|
||||
<span class="article-separator"> </span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
Reference in New Issue
Block a user