diff --git a/language/en-GB/en-GB.mod_articles_category.ini b/language/en-GB/en-GB.mod_articles_category.ini index bdcce35170e3d..cebfbc76f4daf 100644 --- a/language/en-GB/en-GB.mod_articles_category.ini +++ b/language/en-GB/en-GB.mod_articles_category.ini @@ -27,6 +27,8 @@ MOD_ARTICLES_CATEGORY_FIELD_CATFILTERINGTYPE_DESC="Select Inclusive to Include t MOD_ARTICLES_CATEGORY_FIELD_CATFILTERINGTYPE_LABEL="Category Filtering Type" MOD_ARTICLES_CATEGORY_FIELD_COUNT_DESC="The number of items to display. The default value of 0 will display all articles." MOD_ARTICLES_CATEGORY_FIELD_COUNT_LABEL="Count" +MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_DESC="Select which date field you want the date grouping to be applied to." +MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_LABEL="Date Grouping Field" MOD_ARTICLES_CATEGORY_FIELD_DATERANGEFIELD_DESC="Select which date field you want the date range to be applied to." MOD_ARTICLES_CATEGORY_FIELD_DATERANGEFIELD_LABEL="Date Range Field" MOD_ARTICLES_CATEGORY_FIELD_DATEFIELD_DESC="Select which date field you want to display." @@ -97,4 +99,4 @@ MOD_ARTICLES_CATEGORY_OPTION_YEAR_VALUE="Year" MOD_ARTICLES_CATEGORY_READ_MORE="Read more: " MOD_ARTICLES_CATEGORY_READ_MORE_TITLE="Read More ..." MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE="Register to read more" -MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." \ No newline at end of file +MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." diff --git a/modules/mod_articles_category/helper.php b/modules/mod_articles_category/helper.php index d046a8fb0e97e..49acbf4a496f8 100644 --- a/modules/mod_articles_category/helper.php +++ b/modules/mod_articles_category/helper.php @@ -437,12 +437,13 @@ public static function groupBy($list, $fieldName, $article_grouping_direction, $ * @param string $type type of grouping * @param string $article_grouping_direction ordering direction * @param string $month_year_format date format to use + * @param string $dateField date field to group by * * @return array * * @since 1.6 */ - public static function groupByDate($list, $type = 'year', $article_grouping_direction, $month_year_format = 'F Y') + public static function groupByDate($list, $type = 'year', $article_grouping_direction, $month_year_format = 'F Y', $dateField = 'created') { $grouped = array(); @@ -461,7 +462,7 @@ public static function groupByDate($list, $type = 'year', $article_grouping_dire switch ($type) { case 'month_year' : - $month_year = StringHelper::substr($item->created, 0, 7); + $month_year = StringHelper::substr($item->$dateField, 0, 7); if (!isset($grouped[$month_year])) { @@ -473,7 +474,7 @@ public static function groupByDate($list, $type = 'year', $article_grouping_dire case 'year' : default: - $year = StringHelper::substr($item->created, 0, 4); + $year = StringHelper::substr($item->$dateField, 0, 4); if (!isset($grouped[$year])) { diff --git a/modules/mod_articles_category/mod_articles_category.php b/modules/mod_articles_category/mod_articles_category.php index ed1d05a6c0780..9687271cc09ef 100644 --- a/modules/mod_articles_category/mod_articles_category.php +++ b/modules/mod_articles_category/mod_articles_category.php @@ -76,7 +76,13 @@ { case 'year' : case 'month_year' : - $list = ModArticlesCategoryHelper::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y')); + $list = ModArticlesCategoryHelper::groupByDate( + $list, + $article_grouping, + $article_grouping_direction, + $params->get('month_year_format', 'F Y'), + $params->get('date_grouping_field', 'created') + ); break; case 'author' : case 'category_title' : diff --git a/modules/mod_articles_category/mod_articles_category.xml b/modules/mod_articles_category/mod_articles_category.xml index b165a209000ff..afe6a5d230d81 100644 --- a/modules/mod_articles_category/mod_articles_category.xml +++ b/modules/mod_articles_category/mod_articles_category.xml @@ -348,6 +348,28 @@ + + + + + + + + MOD_ARTICLES_CATEGORY_OPTION_ASCENDING_VALUE -