PageRenderTime 30ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/mod_articles_category/mod_articles_category.php

https://bitbucket.org/izubizarreta/https-bitbucket.org-bityvip
PHP | 84 lines | 64 code | 11 blank | 9 comment | 4 complexity | 404d83c90ea2a2ada3415de171438ebf MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.0, JSON, GPL-2.0, BSD-3-Clause, LGPL-2.1, MIT
  1. <?php
  2. /**
  3. * @package Joomla.Site
  4. * @subpackage mod_articles_category
  5. * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  6. * @license GNU General Public License version 2 or later; see LICENSE.txt
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. // Include the helper functions only once
  11. require_once dirname(__FILE__).'/helper.php';
  12. // Prep for Normal or Dynamic Modes
  13. $mode = $params->get('mode', 'normal');
  14. $idbase = null;
  15. switch($mode)
  16. {
  17. case 'dynamic':
  18. $option = JRequest::getCmd('option');
  19. $view = JRequest::getCmd('view');
  20. if ($option === 'com_content') {
  21. switch($view)
  22. {
  23. case 'category':
  24. $idbase = JRequest::getInt('id');
  25. break;
  26. case 'categories':
  27. $idbase = JRequest::getInt('id');
  28. break;
  29. case 'article':
  30. if ($params->get('show_on_article_page', 1)) {
  31. $idbase = JRequest::getInt('catid');
  32. }
  33. break;
  34. }
  35. }
  36. break;
  37. case 'normal':
  38. default:
  39. $idbase = $params->get('catid');
  40. break;
  41. }
  42. $cacheid = md5(serialize(array ($idbase, $module->module)));
  43. $cacheparams = new stdClass;
  44. $cacheparams->cachemode = 'id';
  45. $cacheparams->class = 'modArticlesCategoryHelper';
  46. $cacheparams->method = 'getList';
  47. $cacheparams->methodparams = $params;
  48. $cacheparams->modeparams = $cacheid;
  49. $list = JModuleHelper::moduleCache ($module, $params, $cacheparams);
  50. if (!empty($list)) {
  51. $grouped = false;
  52. $article_grouping = $params->get('article_grouping', 'none');
  53. $article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
  54. $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
  55. $item_heading = $params->get('item_heading');
  56. if ($article_grouping !== 'none') {
  57. $grouped = true;
  58. switch($article_grouping)
  59. {
  60. case 'year':
  61. case 'month_year':
  62. $list = modArticlesCategoryHelper::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y'));
  63. break;
  64. case 'author':
  65. case 'category_title':
  66. $list = modArticlesCategoryHelper::groupBy($list, $article_grouping, $article_grouping_direction);
  67. break;
  68. default:
  69. break;
  70. }
  71. }
  72. require JModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default'));
  73. }