6efc7823 by root

インストールが必要なモジュール、コンポーネント用の管理ディレクトリの作成

1 parent d2dc146a
Showing 32 changed files with 1666 additions and 0 deletions
1 .DS_Store
...\ No newline at end of file ...\ No newline at end of file
1 #月次アーカイブ用コンポーネント
2 過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。
3 管理画面よりインストールする必要があります。
4
5 ##インストール手順
6 ####インストールはzip形式のファイルで行わなければいけないため、com_content_customフォルダをzipに圧縮した後、以下の手順でインストールする必要があります。
7 1 管理画面ログイン
8 2 エクステンション配下の管理を選択
9 3 インストール配下のパッケージファイルのアップロードを選択
10 4 ファイルを選択しアップロード
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 echo "<p>カスタムアーカイブコンポーネントです。</p>";
3 echo "\n";
4 echo "<P>このページから設定する項目はありません。</P>";
...\ 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 COM_CONTENT_CUSTOM="archive_custom_component"
7 COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options"
8 COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="Position of Article Info"
9 COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
10 COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC="Puts the article information block above or below the text or splits it into two separate blocks, one above and the other below."
11 COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="Use Article Settings"
12 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
13 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
14 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
15 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
16 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="Default"
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 COM_CONTENT_CUSTOM="archive_custom_component"
7 COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
8 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
9 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
10 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
11 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
12 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="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 COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
7 COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="オプション"
8 COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="記事情報の位置"
9 COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
10 COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC="記事情報のブロックをテキストの上か下に追加します。または1つは上、その他は下へ2つのブロックに分けます。"
11 COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="記事設定の使用"
12 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
13 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
14 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
15 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
16 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
...\ 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 COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
7 COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
8 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
9 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
10 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
11 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
12 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
...\ No newline at end of file ...\ No newline at end of file
1 <?xml version="1.0" encoding="utf-8"?>
2 <extension type="component" version="3.0" method="upgrade">
3 <name>COM_CONTENT_CUSTOM</name>
4 <author>T.Tokudome</author>
5 <creationDate>July 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>COM_CONTENT_CUSTOM_XML_DESCRIPTION</description>
12
13 <update>
14 <schemas>
15 <schemapath type="mysql">sql/updates/mysql</schemapath>
16 </schemas>
17 </update>
18
19 <files folder="site">
20 <filename>index.html</filename>
21 <filename>content_custom.php</filename>
22 <filename>controller.php</filename>
23 <folder>views</folder>
24 <folder>helpers</folder>
25 <folder>models</folder>
26 </files>
27 <languages folder="site">
28 <language tag="en-GB">language/en-GB.com_content_custom.ini</language>
29 <language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
30 </languages>
31 <administration>
32 <menu link='index.php?option=com_content_custom'>カスタムアーカイブ</menu>
33 <files folder="admin">
34 <filename>index.html</filename>
35 <filename>content_custom.php</filename>
36 <folder>sql</folder>
37 </files>
38 <languages folder="admin">
39 <language tag="en-GB">language/en-GB.com_content_custom.ini</language>
40 <language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
41 <language tag="en-GB">language/en-GB.com_content_custom.sys.ini</language>
42 <language tag="ja-JP">language/ja-JP.com_content_custom.sys.ini</language>
43 </languages>
44 </administration>
45
46 </extension>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 JLoader::register('ContentCustomHelperRoute', JPATH_SITE . '/components/com_content_custom/helpers/route.php');
13 JLoader::register('ContentCustomHelperQuery', JPATH_SITE . '/components/com_content_custom/helpers/query.php');
14
15 $input = JFactory::getApplication()->input;
16 $user = JFactory::getUser();
17
18 $controller = JControllerLegacy::getInstance('Content');
19
20 $controller->execute(JFactory::getApplication()->input->get('task'));
21 $controller->redirect();
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 use Joomla\CMS\Component\ComponentHelper;
13
14 /**
15 * Content Component Controller
16 *
17 * @since 1.5
18 */
19 class ContentController extends JControllerLegacy
20 {
21 /**
22 * Constructor.
23 *
24 * @param array $config An optional associative array of configuration settings.
25 * Recognized key values include 'name', 'default_task', 'model_path', and
26 * 'view_path' (this list is not meant to be comprehensive).
27 *
28 * @since 3.0.1
29 */
30 public function __construct($config = array())
31 {
32 $this->input = JFactory::getApplication()->input;
33
34 // Article frontpage Editor pagebreak proxying:
35 if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
36 {
37 $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
38 }
39 // Article frontpage Editor article proxying:
40 elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
41 {
42 JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true));
43 $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
44 }
45
46 parent::__construct($config);
47 }
48
49 /**
50 * Method to display a view.
51 *
52 * @param boolean $cachable If true, the view output will be cached.
53 * @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
54 *
55 * @return JController This object to support chaining.
56 *
57 * @since 1.5
58 */
59 public function display($cachable = false, $urlparams = false)
60 {
61 $cachable = true;
62
63 /**
64 * Set the default view name and format from the Request.
65 * Note we are using a_id to avoid collisions with the router and the return page.
66 * Frontend is a bit messier than the backend.
67 */
68 $id = $this->input->getInt('a_id');
69 $vName = $this->input->getCmd('view', 'categories');
70 $this->input->set('view', $vName);
71 $user = JFactory::getUser();
72
73 if ($user->get('id')
74 || ($this->input->getMethod() === 'POST'
75 && (($vName === 'category' && $this->input->get('layout') !== 'blog') || $vName === 'archive' )))
76 {
77 $cachable = false;
78 }
79
80 $safeurlparams = array(
81 'catid' => 'INT',
82 'id' => 'INT',
83 'cid' => 'ARRAY',
84 'year' => 'INT',
85 'month' => 'INT',
86 'limit' => 'UINT',
87 'limitstart' => 'UINT',
88 'showall' => 'INT',
89 'return' => 'BASE64',
90 'filter' => 'STRING',
91 'filter_order' => 'CMD',
92 'filter_order_Dir' => 'CMD',
93 'filter-search' => 'STRING',
94 'print' => 'BOOLEAN',
95 'lang' => 'CMD',
96 'Itemid' => 'INT');
97
98 parent::display($cachable, $safeurlparams);
99
100 return $this;
101 }
102 }
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 * Content Component Query Helper
14 *
15 * @since 1.5
16 */
17 class ContentCustomHelperQuery
18 {
19 /**
20 * Translate an order code to a field for secondary category ordering.
21 *
22 * @param string $orderby The ordering code.
23 * @param string $orderDate The ordering code for the date.
24 *
25 * @return string The SQL field(s) to order by.
26 *
27 * @since 1.5
28 */
29 public static function orderbySecondary($orderby, $orderDate = 'created')
30 {
31 $queryDate = self::getQueryDate($orderDate);
32
33 switch ($orderby)
34 {
35 case 'date' :
36 $orderby = $queryDate;
37 break;
38
39 case 'rdate' :
40 $orderby = $queryDate . ' DESC ';
41 break;
42
43 case 'alpha' :
44 $orderby = 'a.title';
45 break;
46
47 case 'ralpha' :
48 $orderby = 'a.title DESC';
49 break;
50
51 case 'hits' :
52 $orderby = 'a.hits DESC';
53 break;
54
55 case 'rhits' :
56 $orderby = 'a.hits';
57 break;
58
59 case 'order' :
60 $orderby = 'a.ordering';
61 break;
62
63 case 'rorder' :
64 $orderby = 'a.ordering DESC';
65 break;
66
67 case 'author' :
68 $orderby = 'author';
69 break;
70
71 case 'rauthor' :
72 $orderby = 'author DESC';
73 break;
74
75 case 'front' :
76 $orderby = 'a.featured DESC, fp.ordering, ' . $queryDate . ' DESC ';
77 break;
78
79 case 'random' :
80 $orderby = JFactory::getDbo()->getQuery(true)->Rand();
81 break;
82
83 case 'vote' :
84 $orderby = 'a.id DESC ';
85
86 if (JPluginHelper::isEnabled('content', 'vote'))
87 {
88 $orderby = 'rating_count DESC ';
89 }
90 break;
91
92 case 'rvote' :
93 $orderby = 'a.id ASC ';
94
95 if (JPluginHelper::isEnabled('content', 'vote'))
96 {
97 $orderby = 'rating_count ASC ';
98 }
99 break;
100
101 case 'rank' :
102 $orderby = 'a.id DESC ';
103
104 if (JPluginHelper::isEnabled('content', 'vote'))
105 {
106 $orderby = 'rating DESC ';
107 }
108 break;
109
110 case 'rrank' :
111 $orderby = 'a.id ASC ';
112
113 if (JPluginHelper::isEnabled('content', 'vote'))
114 {
115 $orderby = 'rating ASC ';
116 }
117 break;
118
119 default :
120 $orderby = 'a.ordering';
121 break;
122 }
123
124 return $orderby;
125 }
126
127 /**
128 * Translate an order code to a field for primary category ordering.
129 *
130 * @param string $orderDate The ordering code.
131 *
132 * @return string The SQL field(s) to order by.
133 *
134 * @since 1.6
135 */
136 public static function getQueryDate($orderDate)
137 {
138 $db = JFactory::getDbo();
139
140 switch ($orderDate)
141 {
142 case 'modified' :
143 $queryDate = ' CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END';
144 break;
145
146 // Use created if publish_up is not set
147 case 'published' :
148 $queryDate = ' CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END ';
149 break;
150
151 case 'unpublished' :
152 $queryDate = ' CASE WHEN a.publish_down = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_down END ';
153 break;
154 case 'created' :
155 default :
156 $queryDate = ' a.created ';
157 break;
158 }
159
160 return $queryDate;
161 }
162
163 }
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 * Content Component Route Helper.
14 *
15 * @since 1.5
16 */
17 abstract class ContentCustomHelperRoute
18 {
19 /**
20 * Get the article route.
21 *
22 * @param integer $id The route of the content item.
23 * @param integer $catid The category ID.
24 * @param integer $language The language code.
25 * @param string $layout The layout value.
26 *
27 * @return string The article route.
28 *
29 * @since 1.5
30 */
31 public static function getArticleRoute($id, $catid = 0, $language = 0, $layout = null)
32 {
33 // Create the link
34 $link = 'index.php?option=com_content&view=article&id=' . $id;
35
36 if ((int) $catid > 1)
37 {
38 $link .= '&catid=' . $catid;
39 }
40
41 if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
42 {
43 $link .= '&lang=' . $language;
44 }
45
46 if ($layout)
47 {
48 $link .= '&layout=' . $layout;
49 }
50
51 return $link;
52 }
53
54 /**
55 * Get the category route.
56 *
57 * @param integer $catid The category ID.
58 * @param integer $language The language code.
59 * @param string $layout The layout value.
60 *
61 * @return string The article route.
62 *
63 * @since 1.5
64 */
65 public static function getCategoryRoute($catid, $language = 0, $layout = null)
66 {
67 if ($catid instanceof JCategoryNode)
68 {
69 $id = $catid->id;
70 }
71 else
72 {
73 $id = (int) $catid;
74 }
75
76 if ($id < 1)
77 {
78 return '';
79 }
80
81 $link = 'index.php?option=com_content&view=category&id=' . $id;
82
83 if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
84 {
85 $link .= '&lang=' . $language;
86 }
87
88 if ($layout)
89 {
90 $link .= '&layout=' . $layout;
91 }
92
93 return $link;
94 }
95
96 }
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 COM_CONTENT_CUSTOM_ARTICLE_HITS="Hits: %s"
7 COM_CONTENT_CUSTOM_ARTICLE_INFO="Details"
8 COM_CONTENT_CUSTOM_CATEGORY="Category: %s"
9 COM_CONTENT_CUSTOM_CREATED_DATE_ON="Created: %s"
10 COM_CONTENT_CUSTOM_LAST_UPDATED="Last Updated: %s"
11 COM_CONTENT_CUSTOM_MONTH="Month"
12 COM_CONTENT_CUSTOM_PARENT="Parent Category: %s"
13 COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="Published: %s"
14 COM_CONTENT_CUSTOM_WRITTEN_BY="Written by %s"
15 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
16 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
17 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
18 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
19 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="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 COM_CONTENT_CUSTOM_ARTICLE_HITS="参照数: %s"
7 COM_CONTENT_CUSTOM_ARTICLE_INFO="詳細"
8 COM_CONTENT_CUSTOM_CATEGORY="カテゴリ: %s"
9 COM_CONTENT_CUSTOM_CREATED_DATE_ON="作成日:%s"
10 COM_CONTENT_CUSTOM_LAST_UPDATED="最終更新日:%s"
11 COM_CONTENT_CUSTOM_MONTH="月"
12 COM_CONTENT_CUSTOM_PARENT="親カテゴリ: %s"
13 COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="公開日:%s"
14 COM_CONTENT_CUSTOM_WRITTEN_BY="投稿者: %s"
15 COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
16 COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
17 COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
18 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
19 COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 use Joomla\Utilities\ArrayHelper;
13
14 JLoader::register('ContentModelArticles', __DIR__ . '/articles.php');
15
16 /**
17 * Content Component Archive Model
18 *
19 * @since 1.5
20 */
21 class ContentModelArchive extends ContentModelArticles
22 {
23 /**
24 * Model context string.
25 *
26 * @var string
27 */
28 public $_context = 'com_content_custom.archive';
29
30 /**
31 * Method to auto-populate the model state.
32 *
33 * Note. Calling getState in this method will result in recursion.
34 *
35 * @param string $ordering The field to order on.
36 * @param string $direction The direction to order on.
37 *
38 * @return void
39 *
40 * @since 1.6
41 */
42 protected function populateState($ordering = null, $direction = null)
43 {
44 parent::populateState();
45
46 $app = JFactory::getApplication();
47
48 // Add archive properties
49 $params = $this->state->params;
50
51 // Filter on archived articles
52 $this->setState('filter.published', 1);
53
54 // Filter on month, year
55 $this->setState('filter.month', $app->input->getInt('month'));
56 $this->setState('filter.year', $app->input->getInt('year'));
57
58 // Optional filter text
59 $this->setState('list.filter', $app->input->getString('filter-search'));
60
61 // Get list limit
62 $itemid = $app->input->get('Itemid', 0, 'int');
63 $limit = $app->getUserStateFromRequest('com_content_custom.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
64 $this->setState('list.limit', $limit);
65
66 // Set the archive ordering
67 $articleOrderby = $params->get('orderby_sec', 'rdate');
68 $articleOrderDate = $params->get('order_date');
69
70 // No category ordering
71 $secondary = ContentCustomHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
72
73 $this->setState('list.ordering', $secondary . ', a.created DESC');
74 $this->setState('list.direction', '');
75 }
76
77 /**
78 * Get the master query for retrieving a list of articles subject to the model state.
79 *
80 * @return JDatabaseQuery
81 *
82 * @since 1.6
83 */
84 protected function getListQuery()
85 {
86 $params = $this->state->params;
87 $app = JFactory::getApplication('site');
88 $catids = ArrayHelper::toInteger($app->input->get('catid', array(), 'array'));
89 $catids = array_values(array_diff($catids, array(0)));
90 $articleOrderDate = $params->get('order_date');
91
92 // Create a new query object.
93 $query = parent::getListQuery();
94
95 // Add routing for archive
96 // Sqlsrv changes
97 $case_when = ' CASE WHEN ';
98 $case_when .= $query->charLength('a.alias', '!=', '0');
99 $case_when .= ' THEN ';
100 $a_id = $query->castAsChar('a.id');
101 $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
102 $case_when .= ' ELSE ';
103 $case_when .= $a_id . ' END as slug';
104
105 $query->select($case_when);
106
107 $case_when = ' CASE WHEN ';
108 $case_when .= $query->charLength('c.alias', '!=', '0');
109 $case_when .= ' THEN ';
110 $c_id = $query->castAsChar('c.id');
111 $case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
112 $case_when .= ' ELSE ';
113 $case_when .= $c_id . ' END as catslug';
114 $query->select($case_when);
115
116 // Filter on month, year
117 // First, get the date field
118 $queryDate = ContentCustomHelperQuery::getQueryDate($articleOrderDate);
119
120 if ($month = $this->getState('filter.month'))
121 {
122 $query->where($query->month($queryDate) . ' = ' . $month);
123 }
124
125 if ($year = $this->getState('filter.year'))
126 {
127 $query->where($query->year($queryDate) . ' = ' . $year);
128 }
129
130 if (count($catids) > 0)
131 {
132 $query->where('c.id IN (' . implode(', ', $catids) . ')');
133 }
134
135 return $query;
136 }
137
138 /**
139 * Method to get the archived article list
140 *
141 * @access public
142 * @return array
143 */
144 public function getData()
145 {
146 $app = JFactory::getApplication();
147
148 // Lets load the content if it doesn't already exist
149 if (empty($this->_data))
150 {
151 // Get the page/component configuration
152 $params = $app->getParams();
153
154 // Get the pagination request variables
155 $limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
156 $limitstart = $app->input->get('limitstart', 0, 'uint');
157
158 $query = $this->_buildQuery();
159
160 $this->_data = $this->_getList($query, $limitstart, $limit);
161 }
162
163 return $this->_data;
164 }
165
166 /**
167 * JModelLegacy override to add alternating value for $odd
168 *
169 * @param string $query The query.
170 * @param integer $limitstart Offset.
171 * @param integer $limit The number of records.
172 *
173 * @return array An array of results.
174 *
175 * @since 3.0.1
176 * @throws RuntimeException
177 */
178 protected function _getList($query, $limitstart=0, $limit=0)
179 {
180 $result = parent::_getList($query, $limitstart, $limit);
181
182 $odd = 1;
183
184 foreach ($result as $k => $row)
185 {
186 $result[$k]->odd = $odd;
187 $odd = 1 - $odd;
188 }
189
190 return $result;
191 }
192 }
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
13 JHtml::_('formbehavior.chosen', 'select');
14 JHtml::_('behavior.caption');
15 ?>
16 <div class="archive-custom<?php echo $this->pageclass_sfx; ?>">
17 <?php if ($this->params->get('show_page_heading')) : ?>
18 <div class="page-header">
19 <h1>
20 <?php echo $this->escape($this->params->get('page_heading')); ?>
21 </h1>
22 </div>
23 <?php endif; ?>
24 <?php echo $this->loadTemplate('items'); ?>
25 </div>
1 <?xml version="1.0" encoding="utf-8"?>
2 <metadata>
3 <layout title="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE" option="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION">
4 <help
5 key = "JHELP_MENUS_MENU_ITEM_ARTICLE_ARCHIVED"
6 />
7 <message>
8 <![CDATA[COM_CONTENT_CUSTOM_XML_DESCRIPTION]]>
9 </message>
10 </layout>
11
12 <!-- Add fields to the request variables for the layout. -->
13 <fields name="request">
14 <fieldset name="request"
15 addfieldpath="/administrator/components/com_categories/models/fields"
16 >
17 <field
18 name="catid"
19 type="category"
20 extension="com_content"
21 multiple="true"
22 size="5"
23 label="JCATEGORY"
24 description="JFIELD_CATEGORY_DESC"
25 >
26 <option value="">JOPTION_ALL_CATEGORIES</option>
27 </field>
28 </fieldset>
29 </fields>
30
31 <!-- Add fields to the parameters object for the layout. -->
32 <fields name="params">
33
34 <!-- Basic options. -->
35 <fieldset name="basic" label="JGLOBAL_ARCHIVE_OPTIONS"
36 >
37
38 <field
39 name="orderby_sec"
40 type="list"
41 label="JGLOBAL_ARTICLE_ORDER_LABEL"
42 description="JGLOBAL_ARTICLE_ORDER_DESC"
43 default="rdate"
44 >
45 <option value="date">JGLOBAL_OLDEST_FIRST</option>
46 <option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
47 <option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
48 <option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
49 <option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
50 <option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
51 <option value="hits">JGLOBAL_MOST_HITS</option>
52 <option value="rhits">JGLOBAL_LEAST_HITS</option>
53 <option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option>
54 <option value="vote" requires="vote">JGLOBAL_VOTES_DESC</option>
55 <option value="rvote" requires="vote">JGLOBAL_VOTES_ASC</option>
56 <option value="rank" requires="vote">JGLOBAL_RATINGS_DESC</option>
57 <option value="rrank" requires="vote">JGLOBAL_RATINGS_ASC</option>
58 </field>
59
60 <field
61 name="order_date"
62 type="list"
63 label="JGLOBAL_ORDERING_DATE_LABEL"
64 description="JGLOBAL_ORDERING_DATE_DESC"
65 default="published"
66 >
67 <option value="created">JGLOBAL_Created</option>
68 <option value="modified">JGLOBAL_Modified</option>
69 <option value="published">JPUBLISHED</option>
70 </field>
71
72 <field
73 name="display_num"
74 type="list"
75 label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
76 description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
77 default="5"
78 >
79 <option value="5">J5</option>
80 <option value="10">J10</option>
81 <option value="15">J15</option>
82 <option value="20">J20</option>
83 <option value="25">J25</option>
84 <option value="30">J30</option>
85 <option value="50">J50</option>
86 <option value="100">J100</option>
87 <option value="0">JALL</option>
88 </field>
89
90 <field
91 name="filter_field"
92 type="list"
93 label="JGLOBAL_FILTER_FIELD_LABEL"
94 description="JGLOBAL_FILTER_FIELD_DESC"
95 default=""
96 useglobal="true"
97 >
98 <option value="hide">JHIDE</option>
99 <option value="1">JSHOW</option>
100 </field>
101
102 <field
103 name="introtext_limit"
104 type="number"
105 label="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
106 description="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
107 default="1000"
108 />
109
110 </fieldset>
111
112 <!-- Articles options. -->
113 <fieldset name="articles"
114 label="COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL"
115 >
116
117 <field
118 name="show_intro"
119 type="list"
120 label="JGLOBAL_SHOW_INTRO_LABEL"
121 description="JGLOBAL_SHOW_INTRO_DESC"
122 class="chzn-color"
123 default="1"
124 >
125 <option value="0">JHIDE</option>
126 <option value="1">JSHOW</option>
127 </field>
128
129 <field
130 name="info_block_position"
131 type="list"
132 label="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL"
133 description="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC"
134 default=""
135 useglobal="true"
136 class="chzn-color"
137 >
138 <option value="use_article">COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
139 <option value="0">COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE</option>
140 <option value="1">COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW</option>
141 <option value="2">COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT</option>
142 </field>
143
144 <field
145 name="show_category"
146 type="list"
147 label="JGLOBAL_SHOW_CATEGORY_LABEL"
148 description="JGLOBAL_SHOW_CATEGORY_DESC"
149 useglobal="true"
150 class="chzn-color"
151 >
152 <option value="0">JHIDE</option>
153 <option value="1">JSHOW</option>
154 </field>
155
156 <field
157 name="link_category"
158 type="list"
159 label="JGLOBAL_LINK_CATEGORY_LABEL"
160 description="JGLOBAL_LINK_CATEGORY_DESC"
161 useglobal="true"
162 class="chzn-color"
163 >
164 <option value="0">JNO</option>
165 <option value="1">JYES</option>
166 </field>
167
168 <field
169 name="show_parent_category"
170 type="list"
171 label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
172 description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
173 useglobal="true"
174 >
175 <option value="0">JHIDE</option>
176 <option value="1">JSHOW</option>
177 </field>
178
179 <field
180 name="link_parent_category"
181 type="list"
182 label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
183 description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
184 useglobal="true"
185 >
186 <option value="0">JNO</option>
187 <option value="1">JYES</option>
188 </field>
189
190 <field
191 name="link_titles"
192 type="list"
193 label="JGLOBAL_LINKED_TITLES_LABEL"
194 description="JGLOBAL_LINKED_TITLES_DESC"
195 class="chzn-color"
196 default="1"
197 >
198 <option value="0">JNO</option>
199 <option value="1">JYES</option>
200 </field>
201
202 <field
203 name="show_author"
204 type="list"
205 label="JGLOBAL_SHOW_AUTHOR_LABEL"
206 description="JGLOBAL_SHOW_AUTHOR_DESC"
207 useglobal="true"
208 class="chzn-color"
209 >
210 <option value="0">JHIDE</option>
211 <option value="1">JSHOW</option>
212 </field>
213
214 <field
215 name="link_author"
216 type="list"
217 label="JGLOBAL_LINK_AUTHOR_LABEL"
218 description="JGLOBAL_LINK_AUTHOR_DESC"
219 useglobal="true"
220 >
221 <option value="0">JNO</option>
222 <option value="1">JYES</option>
223 </field>
224
225 <field
226 name="show_create_date"
227 type="list"
228 label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
229 description="JGLOBAL_SHOW_CREATE_DATE_DESC"
230 useglobal="true"
231 class="chzn-color"
232 >
233 <option value="0">JHIDE</option>
234 <option value="1">JSHOW</option>
235 </field>
236
237 <field
238 name="show_modify_date"
239 type="list"
240 label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
241 description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
242 useglobal="true"
243 class="chzn-color"
244 >
245 <option value="0">JHIDE</option>
246 <option value="1">JSHOW</option>
247 </field>
248
249 <field
250 name="show_publish_date"
251 type="list"
252 label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
253 description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
254 class="chzn-color"
255 default="1"
256 >
257 <option value="0">JHIDE</option>
258 <option value="1">JSHOW</option>
259 </field>
260
261 <field
262 name="show_hits"
263 type="list"
264 label="JGLOBAL_SHOW_HITS_LABEL"
265 description="JGLOBAL_SHOW_HITS_DESC"
266 useglobal="true"
267 class="chzn-color"
268 >
269 <option value="0">JHIDE</option>
270 <option value="1">JSHOW</option>
271 </field>
272 </fieldset>
273
274 </fields>
275 </metadata>
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_content_custom
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 JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
13 $params = $this->params;
14 ?>
15
16 <div id="archive-items">
17 <?php foreach ($this->items as $i => $item) : ?>
18 <?php $info = $item->params->get('info_block_position', 0); ?>
19 <div class="row<?php echo $i % 2; ?>" itemscope itemtype="https://schema.org/Article">
20 <div class="page-header">
21 <h2 itemprop="headline">
22 <?php if ($params->get('link_titles')) : ?>
23 <?php
24 $url = JRoute::_(ContentCustomHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
25 $url = "information/" . end(explode("/", $url));
26 ?>
27 <a href="<?php echo $url; ?>" itemprop="url">
28 <?php echo $this->escape($item->title); ?>
29 </a>
30 <?php else : ?>
31 <?php echo $this->escape($item->title); ?>
32 <?php endif; ?>
33 </h2>
34
35 <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
36 <?php echo $item->event->afterDisplayTitle; ?>
37
38 <?php if ($params->get('show_author') && !empty($item->author )) : ?>
39 <div class="createdby" itemprop="author" itemscope itemtype="https://schema.org/Person">
40 <?php $author = $item->created_by_alias ?: $item->author; ?>
41 <?php $author = '<span itemprop="name">' . $author . '</span>'; ?>
42 <?php if (!empty($item->contact_link) && $params->get('link_author') == true) : ?>
43 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', JHtml::_('link', $this->item->contact_link, $author, array('itemprop' => 'url'))); ?>
44 <?php else : ?>
45 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', $author); ?>
46 <?php endif; ?>
47 </div>
48 <?php endif; ?>
49 </div>
50 <?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
51 || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category')); ?>
52 <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
53 <div class="article-info muted">
54 <dl class="article-info">
55 <dt class="article-info-term">
56 <?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?>
57 </dt>
58
59 <?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
60 <dd>
61 <div class="parent-category-name">
62 <?php $title = $this->escape($item->parent_title); ?>
63 <?php if ($params->get('link_parent_category') && !empty($item->parent_slug)) : ?>
64 <?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
65 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
66 <?php else : ?>
67 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
68 <?php endif; ?>
69 </div>
70 </dd>
71 <?php endif; ?>
72 <?php if ($params->get('show_category')) : ?>
73 <dd>
74 <div class="category-name">
75 <?php $title = $this->escape($item->category_title); ?>
76 <?php if ($params->get('link_category') && $item->catslug) : ?>
77 <?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
78 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
79 <?php else : ?>
80 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
81 <?php endif; ?>
82 </div>
83 </dd>
84 <?php endif; ?>
85
86 <?php if ($params->get('show_publish_date')) : ?>
87 <dd>
88 <div class="published">
89 <span class="icon-calendar" aria-hidden="true"></span>
90 <time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
91 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
92 </time>
93 </div>
94 </dd>
95 <?php endif; ?>
96
97 <?php if ($info == 0) : ?>
98 <?php if ($params->get('show_modify_date')) : ?>
99 <dd>
100 <div class="modified">
101 <span class="icon-calendar" aria-hidden="true"></span>
102 <time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
103 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
104 </time>
105 </div>
106 </dd>
107 <?php endif; ?>
108 <?php if ($params->get('show_create_date')) : ?>
109 <dd>
110 <div class="create">
111 <span class="icon-calendar" aria-hidden="true"></span>
112 <time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
113 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC3'))); ?>
114 </time>
115 </div>
116 </dd>
117 <?php endif; ?>
118
119 <?php if ($params->get('show_hits')) : ?>
120 <dd>
121 <div class="hits">
122 <span class="icon-eye-open"></span>
123 <meta itemprop="interactionCount" content="UserPageVisits:<?php echo $item->hits; ?>" />
124 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
125 </div>
126 </dd>
127 <?php endif; ?>
128 <?php endif; ?>
129 </dl>
130 </div>
131 <?php endif; ?>
132
133 <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
134 <?php echo $item->event->beforeDisplayContent; ?>
135 <?php if ($params->get('show_intro')) : ?>
136 <div class="intro" itemprop="articleBody"> <?php echo JHtml::_('string.truncateComplex', $item->introtext, $params->get('introtext_limit')); ?> </div>
137 <?php endif; ?>
138
139 <?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
140 <div class="article-info muted">
141 <dl class="article-info">
142 <dt class="article-info-term"><?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?></dt>
143
144 <?php if ($info == 1) : ?>
145 <?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
146 <dd>
147 <div class="parent-category-name">
148 <?php $title = $this->escape($item->parent_title); ?>
149 <?php if ($params->get('link_parent_category') && $item->parent_slug) : ?>
150 <?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
151 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
152 <?php else : ?>
153 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
154 <?php endif; ?>
155 </div>
156 </dd>
157 <?php endif; ?>
158 <?php if ($params->get('show_category')) : ?>
159 <dd>
160 <div class="category-name">
161 <?php $title = $this->escape($item->category_title); ?>
162 <?php if ($params->get('link_category') && $item->catslug) : ?>
163 <?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
164 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
165 <?php else : ?>
166 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
167 <?php endif; ?>
168 </div>
169 </dd>
170 <?php endif; ?>
171 <?php if ($params->get('show_publish_date')) : ?>
172 <dd>
173 <div class="published">
174 <span class="icon-calendar" aria-hidden="true"></span>
175 <time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
176 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
177 </time>
178 </div>
179 </dd>
180 <?php endif; ?>
181 <?php endif; ?>
182
183 <?php if ($params->get('show_create_date')) : ?>
184 <dd>
185 <div class="create">
186 <span class="icon-calendar" aria-hidden="true"></span>
187 <time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
188 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
189 </time>
190 </div>
191 </dd>
192 <?php endif; ?>
193 <?php if ($params->get('show_modify_date')) : ?>
194 <dd>
195 <div class="modified">
196 <span class="icon-calendar" aria-hidden="true"></span>
197 <time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
198 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
199 </time>
200 </div>
201 </dd>
202 <?php endif; ?>
203 <?php if ($params->get('show_hits')) : ?>
204 <dd>
205 <div class="hits">
206 <span class="icon-eye-open"></span>
207 <meta content="UserPageVisits:<?php echo $item->hits; ?>" itemprop="interactionCount" />
208 <?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
209 </div>
210 </dd>
211 <?php endif; ?>
212 </dl>
213 </div>
214 <?php endif; ?>
215 <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
216 <?php echo $item->event->afterDisplayContent; ?>
217 </div>
218 <?php endforeach; ?>
219 </div>
220 <div class="pagination">
221 <p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
222 <?php echo $this->pagination->getPagesLinks(); ?>
223 </div>
1 <?php
2 /**
3 * @package Joomla.Site
4 * @subpackage com_conten_custom
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 * HTML View class for the Content component
14 *
15 * @since 1.5
16 */
17 class ContentViewArchive extends JViewLegacy
18 {
19 protected $state = null;
20
21 protected $item = null;
22
23 protected $items = null;
24
25 protected $pagination = null;
26
27 /**
28 * Execute and display a template script.
29 *
30 * @param string $tpl The name of the template file to parse; automatically searches through the template paths.
31 *
32 * @return mixed A string if successful, otherwise an Error object.
33 */
34 public function display($tpl = null)
35 {
36 $user = JFactory::getUser();
37 $state = $this->get('State');
38 $items = $this->get('Items');
39 $pagination = $this->get('Pagination');
40
41 // Flag indicates to not add limitstart=0 to URL
42 $pagination->hideEmptyLimitstart = true;
43
44 // Get the page/component configuration
45 $params = &$state->params;
46
47 JPluginHelper::importPlugin('content_custom');
48
49 foreach ($items as $item)
50 {
51 $item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid;
52 $item->parent_slug = $item->parent_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
53
54 // No link for ROOT category
55 if ($item->parent_alias === 'root')
56 {
57 $item->parent_slug = null;
58 }
59
60 $item->event = new stdClass;
61
62 $dispatcher = JEventDispatcher::getInstance();
63
64 // Old plugins: Ensure that text property is available
65 if (!isset($item->text))
66 {
67 $item->text = $item->introtext;
68 }
69
70 $dispatcher->trigger('onContentPrepare', array ('com_content_custom.archive', &$item, &$item->params, 0));
71
72 // Old plugins: Use processed text as introtext
73 $item->introtext = $item->text;
74
75 $results = $dispatcher->trigger('onContentAfterTitle', array('com_content_custom.archive', &$item, &$item->params, 0));
76 $item->event->afterDisplayTitle = trim(implode("\n", $results));
77
78 $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
79 $item->event->beforeDisplayContent = trim(implode("\n", $results));
80
81 $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
82 $item->event->afterDisplayContent = trim(implode("\n", $results));
83 }
84
85 $this->filter = $state->get('list.filter');
86 $this->items = &$items;
87 $this->params = &$params;
88 $this->user = &$user;
89 $this->pagination = &$pagination;
90 $this->pagination->setAdditionalUrlParam('month', $state->get('filter.month'));
91 $this->pagination->setAdditionalUrlParam('year', $state->get('filter.year'));
92
93 $this->_prepareDocument();
94
95 parent::display($tpl);
96 }
97
98 /**
99 * Prepares the document
100 *
101 * @return void
102 */
103 protected function _prepareDocument()
104 {
105 $app = JFactory::getApplication();
106 $menus = $app->getMenu();
107 $title = null;
108
109 // Because the application sets a default page title,
110 // we need to get it from the menu item itself
111 $menu = $menus->getActive();
112
113 if ($menu)
114 {
115 $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
116 }
117 else
118 {
119 $this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
120 }
121
122 $title = $this->params->get('page_title', '');
123
124 if (empty($title))
125 {
126 $title = $app->get('sitename');
127 }
128 elseif ($app->get('sitename_pagetitles', 0) == 1)
129 {
130 $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
131 }
132 elseif ($app->get('sitename_pagetitles', 0) == 2)
133 {
134 $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
135 }
136
137 $this->document->setTitle($title);
138
139 if ($this->params->get('menu-meta_description'))
140 {
141 $this->document->setDescription($this->params->get('menu-meta_description'));
142 }
143
144 if ($this->params->get('menu-meta_keywords'))
145 {
146 $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
147 }
148
149 if ($this->params->get('robots'))
150 {
151 $this->document->setMetadata('robots', $this->params->get('robots'));
152 }
153 }
154 }
1 #月次アーカイブ用モジュール
2 公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。
3 管理画面よりインストールする必要があります。
4
5 ##インストール手順
6 ####インストールはzip形式のファイルで行わなければいけないため、mod_articles_archive_customフォルダをzipに圧縮した後、以下の手順でインストールする必要があります。
7 1 管理画面ログイン
8 2 エクステンション配下の管理を選択
9 3 インストール配下のパッケージファイルのアップロードを選択
10 4 ファイルを選択しアップロード
...\ 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_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 <?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 $lists[$i]->text = JText::sprintf($createdDateCal);
83
84 $i++;
85 }
86
87 return $lists;
88 }
89 }
...\ 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 // 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; ?>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!