You've already forked joomla_test
first commit
This commit is contained in:
71
modules/mod_articles_archive/helper.php
Normal file
71
modules/mod_articles_archive/helper.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_archive
|
||||
*
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
* @since 1.5
|
||||
*/
|
||||
class ModArchiveHelper
|
||||
{
|
||||
/*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
//get database
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
|
||||
->select('created, id, title')
|
||||
->select($query->year($db->quoteName('created')) . ' AS created_year')
|
||||
->from('#__content')
|
||||
->where('state = 2 AND checked_out = 0')
|
||||
->group('created_year, created_month');
|
||||
|
||||
// Filter by language
|
||||
if (JFactory::getApplication()->getLanguageFilter())
|
||||
{
|
||||
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
$db->setQuery($query, 0, (int) $params->get('count'));
|
||||
$rows = (array) $db->loadObjectList();
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
|
||||
$itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : '';
|
||||
|
||||
$i = 0;
|
||||
$lists = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$date = JFactory::getDate($row->created);
|
||||
|
||||
$created_month = $date->format('n');
|
||||
$created_year = $date->format('Y');
|
||||
|
||||
$created_year_cal = JHTML::_('date', $row->created, 'Y');
|
||||
$month_name_cal = JHTML::_('date', $row->created, 'F');
|
||||
|
||||
$lists[$i] = new stdClass;
|
||||
|
||||
$lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
|
||||
$lists[$i]->text = JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $month_name_cal, $created_year_cal);
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
}
|
1
modules/mod_articles_archive/index.html
Normal file
1
modules/mod_articles_archive/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
19
modules/mod_articles_archive/mod_articles_archive.php
Normal file
19
modules/mod_articles_archive/mod_articles_archive.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @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';
|
||||
|
||||
$params->def('count', 10);
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
|
||||
$list = ModArchiveHelper::getList($params);
|
||||
|
||||
require JModuleHelper::getLayoutPath('mod_articles_archive', $params->get('layout', 'default'));
|
69
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
69
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="3.1" client="site"
|
||||
method="upgrade"
|
||||
>
|
||||
<name>mod_articles_archive</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_ARCHIVE_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_articles_archive">mod_articles_archive.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
<filename>helper.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>mod_articles_archive.xml</filename>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">en-GB.mod_articles_archive.ini</language>
|
||||
<language tag="en-GB">en-GB.mod_articles_archive.sys.ini</language>
|
||||
</languages>
|
||||
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_ARCHIVE" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="count" type="text"
|
||||
default="10"
|
||||
label="MOD_ARTICLES_ARCHIVE_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_ARCHIVE_FIELD_COUNT_DESC" />
|
||||
</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="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
22
modules/mod_articles_archive/tmpl/default.php
Normal file
22
modules/mod_articles_archive/tmpl/default.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @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;
|
||||
?>
|
||||
<?php if (!empty($list)) :?>
|
||||
<ul class="archive-module<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->text; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
1
modules/mod_articles_archive/tmpl/index.html
Normal file
1
modules/mod_articles_archive/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
Reference in New Issue
Block a user