BxBaseModTextSearchResult.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup BaseText Base classes for text modules
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxTemplSearchResult');
  12. class BxBaseModTextSearchResult extends BxTemplSearchResult
  13. {
  14. protected $oModule;
  15. protected $aUnitViews = array('extended' => 'unit.html', 'gallery' => 'unit_gallery.html');
  16. protected $sUnitViewDefault = 'gallery';
  17. protected $sUnitViewParamName = 'unit_view';
  18. function __construct($sMode = '', $aParams = array())
  19. {
  20. parent::__construct();
  21. $this->aGetParams = array($this->sUnitViewParamName);
  22. $this->sUnitTemplate = $this->aUnitViews[$this->sUnitViewDefault];
  23. if (isset($this->aUnitViews[bx_get($this->sUnitViewParamName)]))
  24. $this->sUnitTemplate = $this->aUnitViews[bx_get($this->sUnitViewParamName)];
  25. }
  26. function getMain()
  27. {
  28. return BxDolModule::getInstance($this->aCurrent['name']);
  29. }
  30. function getDesignBoxMenu ()
  31. {
  32. $aMenu = parent::getDesignBoxMenu ();
  33. return array_merge(
  34. array(
  35. array('name' => 'gallery', 'title' => _t('_sys_menu_title_gallery'), 'link' => $this->getCurrentUrl(array($this->sUnitViewParamName => 'gallery')), 'icon' => 'th'),
  36. array('name' => 'extended', 'title' => _t('_sys_menu_title_extended'), 'link' => $this->getCurrentUrl(array($this->sUnitViewParamName => 'extended')), 'icon' => 'list'),
  37. ),
  38. $aMenu
  39. );
  40. }
  41. function getRssUnitLink (&$a)
  42. {
  43. $CNF = &$this->oModule->_oConfig->CNF;
  44. bx_import('BxDolPermalinks');
  45. return BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $a[$CNF['FIELD_ID']]);
  46. }
  47. function getRssPageUrl ()
  48. {
  49. if (false === parent::getRssPageUrl())
  50. return false;
  51. bx_import('BxDolPermalinks');
  52. $oPermalinks = BxDolPermalinks::getInstance();
  53. return BX_DOL_URL_ROOT . $oPermalinks->permalink($this->aCurrent['rss']['link']);
  54. }
  55. function rss ()
  56. {
  57. if (!isset($this->aCurrent['rss']))
  58. return '';
  59. $this->aCurrent['paginate']['perPage'] = getParam($this->oModule->_oConfig->CNF['PARAM_NUM_RSS']);
  60. return parent::rss();
  61. }
  62. function _getPseud ()
  63. {
  64. return array(
  65. 'id' => 'id',
  66. 'title' => 'title',
  67. 'text' => 'text',
  68. 'added' => 'added',
  69. 'author' => 'author',
  70. 'photo' => 'photo',
  71. );
  72. }
  73. }
  74. /** @} */