Merge branch '011_tokudome' into 'master'
アンインストールによる削除をしないといけないため、手動で削除したコミットを取り消し See merge request !20
Showing
8 changed files
with
254 additions
and
0 deletions
1 | ; Joomla! Project | ||
2 | ; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. | ||
3 | ; License GNU General Public License version 2 or later; see LICENSE.txt | ||
4 | ; Note : All ini files need to be saved as UTF-8 | ||
5 | |||
6 | MOD_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom" | ||
7 | MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="# of Months" | ||
8 | MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="The number of months to display (the default is 10)." | ||
9 | 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." | ||
10 | MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s" | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ; Joomla! Project | ||
2 | ; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved. | ||
3 | ; License GNU General Public License version 2 or later; see LICENSE.txt | ||
4 | ; Note : All ini files need to be saved as UTF-8 | ||
5 | |||
6 | MOD_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom" | ||
7 | 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." | ||
8 | MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="Default" | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ; Joomla! Project | ||
2 | ; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. | ||
3 | ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
4 | ; Note : All ini files need to be saved as UTF-8 | ||
5 | |||
6 | MOD_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)" | ||
7 | MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="表示月数" | ||
8 | MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="表示する月数(標準は10)です。" | ||
9 | MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。" | ||
10 | MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s" | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | ; Joomla! Project | ||
2 | ; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved. | ||
3 | ; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php | ||
4 | ; Note : All ini files need to be saved as UTF-8 | ||
5 | |||
6 | MOD_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)" | ||
7 | MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。" | ||
8 | MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="標準" | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <?php | ||
2 | /** | ||
3 | * @package Joomla.Site | ||
4 | * @subpackage mod_articles_archive | ||
5 | * | ||
6 | * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | ||
7 | * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
8 | */ | ||
9 | |||
10 | defined('_JEXEC') or die; | ||
11 | |||
12 | /** | ||
13 | * Helper for mod_articles_archive | ||
14 | * | ||
15 | * @since 1.5 | ||
16 | */ | ||
17 | class ModArchiveHelper | ||
18 | { | ||
19 | /** | ||
20 | * Retrieve list of archived articles | ||
21 | * | ||
22 | * @param \Joomla\Registry\Registry &$params module parameters | ||
23 | * | ||
24 | * @return array | ||
25 | * | ||
26 | * @since 1.5 | ||
27 | */ | ||
28 | public static function getList(&$params) | ||
29 | { | ||
30 | // Get database | ||
31 | $db = JFactory::getDbo(); | ||
32 | $query = $db->getQuery(true); | ||
33 | $query->select($query->month($db->quoteName('created')) . ' AS created_month') | ||
34 | ->select('MIN(' . $db->quoteName('created') . ') AS created') | ||
35 | ->select($query->year($db->quoteName('created')) . ' AS created_year') | ||
36 | ->from('#__content') | ||
37 | ->where('state = 1') | ||
38 | ->group($query->year($db->quoteName('created')) . ', ' . $query->month($db->quoteName('created'))) | ||
39 | ->order($query->year($db->quoteName('created')) . ' DESC, ' . $query->month($db->quoteName('created')) . ' DESC'); | ||
40 | |||
41 | // Filter by language | ||
42 | if (JFactory::getApplication()->getLanguageFilter()) | ||
43 | { | ||
44 | $query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); | ||
45 | } | ||
46 | |||
47 | $db->setQuery($query, 0, (int) $params->get('count')); | ||
48 | |||
49 | try | ||
50 | { | ||
51 | $rows = (array) $db->loadObjectList(); | ||
52 | } | ||
53 | catch (RuntimeException $e) | ||
54 | { | ||
55 | JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); | ||
56 | |||
57 | return array(); | ||
58 | } | ||
59 | |||
60 | $app = JFactory::getApplication(); | ||
61 | $menu = $app->getMenu(); | ||
62 | $item = $menu->getItems('link', 'index.php?option=com_content_custom&view=archive', true); | ||
63 | $itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : ''; | ||
64 | |||
65 | $i = 0; | ||
66 | $lists = array(); | ||
67 | |||
68 | foreach ($rows as $row) | ||
69 | { | ||
70 | $date = JFactory::getDate($row->created); | ||
71 | |||
72 | $createdMonth = $date->format('n'); | ||
73 | $createdYear = $date->format('Y'); | ||
74 | |||
75 | $createdYearCal = JHtml::_('date', $row->created, 'Y') . "年"; | ||
76 | $monthNameCal = JHtml::_('date', $row->created, 'F'); | ||
77 | $createdDateCal = $createdYearCal . $monthNameCal; | ||
78 | |||
79 | $lists[$i] = new stdClass; | ||
80 | |||
81 | # $lists[$i]->link = JRoute::_('index.php?option=com_content_custom&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid); | ||
82 | $link = JRoute::_('index.php?option=com_content_custom&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid); | ||
83 | $link = str_replace("/component/content_custom/", "/information/info-archive.html", $link); | ||
84 | |||
85 | $lists[$i]->link = $link; | ||
86 | $lists[$i]->text = JText::sprintf($createdDateCal); | ||
87 | |||
88 | $i++; | ||
89 | } | ||
90 | |||
91 | return $lists; | ||
92 | } | ||
93 | } |
1 | <?php | ||
2 | /** | ||
3 | * @package Joomla.Site | ||
4 | * @subpackage mod_articles_archive | ||
5 | * | ||
6 | * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | ||
7 | * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
8 | */ | ||
9 | |||
10 | defined('_JEXEC') or die; | ||
11 | |||
12 | // Include the archive functions only once | ||
13 | JLoader::register('ModArchiveHelper', __DIR__ . '/helper.php'); | ||
14 | |||
15 | $params->def('count', 10); | ||
16 | $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8'); | ||
17 | $list = ModArchiveHelper::getList($params); | ||
18 | |||
19 | require JModuleHelper::getLayoutPath('mod_articles_archive_custom', $params->get('layout', 'default')); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <extension type="module" version="3.1" client="site" method="upgrade"> | ||
3 | <name>MOD_ARTICLES_ARCHIVE_CUSTOM</name> | ||
4 | <author>T.Tokudome</author> | ||
5 | <creationDate>June 2020</creationDate> | ||
6 | <copyright></copyright> | ||
7 | <license></license> | ||
8 | <authorEmail>tokudome@lilli.co.jp</authorEmail> | ||
9 | <authorUrl></authorUrl> | ||
10 | <version>0.0.1</version> | ||
11 | <description>MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION</description> | ||
12 | <files> | ||
13 | <filename module="mod_articles_archive_custom">mod_articles_archive_custom.php</filename> | ||
14 | <folder>tmpl</folder> | ||
15 | <filename>helper.php</filename> | ||
16 | </files> | ||
17 | <languages> | ||
18 | <language tag="en-GB">en-GB.mod_articles_archive_custom.ini</language> | ||
19 | <language tag="en-GB">en-GB.mod_articles_archive_custom.sys.ini</language> | ||
20 | <language tag="ja-JP">ja-JP.mod_articles_archive_custom.ini</language> | ||
21 | <language tag="ja-JP">ja-JP.mod_articles_archive_custom.sys.ini</language> | ||
22 | </languages> | ||
23 | <help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_ARCHIVE" /> | ||
24 | <config> | ||
25 | <fields name="params"> | ||
26 | <fieldset name="basic"> | ||
27 | <field | ||
28 | name="count" | ||
29 | type="number" | ||
30 | label="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL" | ||
31 | description="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC" | ||
32 | default="120" | ||
33 | filter="integer" | ||
34 | /> | ||
35 | </fieldset> | ||
36 | |||
37 | <fieldset name="advanced"> | ||
38 | <field | ||
39 | name="layout" | ||
40 | type="modulelayout" | ||
41 | label="JFIELD_ALT_LAYOUT_LABEL" | ||
42 | description="JFIELD_ALT_MODULE_LAYOUT_DESC" | ||
43 | /> | ||
44 | |||
45 | <field | ||
46 | name="moduleclass_sfx" | ||
47 | type="textarea" | ||
48 | label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" | ||
49 | description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" | ||
50 | rows="3" | ||
51 | /> | ||
52 | |||
53 | <field | ||
54 | name="cache" | ||
55 | type="list" | ||
56 | label="COM_MODULES_FIELD_CACHING_LABEL" | ||
57 | description="COM_MODULES_FIELD_CACHING_DESC" | ||
58 | default="1" | ||
59 | filter="integer" | ||
60 | > | ||
61 | <option value="1">JGLOBAL_USE_GLOBAL</option> | ||
62 | <option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option> | ||
63 | </field> | ||
64 | |||
65 | <field | ||
66 | name="cache_time" | ||
67 | type="number" | ||
68 | label="COM_MODULES_FIELD_CACHE_TIME_LABEL" | ||
69 | description="COM_MODULES_FIELD_CACHE_TIME_DESC" | ||
70 | default="900" | ||
71 | filter="integer" | ||
72 | /> | ||
73 | |||
74 | <field | ||
75 | name="cachemode" | ||
76 | type="hidden" | ||
77 | default="static" | ||
78 | > | ||
79 | <option value="static"></option> | ||
80 | </field> | ||
81 | </fieldset> | ||
82 | </fields> | ||
83 | </config> | ||
84 | </extension> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <?php | ||
2 | /** | ||
3 | * @package Joomla.Site | ||
4 | * @subpackage mod_articles_archive | ||
5 | * | ||
6 | * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | ||
7 | * @license GNU General Public License version 2 or later; see LICENSE.txt | ||
8 | */ | ||
9 | |||
10 | defined('_JEXEC') or die; | ||
11 | ?> | ||
12 | <?php if (!empty($list)) : ?> | ||
13 | <ul class="archive-module-custom<?php echo $moduleclass_sfx; ?> mod-list"> | ||
14 | <?php foreach ($list as $item) : ?> | ||
15 | <li> | ||
16 | <a href="<?php echo $item->link; ?>"> | ||
17 | <?php echo $item->text; ?> | ||
18 | </a> | ||
19 | </li> | ||
20 | <?php endforeach; ?> | ||
21 | </ul> | ||
22 | <?php endif; ?> |
-
Please register or sign in to post a comment