c41f7a31 by TaishiTokudome

コンフリクト解消

2 parents 2156a3a9 ebd2d78b
Showing 66 changed files with 3630 additions and 152 deletions
......@@ -8,7 +8,7 @@ images
php5.6-back
configuration.php
.htpasswd
.ht*
# TODO 環境整備後削除
god-hand
......
# AddHandler x-httpd-php5619 .php
Options +SymLinksIfOwnerMatch
Options -Indexes
RewriteEngine on
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root home page
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects
##
# Uncomment the following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##
# RewriteBase /
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
#20200122 - IPアクセスリダイレクトnozaki
RewriteBase /
RewriteCond %{HTTP_HOST} ^18\.178\.92\.128$ [NC]
RewriteRule .* https://www.nifs-k.ac.jp%{REQUEST_URI} [R=302,L]
<IfModule mod_siteguard.c>
SiteGuard_User_ExcludeSig ip(202.95.45.168)
SiteGuard_User_ExcludeSig ip(202.24.160.0/21)
SiteGuard_User_ExcludeSig ip(210.137.6.192/26)
SiteGuard_User_ExcludeSig ip(210.237.39.72)
SiteGuard_User_ExcludeSig ip(210.237.36.185)
SiteGuard_User_ExcludeSig ip(18.178.92.128)
</IfModule>
# AddHandler x-httpd-php5619 .php
Options +SymLinksIfOwnerMatch
Options -Indexes
RewriteEngine on
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root home page
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects
##
# Uncomment the following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##
# RewriteBase /
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
#20200122 - IPアクセスリダイレクトnozaki
RewriteBase /
RewriteCond %{HTTP_HOST} ^18\.178\.92\.128$ [NC]
RewriteRule .* https://www.nifs-k.ac.jp%{REQUEST_URI} [R=302,L]
# 20200809 gitignore アクセス禁止
RedirectMatch 404 /\.git
<IfModule mod_siteguard.c>
SiteGuard_User_ExcludeSig ip(202.95.45.168)
SiteGuard_User_ExcludeSig ip(202.24.160.0/21)
SiteGuard_User_ExcludeSig ip(210.137.6.192/26)
SiteGuard_User_ExcludeSig ip(210.237.39.72)
SiteGuard_User_ExcludeSig ip(210.237.36.185)
SiteGuard_User_ExcludeSig ip(18.178.92.128)
</IfModule>
......
......@@ -6,6 +6,7 @@
・キャッシュ
・ログ
・アップロードファイル
・htaccess
詳しくは.gitignoreを参照
### 開発環境
......@@ -14,3 +15,12 @@ https://project.lilli.co.jp/oki/kanoya-univercity-docker
## DB/アップロードファイルのバックアップについて
ec2-uesrのホームディレクトリに毎週日曜に1度だけ取るようにしてます。
~/backup.sh をcron実行しています。
## インストールを必要とするモジュール、コンポーネントについて
srcディレクトリにて、インストールして追加したモジュール、コンポーネントのソースコードを管理しています。
追加したモジュール、コンポーネントについての詳細は各モジュール、コンポーネントディレクトリに有るREADME.mdをご覧ください。
Joomlaのアップデートをした際に、アップデートの内容によっては追加したモジュール、コンポーネントが正常に動作しなくなる場合があります。
その際は、適宜、モジュール、コンポーネントを修正してください。
再度、モジュール、コンポーネントをインストールする場合は、それぞれのREADMEに記述してある手順でインストールしてください。
\ No newline at end of file
......
<?php
echo "<p>カスタムアーカイブコンポーネントです。</p>";
echo "\n";
echo "<P>このページから設定する項目はありません。</P>";
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>COM_CONTENT_CUSTOM</name>
<author>T.Tokudome</author>
<creationDate>July 2020</creationDate>
<copyright></copyright>
<license></license>
<authorEmail>tokudome@lilli.co.jp</authorEmail>
<authorUrl></authorUrl>
<version>0.0.1</version>
<description>COM_CONTENT_CUSTOM_XML_DESCRIPTION</description>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<files folder="site">
<filename>index.html</filename>
<filename>content_custom.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>helpers</folder>
<folder>models</folder>
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_content_custom.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
</languages>
<administration>
<menu link='index.php?option=com_content_custom'>カスタムアーカイブ</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>content_custom.php</filename>
<folder>sql</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_content_custom.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
<language tag="en-GB">language/en-GB.com_content_custom.sys.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.sys.ini</language>
</languages>
</administration>
</extension>
\ 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
COM_CONTENT_CUSTOM="archive_custom_component"
COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="Position of Article Info"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
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."
COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="Use Article Settings"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="Default"
; 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
COM_CONTENT_CUSTOM="archive_custom_component"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="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
COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="オプション"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="記事情報の位置"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC="記事情報のブロックをテキストの上か下に追加します。または1つは上、その他は下へ2つのブロックに分けます。"
COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="記事設定の使用"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ 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
COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JLoader::register('ContentCustomHelperRoute', JPATH_SITE . '/components/com_content_custom/helpers/route.php');
JLoader::register('ContentCustomHelperQuery', JPATH_SITE . '/components/com_content_custom/helpers/query.php');
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$controller = JControllerLegacy::getInstance('Content');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
use Joomla\CMS\Component\ComponentHelper;
/**
* Content Component Controller
*
* @since 1.5
*/
class ContentController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*
* @since 3.0.1
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Article frontpage Editor pagebreak proxying:
if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
{
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
// Article frontpage Editor article proxying:
elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true));
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$cachable = true;
/**
* Set the default view name and format from the Request.
* Note we are using a_id to avoid collisions with the router and the return page.
* Frontend is a bit messier than the backend.
*/
$id = $this->input->getInt('a_id');
$vName = $this->input->getCmd('view', 'categories');
$this->input->set('view', $vName);
$user = JFactory::getUser();
if ($user->get('id')
|| ($this->input->getMethod() === 'POST'
&& (($vName === 'category' && $this->input->get('layout') !== 'blog') || $vName === 'archive' )))
{
$cachable = false;
}
$safeurlparams = array(
'catid' => 'INT',
'id' => 'INT',
'cid' => 'ARRAY',
'year' => 'INT',
'month' => 'INT',
'limit' => 'UINT',
'limitstart' => 'UINT',
'showall' => 'INT',
'return' => 'BASE64',
'filter' => 'STRING',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING',
'print' => 'BOOLEAN',
'lang' => 'CMD',
'Itemid' => 'INT');
parent::display($cachable, $safeurlparams);
return $this;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
/**
* Content Component Query Helper
*
* @since 1.5
*/
class ContentCustomHelperQuery
{
/**
* Translate an order code to a field for secondary category ordering.
*
* @param string $orderby The ordering code.
* @param string $orderDate The ordering code for the date.
*
* @return string The SQL field(s) to order by.
*
* @since 1.5
*/
public static function orderbySecondary($orderby, $orderDate = 'created')
{
$queryDate = self::getQueryDate($orderDate);
switch ($orderby)
{
case 'date' :
$orderby = $queryDate;
break;
case 'rdate' :
$orderby = $queryDate . ' DESC ';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits DESC';
break;
case 'rhits' :
$orderby = 'a.hits';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'rorder' :
$orderby = 'a.ordering DESC';
break;
case 'author' :
$orderby = 'author';
break;
case 'rauthor' :
$orderby = 'author DESC';
break;
case 'front' :
$orderby = 'a.featured DESC, fp.ordering, ' . $queryDate . ' DESC ';
break;
case 'random' :
$orderby = JFactory::getDbo()->getQuery(true)->Rand();
break;
case 'vote' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count DESC ';
}
break;
case 'rvote' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count ASC ';
}
break;
case 'rank' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating DESC ';
}
break;
case 'rrank' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating ASC ';
}
break;
default :
$orderby = 'a.ordering';
break;
}
return $orderby;
}
/**
* Translate an order code to a field for primary category ordering.
*
* @param string $orderDate The ordering code.
*
* @return string The SQL field(s) to order by.
*
* @since 1.6
*/
public static function getQueryDate($orderDate)
{
$db = JFactory::getDbo();
switch ($orderDate)
{
case 'modified' :
$queryDate = ' CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END';
break;
// Use created if publish_up is not set
case 'published' :
$queryDate = ' CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END ';
break;
case 'unpublished' :
$queryDate = ' CASE WHEN a.publish_down = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_down END ';
break;
case 'created' :
default :
$queryDate = ' a.created ';
break;
}
return $queryDate;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
/**
* Content Component Route Helper.
*
* @since 1.5
*/
abstract class ContentCustomHelperRoute
{
/**
* Get the article route.
*
* @param integer $id The route of the content item.
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getArticleRoute($id, $catid = 0, $language = 0, $layout = null)
{
// Create the link
$link = 'index.php?option=com_content&view=article&id=' . $id;
if ((int) $catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
/**
* Get the category route.
*
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0, $layout = null)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
return '';
}
$link = 'index.php?option=com_content&view=category&id=' . $id;
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
use Joomla\Utilities\ArrayHelper;
JLoader::register('ContentModelArticles', __DIR__ . '/articles.php');
/**
* Content Component Archive Model
*
* @since 1.5
*/
class ContentModelArchive extends ContentModelArticles
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_content_custom.archive';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState();
$app = JFactory::getApplication();
// Add archive properties
$params = $this->state->params;
// Filter on archived articles
$this->setState('filter.published', 1);
// Filter on month, year
$this->setState('filter.month', $app->input->getInt('month'));
$this->setState('filter.year', $app->input->getInt('year'));
// Optional filter text
$this->setState('list.filter', $app->input->getString('filter-search'));
// Get list limit
$itemid = $app->input->get('Itemid', 0, 'int');
$limit = $app->getUserStateFromRequest('com_content_custom.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
$this->setState('list.limit', $limit);
// Set the archive ordering
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
// No category ordering
$secondary = ContentCustomHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
$this->setState('list.ordering', $secondary . ', a.created DESC');
$this->setState('list.direction', '');
}
/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
$params = $this->state->params;
$app = JFactory::getApplication('site');
$catids = ArrayHelper::toInteger($app->input->get('catid', array(), 'array'));
$catids = array_values(array_diff($catids, array(0)));
$articleOrderDate = $params->get('order_date');
// Create a new query object.
$query = parent::getListQuery();
// Add routing for archive
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$query->select($case_when);
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('c.alias', '!=', '0');
$case_when .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $c_id . ' END as catslug';
$query->select($case_when);
// Filter on month, year
// First, get the date field
$queryDate = ContentCustomHelperQuery::getQueryDate($articleOrderDate);
if ($month = $this->getState('filter.month'))
{
$query->where($query->month($queryDate) . ' = ' . $month);
}
if ($year = $this->getState('filter.year'))
{
$query->where($query->year($queryDate) . ' = ' . $year);
}
if (count($catids) > 0)
{
$query->where('c.id IN (' . implode(', ', $catids) . ')');
}
return $query;
}
/**
* Method to get the archived article list
*
* @access public
* @return array
*/
public function getData()
{
$app = JFactory::getApplication();
// Lets load the content if it doesn't already exist
if (empty($this->_data))
{
// Get the page/component configuration
$params = $app->getParams();
// Get the pagination request variables
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0, 'uint');
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $limitstart, $limit);
}
return $this->_data;
}
/**
* JModelLegacy override to add alternating value for $odd
*
* @param string $query The query.
* @param integer $limitstart Offset.
* @param integer $limit The number of records.
*
* @return array An array of results.
*
* @since 3.0.1
* @throws RuntimeException
*/
protected function _getList($query, $limitstart=0, $limit=0)
{
$result = parent::_getList($query, $limitstart, $limit);
$odd = 1;
foreach ($result as $k => $row)
{
$result[$k]->odd = $odd;
$odd = 1 - $odd;
}
return $result;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.caption');
?>
<div class="archive-custom<?php echo $this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
</div>
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE" option="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_ARCHIVED"
/>
<message>
<![CDATA[COM_CONTENT_CUSTOM_XML_DESCRIPTION]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="catid"
type="category"
extension="com_content"
multiple="true"
size="5"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic" label="JGLOBAL_ARCHIVE_OPTIONS"
>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
default="rdate"
>
<option value="date">JGLOBAL_OLDEST_FIRST</option>
<option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option>
<option value="vote" requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote" requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank" requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank" requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
default="published"
>
<option value="created">JGLOBAL_Created</option>
<option value="modified">JGLOBAL_Modified</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="display_num"
type="list"
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
default="5"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="introtext_limit"
type="number"
label="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
description="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
default="1000"
/>
</fieldset>
<!-- Articles options. -->
<fieldset name="articles"
label="COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL"
>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
class="chzn-color"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="use_article">COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE</option>
<option value="1">COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW</option>
<option value="2">COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
class="chzn-color"
default="1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
class="chzn-color"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$params = $this->params;
?>
<div id="archive-items">
<?php foreach ($this->items as $i => $item) : ?>
<?php $info = $item->params->get('info_block_position', 0); ?>
<div class="row<?php echo $i % 2; ?>" itemscope itemtype="https://schema.org/Article">
<div class="page-header">
<h2 itemprop="headline">
<?php if ($params->get('link_titles')) : ?>
<?php
$url = JRoute::_(ContentCustomHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
$url = "information/" . end(explode("/", $url));
?>
<a href="<?php echo $url; ?>" itemprop="url">
<?php echo $this->escape($item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</h2>
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php if ($params->get('show_author') && !empty($item->author )) : ?>
<div class="createdby" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?php $author = $item->created_by_alias ?: $item->author; ?>
<?php $author = '<span itemprop="name">' . $author . '</span>'; ?>
<?php if (!empty($item->contact_link) && $params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', JHtml::_('link', $this->item->contact_link, $author, array('itemprop' => 'url'))); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', $author); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category')); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category') && !empty($item->parent_slug)) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') && $item->catslug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($info == 0) : ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta itemprop="interactionCount" content="UserPageVisits:<?php echo $item->hits; ?>" />
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if ($params->get('show_intro')) : ?>
<div class="intro" itemprop="articleBody"> <?php echo JHtml::_('string.truncateComplex', $item->introtext, $params->get('introtext_limit')); ?> </div>
<?php endif; ?>
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term"><?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?></dt>
<?php if ($info == 1) : ?>
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category') && $item->parent_slug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') && $item->catslug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta content="UserPageVisits:<?php echo $item->hits; ?>" itemprop="interactionCount" />
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
</div>
</dd>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
<?php echo $item->event->afterDisplayContent; ?>
</div>
<?php endforeach; ?>
</div>
<div class="pagination">
<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php
/**
* @package Joomla.Site
* @subpackage com_conten_custom
*
* @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;
/**
* HTML View class for the Content component
*
* @since 1.5
*/
class ContentViewArchive extends JViewLegacy
{
protected $state = null;
protected $item = null;
protected $items = null;
protected $pagination = null;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$state = $this->get('State');
$items = $this->get('Items');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Get the page/component configuration
$params = &$state->params;
JPluginHelper::importPlugin('content_custom');
foreach ($items as $item)
{
$item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->parent_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
$item->event = new stdClass;
$dispatcher = JEventDispatcher::getInstance();
// Old plugins: Ensure that text property is available
if (!isset($item->text))
{
$item->text = $item->introtext;
}
$dispatcher->trigger('onContentPrepare', array ('com_content_custom.archive', &$item, &$item->params, 0));
// Old plugins: Use processed text as introtext
$item->introtext = $item->text;
$results = $dispatcher->trigger('onContentAfterTitle', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->afterDisplayContent = trim(implode("\n", $results));
}
$this->filter = $state->get('list.filter');
$this->items = &$items;
$this->params = &$params;
$this->user = &$user;
$this->pagination = &$pagination;
$this->pagination->setAdditionalUrlParam('month', $state->get('filter.month'));
$this->pagination->setAdditionalUrlParam('year', $state->get('filter.year'));
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
}
}
; 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
COM_CONTENT_CUSTOM_ARTICLE_HITS="Hits: %s"
COM_CONTENT_CUSTOM_ARTICLE_INFO="Details"
COM_CONTENT_CUSTOM_CATEGORY="Category: %s"
COM_CONTENT_CUSTOM_CREATED_DATE_ON="Created: %s"
COM_CONTENT_CUSTOM_LAST_UPDATED="Last Updated: %s"
COM_CONTENT_CUSTOM_MONTH="Month"
COM_CONTENT_CUSTOM_PARENT="Parent Category: %s"
COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="Published: %s"
COM_CONTENT_CUSTOM_WRITTEN_BY="Written by %s"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="Default"
\ 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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="InformationArticles - Archived - custom"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="# of Months"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="The number of months to display (the default is 10)."
MOD_INFORMATION_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_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="InformationArticles - Archived - custom"
MOD_INFORMATION_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_INFORMATION_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
COM_CONTENT_CUSTOM_ARTICLE_HITS="参照数: %s"
COM_CONTENT_CUSTOM_ARTICLE_INFO="詳細"
COM_CONTENT_CUSTOM_CATEGORY="カテゴリ: %s"
COM_CONTENT_CUSTOM_CREATED_DATE_ON="作成日:%s"
COM_CONTENT_CUSTOM_LAST_UPDATED="最終更新日:%s"
COM_CONTENT_CUSTOM_MONTH="月"
COM_CONTENT_CUSTOM_PARENT="親カテゴリ: %s"
COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="公開日:%s"
COM_CONTENT_CUSTOM_WRITTEN_BY="投稿者: %s"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ 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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="カスタムインフォメーションアーカイブ(モジュール)"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="表示月数"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="表示する月数(標準は10)です。"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="カスタムインフォメーションアーカイブ(モジュール)"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="標準"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_information_articles_archive_custom
*
* @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_information_articles_archive_custom
*
* @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;
$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;
}
}
\ 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;
// 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_information_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_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION</description>
<files>
<filename module="mod_information_articles_archive_custom">mod_information_articles_archive_custom.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_information_articles_archive_custom.ini</language>
<language tag="en-GB">en-GB.mod_information_articles_archive_custom.sys.ini</language>
<language tag="ja-JP">ja-JP.mod_information_articles_archive_custom.ini</language>
<language tag="ja-JP">ja-JP.mod_information_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL"
description="MOD_INFORMATION_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_information_articles_archive_custom
*
* @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; ?>
# インフォメーション用月次アーカイブモジュール
公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。
インストールしていない場合は、管理画面よりインストールする必要があります。
## このコンポーネントは、インフォメーションカテゴリーに属する記事専用の月次アーカイブモジュールです。
インフォメーション(メニュー)の子メニューのサイドバーで表示した際に正しいリンクが生成される様に、83行目でリンクを修正する処理を追加しています
### インフォメーションカテゴリー以外のカテゴリーに属する記事の月次アーカイブを作成したい場合は以下の手順が必要です。
#### 手順2,3をせずにインストールしてしまうと、インストーラーが既存のモジュールを上書きしてしまい、サイトに不具合が発生する可能性があるので必ず実行してください。
[Joomla公式のモジュール作成チュートリアルです。参考にしてください。](https://docs.joomla.org/J3.x:Creating_a_simple_module/Developing_a_Basic_Module)
1. mod_information_articles_archive_custom/をコピーし、src/mod配下におきます。
2. mod_information_articles_archive_customを含む配下のディレクトリ名とファイル名を、新規に月次モジュールを設置するカテゴリーに準じたものに変更します。例:mod_category_articles_archive_custom
3. mod_information_articles_archive_custom.xmlで、インストーラーがインストールするディレクトリ名とファイル名を指定しているので、手順1で変更したディレクトリ名、ファイル名を指定する様に修正します。
4. en-GBから始まる二つのファイルと、ja-JPから始まる二つのファイルで、モジュール内で使用する定数を定義しているので、ファイルを編集し新規に月次モジュールを設置するカテゴリーに準じたものに変更します。
例:MOD_CATEGORY_ARTICLES_ARCHIVE_CUSTOM="カスタム(カテゴリー名)アーカイブ(モジュール)"
5. 手順4で定数名を変更したので、それぞれの定数が呼び出されている箇所も、変更した定数名が呼び出される様に修正します。
6. README下部にあるインストール手順にしたがってインストールをします。
## インストール手順
1. 管理画面ログイン
2. エクステンション配下の管理を選択
3. (フォルダからインストール)を選択
4. フォームにインストールするモジュールまたは、コンポーネントのフォルダを指定(例:/var/www/html/src/com/com_hoge)
5. チェックしてインストール
\ No newline at end of file
<?php
echo "<p>カスタムアーカイブコンポーネントです。</p>";
echo "\n";
echo "<P>このページから設定する項目はありません。</P>";
\ 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
COM_CONTENT_CUSTOM="archive_custom_component"
COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="Options"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="Position of Article Info"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
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."
COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="Use Article Settings"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="Default"
; 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
COM_CONTENT_CUSTOM="archive_custom_component"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="It is a component that narrows down articles posted in the past by category and displays a monthly archive."
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="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
COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL="オプション"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL="記事情報の位置"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC="記事情報のブロックをテキストの上か下に追加します。または1つは上、その他は下へ2つのブロックに分けます。"
COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS="記事設定の使用"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ 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
COM_CONTENT_CUSTOM="カスタムアーカイブ(コンポーネント)"
COM_CONTENT_CUSTOM_XML_DESCRIPTION="過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>COM_CONTENT_CUSTOM</name>
<author>T.Tokudome</author>
<creationDate>July 2020</creationDate>
<copyright></copyright>
<license></license>
<authorEmail>tokudome@lilli.co.jp</authorEmail>
<authorUrl></authorUrl>
<version>0.0.1</version>
<description>COM_CONTENT_CUSTOM_XML_DESCRIPTION</description>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>
<files folder="site">
<filename>index.html</filename>
<filename>content_custom.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
<folder>helpers</folder>
<folder>models</folder>
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_content_custom.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
</languages>
<administration>
<menu link='index.php?option=com_content_custom'>カスタムアーカイブ</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>content_custom.php</filename>
<folder>sql</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_content_custom.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.ini</language>
<language tag="en-GB">language/en-GB.com_content_custom.sys.ini</language>
<language tag="ja-JP">language/ja-JP.com_content_custom.sys.ini</language>
</languages>
</administration>
</extension>
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JLoader::register('ContentCustomHelperRoute', JPATH_SITE . '/components/com_content_custom/helpers/route.php');
JLoader::register('ContentCustomHelperQuery', JPATH_SITE . '/components/com_content_custom/helpers/query.php');
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$controller = JControllerLegacy::getInstance('Content');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
use Joomla\CMS\Component\ComponentHelper;
/**
* Content Component Controller
*
* @since 1.5
*/
class ContentController extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*
* @since 3.0.1
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
// Article frontpage Editor pagebreak proxying:
if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
{
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
// Article frontpage Editor article proxying:
elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true));
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}
parent::__construct($config);
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$cachable = true;
/**
* Set the default view name and format from the Request.
* Note we are using a_id to avoid collisions with the router and the return page.
* Frontend is a bit messier than the backend.
*/
$id = $this->input->getInt('a_id');
$vName = $this->input->getCmd('view', 'categories');
$this->input->set('view', $vName);
$user = JFactory::getUser();
if ($user->get('id')
|| ($this->input->getMethod() === 'POST'
&& (($vName === 'category' && $this->input->get('layout') !== 'blog') || $vName === 'archive' )))
{
$cachable = false;
}
$safeurlparams = array(
'catid' => 'INT',
'id' => 'INT',
'cid' => 'ARRAY',
'year' => 'INT',
'month' => 'INT',
'limit' => 'UINT',
'limitstart' => 'UINT',
'showall' => 'INT',
'return' => 'BASE64',
'filter' => 'STRING',
'filter_order' => 'CMD',
'filter_order_Dir' => 'CMD',
'filter-search' => 'STRING',
'print' => 'BOOLEAN',
'lang' => 'CMD',
'Itemid' => 'INT');
parent::display($cachable, $safeurlparams);
return $this;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
/**
* Content Component Query Helper
*
* @since 1.5
*/
class ContentCustomHelperQuery
{
/**
* Translate an order code to a field for secondary category ordering.
*
* @param string $orderby The ordering code.
* @param string $orderDate The ordering code for the date.
*
* @return string The SQL field(s) to order by.
*
* @since 1.5
*/
public static function orderbySecondary($orderby, $orderDate = 'created')
{
$queryDate = self::getQueryDate($orderDate);
switch ($orderby)
{
case 'date' :
$orderby = $queryDate;
break;
case 'rdate' :
$orderby = $queryDate . ' DESC ';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits DESC';
break;
case 'rhits' :
$orderby = 'a.hits';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'rorder' :
$orderby = 'a.ordering DESC';
break;
case 'author' :
$orderby = 'author';
break;
case 'rauthor' :
$orderby = 'author DESC';
break;
case 'front' :
$orderby = 'a.featured DESC, fp.ordering, ' . $queryDate . ' DESC ';
break;
case 'random' :
$orderby = JFactory::getDbo()->getQuery(true)->Rand();
break;
case 'vote' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count DESC ';
}
break;
case 'rvote' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating_count ASC ';
}
break;
case 'rank' :
$orderby = 'a.id DESC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating DESC ';
}
break;
case 'rrank' :
$orderby = 'a.id ASC ';
if (JPluginHelper::isEnabled('content', 'vote'))
{
$orderby = 'rating ASC ';
}
break;
default :
$orderby = 'a.ordering';
break;
}
return $orderby;
}
/**
* Translate an order code to a field for primary category ordering.
*
* @param string $orderDate The ordering code.
*
* @return string The SQL field(s) to order by.
*
* @since 1.6
*/
public static function getQueryDate($orderDate)
{
$db = JFactory::getDbo();
switch ($orderDate)
{
case 'modified' :
$queryDate = ' CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END';
break;
// Use created if publish_up is not set
case 'published' :
$queryDate = ' CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END ';
break;
case 'unpublished' :
$queryDate = ' CASE WHEN a.publish_down = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_down END ';
break;
case 'created' :
default :
$queryDate = ' a.created ';
break;
}
return $queryDate;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
/**
* Content Component Route Helper.
*
* @since 1.5
*/
abstract class ContentCustomHelperRoute
{
/**
* Get the article route.
*
* @param integer $id The route of the content item.
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getArticleRoute($id, $catid = 0, $language = 0, $layout = null)
{
// Create the link
$link = 'index.php?option=com_content&view=article&id=' . $id;
if ((int) $catid > 1)
{
$link .= '&catid=' . $catid;
}
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
/**
* Get the category route.
*
* @param integer $catid The category ID.
* @param integer $language The language code.
* @param string $layout The layout value.
*
* @return string The article route.
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0, $layout = null)
{
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
}
else
{
$id = (int) $catid;
}
if ($id < 1)
{
return '';
}
$link = 'index.php?option=com_content&view=category&id=' . $id;
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
if ($layout)
{
$link .= '&layout=' . $layout;
}
return $link;
}
}
; 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
COM_CONTENT_CUSTOM_ARTICLE_HITS="Hits: %s"
COM_CONTENT_CUSTOM_ARTICLE_INFO="Details"
COM_CONTENT_CUSTOM_CATEGORY="Category: %s"
COM_CONTENT_CUSTOM_CREATED_DATE_ON="Created: %s"
COM_CONTENT_CUSTOM_LAST_UPDATED="Last Updated: %s"
COM_CONTENT_CUSTOM_MONTH="Month"
COM_CONTENT_CUSTOM_PARENT="Parent Category: %s"
COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="Published: %s"
COM_CONTENT_CUSTOM_WRITTEN_BY="Written by %s"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="Above"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="Below"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="Split"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="Archived Articles"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="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
COM_CONTENT_CUSTOM_ARTICLE_HITS="参照数: %s"
COM_CONTENT_CUSTOM_ARTICLE_INFO="詳細"
COM_CONTENT_CUSTOM_CATEGORY="カテゴリ: %s"
COM_CONTENT_CUSTOM_CREATED_DATE_ON="作成日:%s"
COM_CONTENT_CUSTOM_LAST_UPDATED="最終更新日:%s"
COM_CONTENT_CUSTOM_MONTH="月"
COM_CONTENT_CUSTOM_PARENT="親カテゴリ: %s"
COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON="公開日:%s"
COM_CONTENT_CUSTOM_WRITTEN_BY="投稿者: %s"
COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE="上"
COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW="下"
COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT="分割"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE="アーカイブ記事"
COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION="標準"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
use Joomla\Utilities\ArrayHelper;
JLoader::register('ContentModelArticles', __DIR__ . '/articles.php');
/**
* Content Component Archive Model
*
* @since 1.5
*/
class ContentModelArchive extends ContentModelArticles
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_content_custom.archive';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering The field to order on.
* @param string $direction The direction to order on.
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState();
$app = JFactory::getApplication();
// Add archive properties
$params = $this->state->params;
// Filter on archived articles
$this->setState('filter.published', 1);
// Filter on month, year
$this->setState('filter.month', $app->input->getInt('month'));
$this->setState('filter.year', $app->input->getInt('year'));
// Optional filter text
$this->setState('list.filter', $app->input->getString('filter-search'));
// Get list limit
$itemid = $app->input->get('Itemid', 0, 'int');
$limit = $app->getUserStateFromRequest('com_content_custom.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
$this->setState('list.limit', $limit);
// Set the archive ordering
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
// No category ordering
$secondary = ContentCustomHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
$this->setState('list.ordering', $secondary . ', a.created DESC');
$this->setState('list.direction', '');
}
/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
$params = $this->state->params;
$app = JFactory::getApplication('site');
$catids = ArrayHelper::toInteger($app->input->get('catid', array(), 'array'));
$catids = array_values(array_diff($catids, array(0)));
$articleOrderDate = $params->get('order_date');
// Create a new query object.
$query = parent::getListQuery();
// Add routing for archive
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$query->select($case_when);
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('c.alias', '!=', '0');
$case_when .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $c_id . ' END as catslug';
$query->select($case_when);
// Filter on month, year
// First, get the date field
$queryDate = ContentCustomHelperQuery::getQueryDate($articleOrderDate);
if ($month = $this->getState('filter.month'))
{
$query->where($query->month($queryDate) . ' = ' . $month);
}
if ($year = $this->getState('filter.year'))
{
$query->where($query->year($queryDate) . ' = ' . $year);
}
if (count($catids) > 0)
{
$query->where('c.id IN (' . implode(', ', $catids) . ')');
}
return $query;
}
/**
* Method to get the archived article list
*
* @access public
* @return array
*/
public function getData()
{
$app = JFactory::getApplication();
// Lets load the content if it doesn't already exist
if (empty($this->_data))
{
// Get the page/component configuration
$params = $app->getParams();
// Get the pagination request variables
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0, 'uint');
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $limitstart, $limit);
}
return $this->_data;
}
/**
* JModelLegacy override to add alternating value for $odd
*
* @param string $query The query.
* @param integer $limitstart Offset.
* @param integer $limit The number of records.
*
* @return array An array of results.
*
* @since 3.0.1
* @throws RuntimeException
*/
protected function _getList($query, $limitstart=0, $limit=0)
{
$result = parent::_getList($query, $limitstart, $limit);
$odd = 1;
foreach ($result as $k => $row)
{
$result[$k]->odd = $odd;
$odd = 1 - $odd;
}
return $result;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.caption');
?>
<div class="archive-custom<?php echo $this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
</div>
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_TITLE" option="COM_CONTENT_CUSTOM_ARCHIVE_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_ARTICLE_ARCHIVED"
/>
<message>
<![CDATA[COM_CONTENT_CUSTOM_XML_DESCRIPTION]]>
</message>
</layout>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request"
addfieldpath="/administrator/components/com_categories/models/fields"
>
<field
name="catid"
type="category"
extension="com_content"
multiple="true"
size="5"
label="JCATEGORY"
description="JFIELD_CATEGORY_DESC"
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<!-- Basic options. -->
<fieldset name="basic" label="JGLOBAL_ARCHIVE_OPTIONS"
>
<field
name="orderby_sec"
type="list"
label="JGLOBAL_ARTICLE_ORDER_LABEL"
description="JGLOBAL_ARTICLE_ORDER_DESC"
default="rdate"
>
<option value="date">JGLOBAL_OLDEST_FIRST</option>
<option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option value="order">JGLOBAL_ARTICLE_MANAGER_ORDER</option>
<option value="vote" requires="vote">JGLOBAL_VOTES_DESC</option>
<option value="rvote" requires="vote">JGLOBAL_VOTES_ASC</option>
<option value="rank" requires="vote">JGLOBAL_RATINGS_DESC</option>
<option value="rrank" requires="vote">JGLOBAL_RATINGS_ASC</option>
</field>
<field
name="order_date"
type="list"
label="JGLOBAL_ORDERING_DATE_LABEL"
description="JGLOBAL_ORDERING_DATE_DESC"
default="published"
>
<option value="created">JGLOBAL_Created</option>
<option value="modified">JGLOBAL_Modified</option>
<option value="published">JPUBLISHED</option>
</field>
<field
name="display_num"
type="list"
label="JGLOBAL_NUMBER_ITEMS_LIST_LABEL"
description="JGLOBAL_NUMBER_ITEMS_LIST_DESC"
default="5"
>
<option value="5">J5</option>
<option value="10">J10</option>
<option value="15">J15</option>
<option value="20">J20</option>
<option value="25">J25</option>
<option value="30">J30</option>
<option value="50">J50</option>
<option value="100">J100</option>
<option value="0">JALL</option>
</field>
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="introtext_limit"
type="number"
label="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
description="JGLOBAL_ARCHIVE_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
default="1000"
/>
</fieldset>
<!-- Articles options. -->
<fieldset name="articles"
label="COM_CONTENT_CUSTOM_ATTRIBS_ARTICLE_SETTINGS_LABEL"
>
<field
name="show_intro"
type="list"
label="JGLOBAL_SHOW_INTRO_LABEL"
description="JGLOBAL_SHOW_INTRO_DESC"
class="chzn-color"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="info_block_position"
type="list"
label="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_LABEL"
description="COM_CONTENT_CUSTOM_FIELD_INFOBLOCK_POSITION_DESC"
default=""
useglobal="true"
class="chzn-color"
>
<option value="use_article">COM_CONTENT_CUSTOM_FIELD_VALUE_USE_ARTICLE_SETTINGS</option>
<option value="0">COM_CONTENT_CUSTOM_FIELD_OPTION_ABOVE</option>
<option value="1">COM_CONTENT_CUSTOM_FIELD_OPTION_BELOW</option>
<option value="2">COM_CONTENT_CUSTOM_FIELD_OPTION_SPLIT</option>
</field>
<field
name="show_category"
type="list"
label="JGLOBAL_SHOW_CATEGORY_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_category"
type="list"
label="JGLOBAL_LINK_CATEGORY_LABEL"
description="JGLOBAL_LINK_CATEGORY_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_parent_category"
type="list"
label="JGLOBAL_SHOW_PARENT_CATEGORY_LABEL"
description="JGLOBAL_SHOW_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_parent_category"
type="list"
label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL"
description="JGLOBAL_LINK_PARENT_CATEGORY_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="link_titles"
type="list"
label="JGLOBAL_LINKED_TITLES_LABEL"
description="JGLOBAL_LINKED_TITLES_DESC"
class="chzn-color"
default="1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_author"
type="list"
label="JGLOBAL_SHOW_AUTHOR_LABEL"
description="JGLOBAL_SHOW_AUTHOR_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_author"
type="list"
label="JGLOBAL_LINK_AUTHOR_LABEL"
description="JGLOBAL_LINK_AUTHOR_DESC"
useglobal="true"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="show_create_date"
type="list"
label="JGLOBAL_SHOW_CREATE_DATE_LABEL"
description="JGLOBAL_SHOW_CREATE_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_modify_date"
type="list"
label="JGLOBAL_SHOW_MODIFY_DATE_LABEL"
description="JGLOBAL_SHOW_MODIFY_DATE_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_publish_date"
type="list"
label="JGLOBAL_SHOW_PUBLISH_DATE_LABEL"
description="JGLOBAL_SHOW_PUBLISH_DATE_DESC"
class="chzn-color"
default="1"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_hits"
type="list"
label="JGLOBAL_SHOW_HITS_LABEL"
description="JGLOBAL_SHOW_HITS_DESC"
useglobal="true"
class="chzn-color"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>
<?php
/**
* @package Joomla.Site
* @subpackage com_content_custom
*
* @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;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$params = $this->params;
?>
<div id="archive-items">
<?php foreach ($this->items as $i => $item) : ?>
<?php $info = $item->params->get('info_block_position', 0); ?>
<div class="row<?php echo $i % 2; ?>" itemscope itemtype="https://schema.org/Article">
<div class="page-header">
<h2 itemprop="headline">
<?php if ($params->get('link_titles')) : ?>
<?php
$url = JRoute::_(ContentCustomHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
$url = "information/" . end(explode("/", $url));
?>
<a href="<?php echo $url; ?>" itemprop="url">
<?php echo $this->escape($item->title); ?>
</a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</h2>
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php if ($params->get('show_author') && !empty($item->author )) : ?>
<div class="createdby" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?php $author = $item->created_by_alias ?: $item->author; ?>
<?php $author = '<span itemprop="name">' . $author . '</span>'; ?>
<?php if (!empty($item->contact_link) && $params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', JHtml::_('link', $this->item->contact_link, $author, array('itemprop' => 'url'))); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_WRITTEN_BY', $author); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category')); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category') && !empty($item->parent_slug)) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') && $item->catslug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($info == 0) : ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta itemprop="interactionCount" content="UserPageVisits:<?php echo $item->hits; ?>" />
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if ($params->get('show_intro')) : ?>
<div class="intro" itemprop="articleBody"> <?php echo JHtml::_('string.truncateComplex', $item->introtext, $params->get('introtext_limit')); ?> </div>
<?php endif; ?>
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
<div class="article-info muted">
<dl class="article-info">
<dt class="article-info-term"><?php echo JText::_('COM_CONTENT_CUSTOM_ARTICLE_INFO'); ?></dt>
<?php if ($info == 1) : ?>
<?php if ($params->get('show_parent_category') && !empty($item->parent_slug)) : ?>
<dd>
<div class="parent-category-name">
<?php $title = $this->escape($item->parent_title); ?>
<?php if ($params->get('link_parent_category') && $item->parent_slug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->parent_slug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PARENT', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd>
<div class="category-name">
<?php $title = $this->escape($item->category_title); ?>
<?php if ($params->get('link_category') && $item->catslug) : ?>
<?php $url = '<a href="' . JRoute::_(ContentCustomHelperRoute::getCategoryRoute($item->catslug)) . '" itemprop="genre">' . $title . '</a>'; ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CATEGORY', '<span itemprop="genre">' . $title . '</span>'); ?>
<?php endif; ?>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd>
<div class="published">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_PUBLISHED_DATE_ON', JHtml::_('date', $item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd>
<div class="create">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->created, 'c'); ?>" itemprop="dateCreated">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_CREATED_DATE_ON', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd>
<div class="modified">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo JHtml::_('date', $item->modified, 'c'); ?>" itemprop="dateModified">
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_LAST_UPDATED', JHtml::_('date', $item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</time>
</div>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd>
<div class="hits">
<span class="icon-eye-open"></span>
<meta content="UserPageVisits:<?php echo $item->hits; ?>" itemprop="interactionCount" />
<?php echo JText::sprintf('COM_CONTENT_CUSTOM_ARTICLE_HITS', $item->hits); ?>
</div>
</dd>
<?php endif; ?>
</dl>
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
<?php echo $item->event->afterDisplayContent; ?>
</div>
<?php endforeach; ?>
</div>
<div class="pagination">
<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php
/**
* @package Joomla.Site
* @subpackage com_conten_custom
*
* @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;
/**
* HTML View class for the Content component
*
* @since 1.5
*/
class ContentViewArchive extends JViewLegacy
{
protected $state = null;
protected $item = null;
protected $items = null;
protected $pagination = null;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$state = $this->get('State');
$items = $this->get('Items');
$pagination = $this->get('Pagination');
// Flag indicates to not add limitstart=0 to URL
$pagination->hideEmptyLimitstart = true;
// Get the page/component configuration
$params = &$state->params;
JPluginHelper::importPlugin('content_custom');
foreach ($items as $item)
{
$item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid;
$item->parent_slug = $item->parent_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id;
// No link for ROOT category
if ($item->parent_alias === 'root')
{
$item->parent_slug = null;
}
$item->event = new stdClass;
$dispatcher = JEventDispatcher::getInstance();
// Old plugins: Ensure that text property is available
if (!isset($item->text))
{
$item->text = $item->introtext;
}
$dispatcher->trigger('onContentPrepare', array ('com_content_custom.archive', &$item, &$item->params, 0));
// Old plugins: Use processed text as introtext
$item->introtext = $item->text;
$results = $dispatcher->trigger('onContentAfterTitle', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content_custom.archive', &$item, &$item->params, 0));
$item->event->afterDisplayContent = trim(implode("\n", $results));
}
$this->filter = $state->get('list.filter');
$this->items = &$items;
$this->params = &$params;
$this->user = &$user;
$this->pagination = &$pagination;
$this->pagination->setAdditionalUrlParam('month', $state->get('filter.month'));
$this->pagination->setAdditionalUrlParam('year', $state->get('filter.year'));
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
}
else
{
$this->params->def('page_heading', JText::_('JGLOBAL_ARTICLES'));
}
$title = $this->params->get('page_title', '');
if (empty($title))
{
$title = $app->get('sitename');
}
elseif ($app->get('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
}
}
# インフォメーション用月次アーカイブモジュール
公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。
インストールしていない場合は、管理画面よりインストールする必要があります。
## このコンポーネントは、インフォメーションカテゴリーに属する記事専用の月次アーカイブモジュールです。
インフォメーション(メニュー)の子メニューのサイドバーで表示できる様に、83行目でリンクを修正する処理を追加しています
### インフォメーションカテゴリー以外のカテゴリーに属する記事の月次アーカイブを作成したい場合は以下の手順が必要です。
#### 手順2,3をせずにインストールしてしまうと、インストーラーが既存のモジュールを上書きしてしまい、サイトに不具合が発生する可能性があるので必ず実行してください。
[Joomla公式のモジュール作成チュートリアルです。参考にしてください。](https://docs.joomla.org/J3.x:Creating_a_simple_module/Developing_a_Basic_Module)
1. mod_information_articles_archive_custom/をコピーし、src/mod配下におきます。
2. mod_information_articles_archive_customを含む配下のディレクトリ名とファイル名を、新規に月次モジュールを設置するカテゴリーに準じたものに変更します。例:mod_category_articles_archive_custom
3. mod_information_articles_archive_custom.xmlで、インストーラーがインストールするディレクトリ名とファイル名を指定しているので、手順1で変更したディレクトリ名、ファイル名を指定する様に修正します。
4. en-GBから始まる二つのファイルと、ja-JPから始まる二つのファイルで、モジュール内で使用する定数を定義しているので、ファイルを編集し新規に月次モジュールを設置するカテゴリーに準じたものに変更します。
例:MOD_CATEGORY_ARTICLES_ARCHIVE_CUSTOM="カスタムカテゴリー名アーカイブ(モジュール)"
5. 手順4で定数名を変更したので、それぞれの定数が呼び出されている箇所も、変更した定数名が呼び出される様に修正します。
6. README下部にあるインストール手順にしたがってインストールをします。
## インストール手順
1. 管理画面ログイン
2. エクステンション配下の管理を選択
3. (フォルダからインストール)を選択
4. フォームにインストールするモジュールまたは、コンポーネントのフォルダを指定(例:/var/www/html/src/com/com_hoge)
5. チェックしてインストール
\ 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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="InformationArticles - Archived - custom"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="# of Months"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="The number of months to display (the default is 10)."
MOD_INFORMATION_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_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="InformationArticles - Archived - custom"
MOD_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="Default"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_information_articles_archive_custom
*
* @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_information_articles_archive_custom
*
* @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;
$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;
}
}
\ 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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="カスタムインフォメーションアーカイブ(モジュール)"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="表示月数"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="表示する月数(標準は10)です。"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM="カスタムインフォメーションアーカイブ(モジュール)"
MOD_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_INFORMATION_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;
// 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_information_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_INFORMATION_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION</description>
<files>
<filename module="mod_information_articles_archive_custom">mod_information_articles_archive_custom.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_information_articles_archive_custom.ini</language>
<language tag="en-GB">en-GB.mod_information_articles_archive_custom.sys.ini</language>
<language tag="ja-JP">ja-JP.mod_information_articles_archive_custom.ini</language>
<language tag="ja-JP">ja-JP.mod_information_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_INFORMATION_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL"
description="MOD_INFORMATION_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_information_articles_archive_custom
*
* @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; ?>
/* コロナ暫定対処 */
.covid-19 .mod-articles-category-category {
.covid-19 .mod-articles-category-category,
.covid-19-news .mod-articles-category-category {
display: none;
}
.covid-19-sub-menu.category-list {
display: none;
}
......@@ -61,7 +65,8 @@ a.outlink {
color: #009fa8;
}
.item-page h4 a,
.blog h4 a {
.blog h4 a,
.archive-custom h4 a {
background: url(../images/bg_arrow01.png) no-repeat left 4px;
min-height: 20px;
padding-left: 25px;
......@@ -74,7 +79,11 @@ a.outlink {
.blog h4 a:link,
.blog h4 a:active,
.blog h4 a:hover,
.blog h4 a:visited {
.blog h4 a:visited,
.archive-custom h4 a:link,
.archive-custom h4 a:active,
.archive-custom h4 a:hover,
.archive-custom h4 a:visited {
color: #fff !important;
}
.sp, .sp_gnavi {
......@@ -87,7 +96,8 @@ a.outlink {
display: none;
}
.item-page .icons,
.blog .icons {
.blog .icons,
.archive-custom .icons {
/*display: none;*/
}
table {
......@@ -273,6 +283,7 @@ h1, h2, h3, h4, h5, h6, .site-title {
line-height: 1;
margin: 0;
}
/* 記述エラーで機能していないため、コメントアウト
.item-page h2,
.item-page h3,
.item-page h4,
......@@ -283,16 +294,23 @@ h1, h2, h3, h4, h5, h6, .site-title {
.blog h4,
.blog h5,
.archive-custom h2,
.archive-custom h3,
.archive-custom h4,
.archive-custom h5,
#content h2,
#content h3,
#content h4,
#content h5, {
line-height: 1.3;
}
} */
.item-page h2,
body.com_monthlyarchive h2,
.blog .page-header h2,
.blog h2 {
.blog h2,
.archive-custom .page-header h2,
.archive-custom h2 {
font-size: 150%;
color: #222;
font-weight: normal;
......@@ -304,7 +322,7 @@ body.com_monthlyarchive h2,
.uk-scope .uk-margin-top {
margin-top: 9px !important;
}
#content h3, .item-page h3, .blog h3 {
#content h3, .item-page h3, .blog h3, .archive-custom h3 {
border-left: 5px solid #003894;
font-size: 130%;
font-weight: normal;
......@@ -313,7 +331,7 @@ body.com_monthlyarchive h2,
margin-top: 20px;
padding: 10px 0 10px 15px;
}
.item-page h4, .blog h4 {
.item-page h4, .blog h4, .archive-custom h4 {
background-color: #00857F;
color: #fff;
font-size: 110%;
......@@ -322,7 +340,7 @@ body.com_monthlyarchive h2,
margin-top: 50px;
padding: 7px 10px;
}
.item-page h5, .blog h5 {
.item-page h5, .blog h5, .archive-custom h5 {
font-size: 120%;
font-weight: normal;
background: url(../images/bg_h5.png) no-repeat left center;
......@@ -539,14 +557,19 @@ div.search input.button {
.blog .subnavi01 ol,
.blog .subnavi01 ul,
.blog .subnavi01 ul.style01 {
.blog .subnavi01 ul.style01,
.archive-custom .subnavi01 ol,
.archive-custom .subnavi01 ul,
.archive-custom .subnavi01 ul.style01 {
overflow: hidden;
margin: 0;
}
.item-page .subnavi01 ol li,
.item-page .subnavi01 ul li,
.blog .subnavi01 ol li,
.blog .subnavi01 ul li {
.blog .subnavi01 ul li,
.archive-custom.subnavi01 ol li,
.archive-custom .subnavi01 ul li {
float: left;
list-style-type: none;
width: 33.3%;
......@@ -558,24 +581,29 @@ div.search input.button {
.item-page .subnavi01 ul.style01 li,
.item-page .subnavi01 ol.style01 li,
.blog .subnavi01 ul.style01 li,
.blog .subnavi01 ol.style01 li {
.blog .subnavi01 ol.style01 li,
.archive-custom .subnavi01 ul.style01 li,
.archive-custom .subnavi01 ol.style01 li {
width: 50%;
padding-right: 20px;
box-sizing: border-box;
}
.item-page .subnavi01 ol.style01 li,
.blog .subnavi01 ol.style01 li {
.blog .subnavi01 ol.style01 li,
.archive-custom .subnavi01 ol.style01 li {
border: none;
padding-bottom: inherit;
margin-bottom: 15px;
}
.item-page .subnavi01 ul.style02 li,
.blog .subnavi01 ul.style02 li {
.blog .subnavi01 ul.style02 li,
.archive-custom .subnavi01 ul.style02 li {
width: inherit;
}
.item-page .subnavi01 ul.style03 li,
.blog .subnavi01 ul.style03 li {
.blog .subnavi01 ul.style03 li,
.archive-custom .subnavi01 ul.style03 li {
width: auto;
float: none;
}
......@@ -1097,7 +1125,8 @@ div#n2-ss-64 .n2-ss-slide {
overflow: hidden;
}
.item-page #topinfo_twitarea h2,
.blog #topinfo_twitarea h2 {
.blog #topinfo_twitarea h2,
.archive-custom #topinfo_twitarea h2 {
border: none;
text-align: center;
margin: 0 0 20px;
......@@ -1475,7 +1504,8 @@ table.Cindex .ph {
margin-bottom: 15px;
}
.item-page table.Cindex ul,
.blog table.Cindex ul{
.blog table.Cindex ul,
.archive-custom table.Cindex ul {
margin: 0;
font-size: 90%;
}
......@@ -1528,7 +1558,8 @@ td.num01 {
}
.item-page table ul,
.blog table ul {
.blog table ul,
.archive-custom table ul {
margin: 0 0 0 15px;
}
......@@ -1575,16 +1606,19 @@ table.style01 th.group {
width: 12%;
}
.item-page table.style01 ul li,
.blog table.style01 ul li {
.blog table.style01 ul li,
.archive-custom table.style01 ul li {
list-style-type: none;
margin: 0;
}
.item-page table.style01 ul.mark,
.blog table.style01 ul.mark {
.blog table.style01 ul.mark,
.archive-custom table.style01 ul.mark {
margin-left: 20px;
}
.item-page table.style01 ul.mark li,
.blog table.style01 ul.mark li {
.blog table.style01 ul.mark li,
.archive-custom table.style01 ul.mark li {
list-style-type: disc;
margin-bottom: 7px;
}
......@@ -1695,33 +1729,40 @@ address .title {
ul, ol {
}
.item-page ul, .item-page ol,
.blog ul, .blog ol {
.blog ul, .blog ol,
.archive-custom ul, .archive-custom ol {
margin-bottom: 30px;
}
.item-page ul ul, .item-page ol ul,
.item-page ul ol, .item-page ol ol,
.blog ul ul, .blog ol ul,
.blog ul ol, .blog ol ul {
.blog ul ol, .blog ol ul,
.archive-custom ul ul, .archive-custom ol ul,
.archive-custom ul ol, .archive-custom ol ul {
margin-left: 20px;
margin-top: 10px;
}
.item-page ul li, .item-page ol li,
.blog ul li, .blog ol li {
.blog ul li, .blog ol li,
.archive-custom ul li, .archive-custom ol li {
margin-bottom: 12px;
margin-bottom: 15px;
}
.item-page ul li,
.blog ul li {
.blog ul li,
.archive-custom ul li {
list-style-type: disc;
line-height: 1.5;
}
.item-page li ul
.blog li ul {
.blog li ul,
.archive-custom li ul {
margin-top: 15px;
}
.item-page ul.kome,
.blog ul.kome {
.blog ul.kome,
.archive-custom ul.kome {
/*margin-left: 10px;*/
}
.item-page ul.kome li,
......@@ -1739,17 +1780,20 @@ ol li .title {
padding-bottom: 5px;
}
.item-page ol.style01 li,
.blog ol.style01 li {
.blog ol.style01 li,
.archive-custom ol.style01 li {
border-bottom: 1px solid #b3caf0;
padding-bottom: 10px;
margin-bottom: 20px;
}
.item-page ol.style01 li ul,
.blog ol.style01 li ul {
.blog ol.style01 li ul,
.archive-custom ol.style01 li ul {
margin-bottom: 0;
}
.item-page ol.style01 li li,
.blog ol.style01 li li {
.blog ol.style01 li li,
.archive-custom ol.style01 li li {
border: none;
margin-bottom: 10px;
}
......@@ -1920,7 +1964,8 @@ dl.article-info dd.create {
margin-bottom: 20px;
}
.item-page .bikoubox01 ul.kome,
.blog .bikoubox01 ul.kome {
.blog .bikoubox01 ul.kome,
.archive-custom .bikoubox01 ul.kome {
margin-left: 0;
}
.bikoubox01 .title {
......@@ -2102,7 +2147,13 @@ table.listimg td {
.blog .wrap_fac .subnavi02 ul li a:link,
.blog .wrap_fac .subnavi02 ul li a:active,
.blog .wrap_fac .subnavi02 ul li a:hover,
.blog .wrap_fac .subnavi02 ul li a:visited {
.blog .wrap_fac .subnavi02 ul li a:visited,
.archive-custom .wrap_fac .subnavi02 ul li a,
.archive-custom .wrap_fac .subnavi02 ul li a:link,
.archive-custom .wrap_fac .subnavi02 ul li a:active,
.archive-custom .wrap_fac .subnavi02 ul li a:hover,
.archive-custom .wrap_fac .subnavi02 ul li a:visited {
color: #333 !important;
}
......@@ -2210,7 +2261,8 @@ table.listimg td {
/*競技成績一覧ページ
https://www.nifs-k.ac.jp/campus-life/activities/record.html
*/
body.itemid-795 .blog .cat-children {
body.itemid-795 .blog .cat-children,
body.itemid-795 .archive-custom .cat-children {
display: none;
}
......@@ -2272,7 +2324,19 @@ body.itemid-795 .blog .cat-children {
.blog #wrap_sitemap a:link,
.blog #wrap_sitemap a:active,
.blog #wrap_sitemap a:hover,
.blog #wrap_sitemap a:visited {
.blog #wrap_sitemap a:visited,
.archive-custom #wrap_sitemap ul li a,
.archive-custom #wrap_sitemap ul li a:link,
.archive-custom #wrap_sitemap ul li a:active,
.archive-custom #wrap_sitemap ul li a:hover,
.archive-custom #wrap_sitemap ul li a:visited,
.archive-custom #wrap_sitemap a,
.archive-custom #wrap_sitemap a:link,
.archive-custom #wrap_sitemap a:active,
.archive-custom #wrap_sitemap a:hover,
.archive-custom #wrap_sitemap a:visited {
color: #003894;
}
......@@ -2350,17 +2414,20 @@ body.itemid-795 .blog .cat-children {
/* -------------------------------------------------------------------------
ブログ系(information)
------------------------------------------------------------------------- */
/*.blog .page-header h2 {
/*.blog .page-header h2,
.archive-custom .page-header h2 {
margin-top: 30px;
font-size: 130%;
padding-bottom: 17px;
padding-top: 17px;
}*/
.blog a:link, .blog a:active, .blog a:hover, .blog a:visited {
.blog a:link, .blog a:active, .blog a:hover, .blog a:visited,
.archive-custom a:link, .archive-custom a:active, .archive-custom a:hover, .archive-custom a:visited {
color: #009fa8;
}
body.itemid-792 .blog .cat-children {
body.itemid-792 .blog .cat-children,
body.itemid-792 .archive-custom .cat-children {
display: none;
}
......@@ -3039,12 +3106,14 @@ body.itemid-132 table {
}
.item-page .subnavi01 ol li, .item-page .subnavi01 ul li,
.blog .subnavi01 ol li, .blog .subnavi01 ul li {
.blog .subnavi01 ol li, .blog .subnavi01 ul li,
.archive-custom .subnavi01 ol li, .archive-custom .subnavi01 ul li {
width: auto;
margin-right: 30px;
}
.item-page .subnavi01 ul.style01 li, .item-page .subnavi01 ol.style01 li,
.blog .subnavi01 ul.style01 li, .blog .subnavi01 ol.style01 li {
.blog .subnavi01 ul.style01 li, .blog .subnavi01 ol.style01 li,
.archive-custom .subnavi01 ul.style01 li, .archive-custom .subnavi01 ol.style01 li {
width: 100%;
float: none;
}
......@@ -3186,7 +3255,7 @@ body.itemid-132 table {
}
/*見出し*/
.item-page h2, body.com_monthlyarchive h2, .blog .page-header h2, .blog h2 {
.item-page h2, body.com_monthlyarchive h2, .blog .page-header h2, .blog h2, .archive-custom .page-header h2, .archive-custom h2 {
font-size: 130%;
padding-bottom: 20px;
padding-top: 20px;
......@@ -3271,12 +3340,12 @@ body.itemid-132 table {
}
@media (max-width: 400px) {
.item-page h2, .blog h2 {
.item-page h2, .blog h2, .archive-custom h2 {
font-size: 140%;
padding-top: 20px;
padding-bottom: 20px;
}
.item-page h3, .blog h3 {
.item-page h3, .blog h3, .archive-custom h3 {
margin-bottom: 15px;
padding-left: 10px;
font-size: 120%;
......@@ -3419,4 +3488,37 @@ body.itemid-132 table {
/* 上記の自動設定の、最大値を指定 */
max-height: 75px;
max-width: 100px;
}
/* -------------------------------------------------------------------------
 app/modules/mod_information_articles_archive_custom/tmpl/default.phpのスタイルを変更
------------------------------------------------------------------------- */
.archive-module-custom {
height: 460px;
overflow: auto;
}
#aside > .custom-archive-module {
position: relative;
}
#aside > .custom-archive-module:after {
content: ' ';
position: absolute;
bottom: 12px;
left: calc(50% - 6px);
display: block;
width: 12px;
height: 12px;
border: 2px solid;
border-color: transparent transparent #009fa8 #009fa8;
transform: rotate(-45deg);
opacity: 0.6;
border-radius: 4px;
}
@media (max-width: 980px) {
#aside > .custom-archive-module:after {
bottom: 47px;
}
}
\ No newline at end of file
......
......@@ -45,7 +45,7 @@ JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true)
JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));
// Add Stylesheets
JHtml::_('stylesheet', 'template.css', array('version' => '20200702001', 'relative' => true));
JHtml::_('stylesheet', 'template.css', array('version' => '20200811002', 'relative' => true));
// Use of Google Font
......@@ -203,37 +203,53 @@ if ($this->params->get('logoFile')) {
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<script>
jQuery(function($) {
var obj = $("#aside");
var offset = $(obj).offset();
var topPadding = 135;
var sW = window.innerWidth;
var sH = window.innerHeight;
var cW = obj.width();
var cH = obj.height();
var cwrapH = $("#c_wrap").height();
if (cH) {
if (sH > cH) {
$(window).scroll(function() {
if ($(window).scrollTop() > offset.top) {
if ($(window).scrollTop() < cwrapH) {
window.onload = function() {
covid19RedicretTarget = document.querySelector('.covid-19-sub-menu.category-list');
if (covid19RedicretTarget) window.location.href = '/covid-19.html';
jQuery(function($) {
var obj = $("#aside");
var sW = window.innerWidth;
var sH = window.innerHeight;
var cW = obj.width();
var cH = obj.height();
var cwrapH = $("#c_wrap").height();
// 特定のページではスクロールしない
var excludedPages = [".record-page", ".information-page"];
var excludedPagesSelector = excludedPages.join(', ');
var isExcluded = false;
if (document.querySelector(excludedPagesSelector)) {
isExcluded = true;
}
var customHeight = $(".custom").height();
var paddingTop = customHeight - 80;
if (cH) {
if (sH > cH) {
if (isExcluded) return false;
$(window).resize(function() {
customHeight = $(".custom").height();
paddingTop = customHeight - 80;
});
$(window).scroll(function() {
if ($(window).scrollTop() > customHeight) {
if ($(window).scrollTop() < cwrapH) {
$(obj).stop().animate({
duration: 'fast',
marginTop: $(window).scrollTop() - paddingTop
});
} else {
$(obj).stop().animate({});
}
} else {
$(obj).stop().animate({
duration: 'fast',
marginTop: $(window).scrollTop() - offset.top + topPadding
marginTop: 0
});
} else {
$(obj).stop().animate({});
}
} else {
$(obj).stop().animate({
marginTop: 0
});
}
});
});
}
}
}
});
});
};
</script>
</head>
......@@ -673,8 +689,8 @@ if ($this->params->get('logoFile')) {
<li><a href="/entrance/selective/pe/ao.html">総合型選抜(SS)入試</a></li>
<li><a href="/entrance/selective/pe/recommendation.html">学校推薦型選抜</a></li>
<li><a href="/entrance/selective/pe/exam.html">一般選抜</a></li>
<li><a href="/entrance/selective/pe/returnee.html">帰国子女入試</a></li>
<li><a href="/entrance/selective/pe/society.html">社会人入試</a></li>
<li><a href="/entrance/selective/pe/returnee.html">帰国生徒選抜</a></li>
<li><a href="/entrance/selective/pe/society.html">社会人選抜</a></li>
<li><a href="/entrance/selective/pe/foreign.html">私費外国人留学生入試</a></li>
<li><a href="/entrance/selective/pe/transfer.html">第3年次編入学試験</a></li>
</ul>
......@@ -858,7 +874,7 @@ if ($this->params->get('logoFile')) {
<li><a href="/campus-life/activities/trainer.html">アスレティックトレーナー部</a></li>
<li><a href="/campus-life/activities/golf.html">ゴルフ部</a></li>
<li><a href="/campus-life/activities/dance.html">ダンス部</a></li>
<li><a href="/campus-life/activities/culture.html">伝統文化・スポーツ研究会</a></li>
<li><a href="/campus-life/activities/esports.html">eスポーツ競技・研究会</a></li>
</ul>
</li>
<li><a href="/campus-life/activities/activities-apply.html" title="申請書様式(在学生向け)">申請書様式(在学生向け)</a></li>
......@@ -1450,6 +1466,7 @@ if ($this->params->get('logoFile')) {
JRequest::getInt('Itemid') == 799 ||
JRequest::getInt('Itemid') == 575 ||
JRequest::getInt('Itemid') == 803 ||
JRequest::getInt('Itemid') == 893 ||
$itemid == 871 ||
JRequest::getInt('catid') == 142
) : ?>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!