6e343891 by TaishiTokudome

Merge branch '011_tokudome' into 'master'

アンインストールによる削除をしないといけないため、手動で削除したコミットを取り消し

See merge request !20
2 parents c69c3a3c b59f2cee
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="# of Months"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="The number of months to display (the default is 10)."
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="Display a list of calendar months, including published articles. This list is automatically generated when you create a published article."
MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="Display a list of calendar months, including published articles. This list is automatically generated when you create a published article."
MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="Default"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="表示月数"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="表示する月数(標準は10)です。"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="標準"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 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
*
* @since 1.5
*/
class ModArchiveHelper
{
/**
* Retrieve list of archived articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @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('MIN(' . $db->quoteName('created') . ') AS created')
->select($query->year($db->quoteName('created')) . ' AS created_year')
->from('#__content')
->where('state = 1')
->group($query->year($db->quoteName('created')) . ', ' . $query->month($db->quoteName('created')))
->order($query->year($db->quoteName('created')) . ' DESC, ' . $query->month($db->quoteName('created')) . ' DESC');
// 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'));
try
{
$rows = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItems('link', 'index.php?option=com_content_custom&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);
$createdMonth = $date->format('n');
$createdYear = $date->format('Y');
$createdYearCal = JHtml::_('date', $row->created, 'Y') . "年";
$monthNameCal = JHtml::_('date', $row->created, 'F');
$createdDateCal = $createdYearCal . $monthNameCal;
$lists[$i] = new stdClass;
# $lists[$i]->link = JRoute::_('index.php?option=com_content_custom&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid);
$link = JRoute::_('index.php?option=com_content_custom&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid);
$link = str_replace("/component/content_custom/", "/information/info-archive.html", $link);
$lists[$i]->link = $link;
$lists[$i]->text = JText::sprintf($createdDateCal);
$i++;
}
return $lists;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 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 archive functions only once
JLoader::register('ModArchiveHelper', __DIR__ . '/helper.php');
$params->def('count', 10);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
$list = ModArchiveHelper::getList($params);
require JModuleHelper::getLayoutPath('mod_articles_archive_custom', $params->get('layout', 'default'));
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>MOD_ARTICLES_ARCHIVE_CUSTOM</name>
<author>T.Tokudome</author>
<creationDate>June 2020</creationDate>
<copyright></copyright>
<license></license>
<authorEmail>tokudome@lilli.co.jp</authorEmail>
<authorUrl></authorUrl>
<version>0.0.1</version>
<description>MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION</description>
<files>
<filename module="mod_articles_archive_custom">mod_articles_archive_custom.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_articles_archive_custom.ini</language>
<language tag="en-GB">en-GB.mod_articles_archive_custom.sys.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_archive_custom.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_archive_custom.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_ARCHIVE" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="count"
type="number"
label="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL"
description="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC"
default="120"
filter="integer"
/>
</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"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
default="1"
filter="integer"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 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-custom<?php echo $moduleclass_sfx; ?> mod-list">
<?php foreach ($list as $item) : ?>
<li>
<a href="<?php echo $item->link; ?>">
<?php echo $item->text; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!