805d0dd5 by TaishiTokudome

Merge branch 'master' into 'deployment/production'

本番反映 : 月次アーカイブページに関する変更

See merge request !11
2 parents 90bbb365 3534b0b0
Showing 33 changed files with 2565 additions and 41 deletions
......@@ -14,3 +14,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
......
# 月次アーカイブ用コンポーネント
過去に投稿された記事をカテゴリー別に絞り込み、月間アーカイブを表示するコンポーネントです。
インストールしていない場合は、管理画面よりインストールする必要があります。
## インストール手順
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;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
/**
* This models supports retrieving lists of articles.
*
* @since 1.6
*/
class ContentModelArticles extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'id', 'a.id',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'state', 'a.state',
'access', 'a.access', 'access_level',
'created', 'a.created',
'created_by', 'a.created_by',
'ordering', 'a.ordering',
'featured', 'a.featured',
'language', 'a.language',
'hits', 'a.hits',
'publish_up', 'a.publish_up',
'publish_down', 'a.publish_down',
'images', 'a.images',
'urls', 'a.urls',
'filter_tag',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* This method should only be called once per instantiation and is designed
* to be called on the first call to the getState() method unless the model
* configuration flag to ignore the request is set.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 3.0.1
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
$value = $app->input->get('limit', $app->get('list_limit', 0), 'uint');
$this->setState('list.limit', $value);
$value = $app->input->get('limitstart', 0, 'uint');
$this->setState('list.start', $value);
$value = $app->input->get('filter_tag', 0, 'uint');
$this->setState('filter.tag', $value);
$orderCol = $app->input->get('filter_order', 'a.ordering');
if (!in_array($orderCol, $this->filter_fields))
{
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = $app->input->get('filter_order_Dir', 'ASC');
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', '')))
{
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state', 'com_content_custom')) && (!$user->authorise('core.edit', 'com_content_custom')))
{
// Filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.published', 1);
}
$this->setState('filter.language', JLanguageMultilang::isEnabled());
// Process show_noauth parameter
if ((!$params->get('show_noauth')) || (!JComponentHelper::getParams('com_content_custom')->get('show_noauth')))
{
$this->setState('filter.access', true);
}
else
{
$this->setState('filter.access', false);
}
$this->setState('layout', $app->input->getString('layout'));
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . serialize($this->getState('filter.published'));
$id .= ':' . $this->getState('filter.access');
$id .= ':' . $this->getState('filter.featured');
$id .= ':' . serialize($this->getState('filter.article_id'));
$id .= ':' . $this->getState('filter.article_id.include');
$id .= ':' . serialize($this->getState('filter.category_id'));
$id .= ':' . $this->getState('filter.category_id.include');
$id .= ':' . serialize($this->getState('filter.author_id'));
$id .= ':' . $this->getState('filter.author_id.include');
$id .= ':' . serialize($this->getState('filter.author_alias'));
$id .= ':' . $this->getState('filter.author_alias.include');
$id .= ':' . $this->getState('filter.date_filtering');
$id .= ':' . $this->getState('filter.date_field');
$id .= ':' . $this->getState('filter.start_date_range');
$id .= ':' . $this->getState('filter.end_date_range');
$id .= ':' . $this->getState('filter.relative_date');
$id .= ':' . serialize($this->getState('filter.tag'));
return parent::getStoreId($id);
}
/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
// Get the current user for authorisation checks
$user = JFactory::getUser();
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.introtext, a.fulltext, ' .
'a.checked_out, a.checked_out_time, ' .
'a.catid, a.created, a.created_by, a.created_by_alias, ' .
// Published/archived article in archive category is treats as archive article
// If category is not published then force 0
'CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN c.published != 1 THEN 0 ELSE a.state END as state,' .
// Use created if modified is 0
'CASE WHEN a.modified = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.modified END as modified, ' .
'a.modified_by, uam.name as modified_by_name,' .
// Use created if publish_up is 0
'CASE WHEN a.publish_up = ' . $db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END as publish_up,' .
'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' .
'a.hits, a.xreference, a.featured, a.language, ' . ' ' . $query->length('a.fulltext') . ' AS readmore, a.ordering'
)
);
$query->from('#__content AS a');
$params = $this->getState('params');
$orderby_sec = $params->get('orderby_sec');
// Join over the frontpage articles if required.
if ($this->getState('filter.frontpage'))
{
if ($orderby_sec === 'front')
{
$query->select('fp.ordering');
$query->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id');
}
else
{
$query->where('a.featured = 1');
}
}
elseif ($orderby_sec === 'front' || $this->getState('list.ordering') === 'fp.ordering')
{
$query->select('fp.ordering');
$query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id');
}
// Join over the categories.
$query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias')
->select('c.published, c.published AS parents_published, c.lft')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
// Join over the users for the author and modified_by names.
$query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author")
->select('ua.email AS author_email')
->join('LEFT', '#__users AS ua ON ua.id = a.created_by')
->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
if (JPluginHelper::isEnabled('content_custom', 'vote'))
{
// Join on voting table
$query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating,
COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count')
->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
}
// Filter by access level.
if ($this->getState('filter.access', true))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')')
->where('c.access IN (' . $groups . ')');
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published) && $published == 2)
{
/**
* If category is archived then article has to be published or archived.
* Or categogy is published then article has to be archived.
*/
$query->where('((c.published = 2 AND a.state > 0) OR (c.published = 1 AND a.state = 2))');
}
elseif (is_numeric($published))
{
// Category has to be published
$query->where('c.published = 1 AND a.state = ' . (int) $published);
}
elseif (is_array($published))
{
$published = ArrayHelper::toInteger($published);
$published = implode(',', $published);
// Category has to be published
$query->where('c.published = 1 AND a.state IN (' . $published . ')');
}
// Filter by featured state
$featured = $this->getState('filter.featured');
switch ($featured)
{
case 'hide':
$query->where('a.featured = 0');
break;
case 'only':
$query->where('a.featured = 1');
break;
case 'show':
default:
// Normally we do not discriminate between featured/unfeatured items.
break;
}
// Filter by a single or group of articles.
$articleId = $this->getState('filter.article_id');
if (is_numeric($articleId))
{
$type = $this->getState('filter.article_id.include', true) ? '= ' : '<> ';
$query->where('a.id ' . $type . (int) $articleId);
}
elseif (is_array($articleId))
{
$articleId = ArrayHelper::toInteger($articleId);
$articleId = implode(',', $articleId);
$type = $this->getState('filter.article_id.include', true) ? 'IN' : 'NOT IN';
$query->where('a.id ' . $type . ' (' . $articleId . ')');
}
// Filter by a single or group of categories
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId))
{
$type = $this->getState('filter.category_id.include', true) ? '= ' : '<> ';
// Add subcategory check
$includeSubcategories = $this->getState('filter.subcategories', false);
$categoryEquals = 'a.catid ' . $type . (int) $categoryId;
if ($includeSubcategories)
{
$levels = (int) $this->getState('filter.max_category_levels', '1');
// Create a subquery for the subcategory list
$subQuery = $db->getQuery(true)
->select('sub.id')
->from('#__categories as sub')
->join('INNER', '#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt')
->where('this.id = ' . (int) $categoryId);
if ($levels >= 0)
{
$subQuery->where('sub.level <= this.level + ' . $levels);
}
// Add the subquery to the main query
$query->where('(' . $categoryEquals . ' OR a.catid IN (' . (string) $subQuery . '))');
}
else
{
$query->where($categoryEquals);
}
}
elseif (is_array($categoryId) && (count($categoryId) > 0))
{
$categoryId = ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
if (!empty($categoryId))
{
$type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN';
$query->where('a.catid ' . $type . ' (' . $categoryId . ')');
}
}
// Filter by author
$authorId = $this->getState('filter.author_id');
$authorWhere = '';
if (is_numeric($authorId))
{
$type = $this->getState('filter.author_id.include', true) ? '= ' : '<> ';
$authorWhere = 'a.created_by ' . $type . (int) $authorId;
}
elseif (is_array($authorId))
{
$authorId = array_filter($authorId, 'is_numeric');
if ($authorId)
{
$authorId = implode(',', $authorId);
$type = $this->getState('filter.author_id.include', true) ? 'IN' : 'NOT IN';
$authorWhere = 'a.created_by ' . $type . ' (' . $authorId . ')';
}
}
// Filter by author alias
$authorAlias = $this->getState('filter.author_alias');
$authorAliasWhere = '';
if (is_string($authorAlias))
{
$type = $this->getState('filter.author_alias.include', true) ? '= ' : '<> ';
$authorAliasWhere = 'a.created_by_alias ' . $type . $db->quote($authorAlias);
}
elseif (is_array($authorAlias))
{
$first = current($authorAlias);
if (!empty($first))
{
foreach ($authorAlias as $key => $alias)
{
$authorAlias[$key] = $db->quote($alias);
}
$authorAlias = implode(',', $authorAlias);
if ($authorAlias)
{
$type = $this->getState('filter.author_alias.include', true) ? 'IN' : 'NOT IN';
$authorAliasWhere = 'a.created_by_alias ' . $type . ' (' . $authorAlias .
')';
}
}
}
if (!empty($authorWhere) && !empty($authorAliasWhere))
{
$query->where('(' . $authorWhere . ' OR ' . $authorAliasWhere . ')');
}
elseif (empty($authorWhere) && empty($authorAliasWhere))
{
// If both are empty we don't want to add to the query
}
else
{
// One of these is empty, the other is not so we just add both
$query->where($authorWhere . $authorAliasWhere);
}
// Define null and now dates
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
// Filter by start and end dates.
if ((!$user->authorise('core.edit.state', 'com_content_custom')) && (!$user->authorise('core.edit', 'com_content_custom')))
{
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
}
// Filter by Date Range or Relative Date
$dateFiltering = $this->getState('filter.date_filtering', 'off');
$dateField = $this->getState('filter.date_field', 'a.created');
switch ($dateFiltering)
{
case 'range':
$startDateRange = $db->quote($this->getState('filter.start_date_range', $nullDate));
$endDateRange = $db->quote($this->getState('filter.end_date_range', $nullDate));
$query->where(
'(' . $dateField . ' >= ' . $startDateRange . ' AND ' . $dateField .
' <= ' . $endDateRange . ')'
);
break;
case 'relative':
$relativeDate = (int) $this->getState('filter.relative_date', 0);
$query->where(
$dateField . ' >= ' . $query->dateAdd($nowDate, -1 * $relativeDate, 'DAY')
);
break;
case 'off':
default:
break;
}
// Process the filter for list views with user-entered filters
if (is_object($params) && ($params->get('filter_field') !== 'hide') && ($filter = $this->getState('list.filter')))
{
// Clean filter variable
$filter = StringHelper::strtolower($filter);
$monthFilter = $filter;
$hitsFilter = (int) $filter;
$filter = $db->quote('%' . $db->escape($filter, true) . '%', false);
switch ($params->get('filter_field'))
{
case 'author':
$query->where(
'LOWER( CASE WHEN a.created_by_alias > ' . $db->quote(' ') .
' THEN a.created_by_alias ELSE ua.name END ) LIKE ' . $filter . ' '
);
break;
case 'hits':
$query->where('a.hits >= ' . $hitsFilter . ' ');
break;
case 'month':
if ($monthFilter != '')
{
$query->where(
$db->quote(date("Y-m-d", strtotime($monthFilter)) . ' 00:00:00') . ' <= CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END'
);
$query->where(
$db->quote(date("Y-m-t", strtotime($monthFilter)) . ' 23:59:59') . ' >= CASE WHEN a.publish_up = ' .
$db->quote($db->getNullDate()) . ' THEN a.created ELSE a.publish_up END'
);
}
break;
case 'title':
default:
// Default to 'title' if parameter is not valid
$query->where('LOWER( a.title ) LIKE ' . $filter);
break;
}
}
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language IN (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
// Filter by a single or group of tags.
$tagId = $this->getState('filter.tag');
if (is_array($tagId) && count($tagId) === 1)
{
$tagId = current($tagId);
}
if (is_array($tagId))
{
$tagId = implode(',', ArrayHelper::toInteger($tagId));
if ($tagId)
{
$subQuery = $db->getQuery(true)
->select('DISTINCT content_item_id')
->from($db->quoteName('#__contentitem_tag_map'))
->where('tag_id IN (' . $tagId . ')')
->where('type_alias = ' . $db->quote('com_content_custom.article'));
$query->innerJoin('(' . (string) $subQuery . ') AS tagmap ON tagmap.content_item_id = a.id');
}
}
elseif ($tagId)
{
$query->innerJoin(
$db->quoteName('#__contentitem_tag_map', 'tagmap')
. ' ON tagmap.tag_id = ' . (int) $tagId
. ' AND tagmap.content_item_id = a.id'
. ' AND tagmap.type_alias = ' . $db->quote('com_content_custom.article')
);
}
// Add the list ordering clause.
$query->order($this->getState('list.ordering', 'a.ordering') . ' ' . $this->getState('list.direction', 'ASC'));
return $query;
}
/**
* Method to get a list of articles.
*
* Overriden to inject convert the attribs field into a JParameter object.
*
* @return mixed An array of objects on success, false on failure.
*
* @since 1.6
*/
public function getItems()
{
$items = parent::getItems();
$user = JFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
$input = JFactory::getApplication()->input;
// Get the global params
$globalParams = JComponentHelper::getParams('com_content_custom', true);
// Convert the parameter fields into objects.
foreach ($items as &$item)
{
$articleParams = new Registry($item->attribs);
// Unpack readmore and layout params
$item->alternative_readmore = $articleParams->get('alternative_readmore');
$item->layout = $articleParams->get('layout');
$item->params = clone $this->getState('params');
/**
* For blogs, article params override menu item params only if menu param = 'use_article'
* Otherwise, menu item params control the layout
* If menu item is 'use_article' and there is no article param, use global
*/
if (($input->getString('layout') === 'blog') || ($input->getString('view') === 'featured')
|| ($this->getState('params')->get('layout_type') === 'blog'))
{
// Create an array of just the params set to 'use_article'
$menuParamsArray = $this->getState('params')->toArray();
$articleArray = array();
foreach ($menuParamsArray as $key => $value)
{
if ($value === 'use_article')
{
// If the article has a value, use it
if ($articleParams->get($key) != '')
{
// Get the value from the article
$articleArray[$key] = $articleParams->get($key);
}
else
{
// Otherwise, use the global value
$articleArray[$key] = $globalParams->get($key);
}
}
}
// Merge the selected article params
if (count($articleArray) > 0)
{
$articleParams = new Registry($articleArray);
$item->params->merge($articleParams);
}
}
else
{
// For non-blog layouts, merge all of the article params
$item->params->merge($articleParams);
}
// Get display date
switch ($item->params->get('list_show_date'))
{
case 'modified':
$item->displayDate = $item->modified;
break;
case 'published':
$item->displayDate = ($item->publish_up == 0) ? $item->created : $item->publish_up;
break;
default:
case 'created':
$item->displayDate = $item->created;
break;
}
/**
* Compute the asset access permissions.
* Technically guest could edit an article, but lets not check that to improve performance a little.
*/
if (!$guest)
{
$asset = 'com_content_custom.article.' . $item->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
{
$item->params->set('access-edit', true);
}
// Now check if edit.own is available.
elseif (!empty($userId) && $user->authorise('core.edit.own', $asset))
{
// Check for a valid user and that they are the owner.
if ($userId == $item->created_by)
{
$item->params->set('access-edit', true);
}
}
}
$access = $this->getState('filter.access');
if ($access)
{
// If the access filter has been set, we already have only the articles this user can view.
$item->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility for display of limited information.
if ($item->catid == 0 || $item->category_access === null)
{
$item->params->set('access-view', in_array($item->access, $groups));
}
else
{
$item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups));
}
}
// Some contexts may not use tags data at all, so we allow callers to disable loading tag data
if ($this->getState('load_tags', $item->params->get('show_tags', '1')))
{
$item->tags = new JHelperTags;
$item->tags->getItemTags('com_content_custom.article', $item->id);
}
}
return $items;
}
/**
* Method to get the starting number of items for the data set.
*
* @return integer The starting number of items available in the data set.
*
* @since 3.0.1
*/
public function getStart()
{
return $this->getState('list.start');
}
/**
* Count Items by Month
*
* @return mixed An array of objects on success, false on failure.
*
* @since 3.9.0
*/
public function countItemsByMonth()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$query
->select('DATE(' .
$query->concatenate(
array(
$query->year($query->quoteName('publish_up')),
$query->quote('-'),
$query->month($query->quoteName('publish_up')),
$query->quote('-01')
)
) . ') as d'
)
->select('COUNT(*) as c')
->from('(' . $this->getListQuery() . ') as b')
->group($query->quoteName('d'))
->order($query->quoteName('d') . ' desc');
return $db->setQuery($query)->loadObjectList();
}
}
<?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'));
}
}
}
# 月次アーカイブ用モジュール
公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。
インストールしていない場合は、管理画面よりインストールする必要があります。
## インストール手順
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_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="# of Months"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="The number of months to display (the default is 10)."
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="Display a list of calendar months, including published articles. This list is automatically generated when you create a published article."
MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="Articles - Archived - custom"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="Display a list of calendar months, including published articles. This list is automatically generated when you create a published article."
MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="Default"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_articles_archive
*
* @since 1.5
*/
class ModArchiveHelper
{
/**
* Retrieve list of archived articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
// Get database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
->select('MIN(' . $db->quoteName('created') . ') AS created')
->select($query->year($db->quoteName('created')) . ' AS created_year')
->from('#__content')
->where('state = 1')
->group($query->year($db->quoteName('created')) . ', ' . $query->month($db->quoteName('created')))
->order($query->year($db->quoteName('created')) . ' DESC, ' . $query->month($db->quoteName('created')) . ' DESC');
// Filter by language
if (JFactory::getApplication()->getLanguageFilter())
{
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, (int) $params->get('count'));
try
{
$rows = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
return array();
}
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItems('link', 'index.php?option=com_content_custom&view=archive', true);
$itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : '';
$i = 0;
$lists = array();
foreach ($rows as $row)
{
$date = JFactory::getDate($row->created);
$createdMonth = $date->format('n');
$createdYear = $date->format('Y');
$createdYearCal = JHtml::_('date', $row->created, 'Y') . "年";
$monthNameCal = JHtml::_('date', $row->created, 'F');
$createdDateCal = $createdYearCal . $monthNameCal;
$lists[$i] = new stdClass;
$lists[$i]->link = JRoute::_('index.php?option=com_content_custom&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid);
$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_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL="表示月数"
MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC="表示する月数(標準は10)です。"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_ARTICLES_ARCHIVE_CUSTOM_DATE="%1$s, %2$s"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_ARCHIVE_CUSTOM="カスタムアーカイブ(モジュール)"
MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION="公開状態になっている記事を含むカレンダー月の一覧を表示します。公開状態になっている記事を作成すると、この一覧は自動的に生成されます。"
MOD_ARTICLES_ARCHIVE_CUSTOM_LAYOUT_DEFAULT="標準"
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the archive functions only once
JLoader::register('ModArchiveHelper', __DIR__ . '/helper.php');
$params->def('count', 10);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
$list = ModArchiveHelper::getList($params);
require JModuleHelper::getLayoutPath('mod_articles_archive_custom', $params->get('layout', 'default'));
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>MOD_ARTICLES_ARCHIVE_CUSTOM</name>
<author>T.Tokudome</author>
<creationDate>June 2020</creationDate>
<copyright></copyright>
<license></license>
<authorEmail>tokudome@lilli.co.jp</authorEmail>
<authorUrl></authorUrl>
<version>0.0.1</version>
<description>MOD_ARTICLES_ARCHIVE_CUSTOM_XML_DESCRIPTION</description>
<files>
<filename module="mod_articles_archive_custom">mod_articles_archive_custom.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_articles_archive_custom.ini</language>
<language tag="en-GB">en-GB.mod_articles_archive_custom.sys.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_archive_custom.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_archive_custom.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_ARCHIVE" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="count"
type="number"
label="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_LABEL"
description="MOD_ARTICLES_ARCHIVE_CUSTOM_FIELD_COUNT_DESC"
default="120"
filter="integer"
/>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
default="1"
filter="integer"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="static"
>
<option value="static"></option>
</field>
</fieldset>
</fields>
</config>
</extension>
\ No newline at end of file
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if (!empty($list)) : ?>
<ul class="archive-module-custom<?php echo $moduleclass_sfx; ?> mod-list">
<?php foreach ($list as $item) : ?>
<li>
<a href="<?php echo $item->link; ?>">
<?php echo $item->text; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
......@@ -62,7 +62,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;
......@@ -75,7 +76,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 {
......@@ -88,7 +93,8 @@ a.outlink {
display: none;
}
.item-page .icons,
.blog .icons {
.blog .icons,
.archive-custom .icons {
/*display: none;*/
}
table {
......@@ -274,6 +280,7 @@ h1, h2, h3, h4, h5, h6, .site-title {
line-height: 1;
margin: 0;
}
/* 記述エラーで機能していないため、コメントアウト
.item-page h2,
.item-page h3,
.item-page h4,
......@@ -284,16 +291,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;
......@@ -305,7 +319,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;
......@@ -314,7 +328,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%;
......@@ -323,7 +337,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;
......@@ -540,14 +554,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%;
......@@ -559,24 +578,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;
}
......@@ -1098,7 +1122,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;
......@@ -1476,7 +1501,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%;
}
......@@ -1529,7 +1555,8 @@ td.num01 {
}
.item-page table ul,
.blog table ul {
.blog table ul,
.archive-custom table ul {
margin: 0 0 0 15px;
}
......@@ -1576,16 +1603,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;
}
......@@ -1696,33 +1726,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,
......@@ -1740,17 +1777,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;
}
......@@ -1921,7 +1961,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 {
......@@ -2103,7 +2144,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;
}
......@@ -2211,7 +2258,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;
}
......@@ -2273,7 +2321,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;
}
......@@ -2351,17 +2411,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;
}
......@@ -3040,12 +3103,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;
}
......@@ -3187,7 +3252,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;
......@@ -3272,12 +3337,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%;
......@@ -3362,5 +3427,35 @@ body.itemid-132 table {
}
}
/* -------------------------------------------------------------------------
 app/modules/mod_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;
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!