e5a93a01 by TaishiTokudome

コンポーネント、モジュールのソース管理ディレクトリの追加をリモートからpull

2 parents 66ed564e 9b753ffa
Showing 29 changed files with 1645 additions and 0 deletions
<?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'));
}
}
}
; 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; ?>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!