Skip to content

Commit

Permalink
Codestyle Modules. Closes #4242. Closes #4241
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 authored and piotr-cz committed Oct 6, 2014
1 parent 03c2456 commit df137b8
Show file tree
Hide file tree
Showing 24 changed files with 782 additions and 706 deletions.
18 changes: 10 additions & 8 deletions modules/mod_articles_archive/helper.php
Expand Up @@ -23,12 +23,14 @@ class ModArchiveHelper
*
* @param JRegistry &$params module parameters
*
* @return array
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
// Get database
$db = JFactory::getDbo();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
->select('created, id, title')
Expand All @@ -46,23 +48,23 @@ public static function getList(&$params)
$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);
$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;
$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 = $date->format('Y');

$created_year_cal = JHTML::_('date', $row->created, 'Y');
$month_name_cal = JHTML::_('date', $row->created, 'F');
$month_name_cal = JHTML::_('date', $row->created, 'F');

$lists[$i] = new stdClass;

Expand Down
2 changes: 1 addition & 1 deletion modules/mod_articles_archive/mod_articles_archive.php
Expand Up @@ -14,6 +14,6 @@

$params->def('count', 10);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$list = ModArchiveHelper::getList($params);
$list = ModArchiveHelper::getList($params);

require JModuleHelper::getLayoutPath('mod_articles_archive', $params->get('layout', 'default'));
32 changes: 20 additions & 12 deletions modules/mod_articles_archive/mod_articles_archive.xml
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site"
method="upgrade"
>
<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 - 2014 Open Source Matters.
All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<copyright>Copyright (C) 2005 - 2014 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>
Expand All @@ -28,22 +24,31 @@
<config>
<fields name="params">
<fieldset name="basic">
<field name="count" type="text"
<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"
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />

<field name="moduleclass_sfx" type="textarea" rows="3"
<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"
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
Expand All @@ -52,10 +57,13 @@
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>

<field name="cache_time" type="text"
<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"
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_articles_archive/tmpl/default.php
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;
?>
<?php if (!empty($list)) :?>
<?php if (!empty($list)) : ?>
<ul class="archive-module<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
Expand Down
10 changes: 6 additions & 4 deletions modules/mod_articles_categories/helper.php
Expand Up @@ -17,7 +17,7 @@
* @package Joomla.Site
* @subpackage mod_articles_categories
*
* @since 1.5.0
* @since 1.5
*/
abstract class ModArticlesCategoriesHelper
{
Expand All @@ -26,15 +26,17 @@ abstract class ModArticlesCategoriesHelper
*
* @param JRegistry &$params module parameters
*
* @return array
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$options = array();
$options = array();
$options['countItems'] = $params->get('numitems', 0);

$categories = JCategories::getInstance('Content', $options);
$category = $categories->get($params->get('parent', 'root'));
$category = $categories->get($params->get('parent', 'root'));

if ($category != null)
{
Expand Down
12 changes: 6 additions & 6 deletions modules/mod_articles_categories/mod_articles_categories.php
Expand Up @@ -16,18 +16,18 @@

$cacheid = md5(serialize($module->module));

$cacheparams = new stdClass;
$cacheparams->cachemode = 'id';
$cacheparams->class = 'ModArticlesCategoriesHelper';
$cacheparams->method = 'getList';
$cacheparams = new stdClass;
$cacheparams->cachemode = 'id';
$cacheparams->class = 'ModArticlesCategoriesHelper';
$cacheparams->method = 'getList';
$cacheparams->methodparams = $params;
$cacheparams->modeparams = $cacheid;
$cacheparams->modeparams = $cacheid;

$list = JModuleHelper::moduleCache($module, $params, $cacheparams);

if (!empty($list))
{
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$startLevel = reset($list)->getParent()->level;
$startLevel = reset($list)->getParent()->level;
require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default'));
}

0 comments on commit df137b8

Please sign in to comment.