BxBaseCategory.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 TridentCore Trident Core
  7. * @{
  8. */
  9. /**
  10. * Category objects representation.
  11. * @see BxDolCategory
  12. */
  13. class BxBaseCategory extends BxDolCategory
  14. {
  15. protected $_oTemplate;
  16. public function __construct ($aObject, $oTemplate = null)
  17. {
  18. parent::__construct ($aObject);
  19. if ($oTemplate)
  20. $this->_oTemplate = $oTemplate;
  21. else
  22. $this->_oTemplate = BxDolTemplate::getInstance();
  23. }
  24. public function getCategoryUrl($sName, $sValue, $sCategoryObject)
  25. {
  26. $sUrl = BX_DOL_URL_ROOT . 'searchKeyword.php?cat=' . rawurlencode($sCategoryObject) . '&keyword=' . rawurlencode($sValue);
  27. if ($this->_aObject['search_object'])
  28. $sUrl .= '&section[]=' . rawurlencode($this->_aObject['search_object']);
  29. return $sUrl;
  30. }
  31. /**
  32. * Get link to list all items with the same category
  33. */
  34. public function getCategoryLink($sName, $sValue, $sCategoryObject)
  35. {
  36. $sUrl = $this->getCategoryUrl($sName, $sValue, $sCategoryObject);
  37. return '<a href="' . $sUrl . '">' . $sName . '</a>';
  38. }
  39. /**
  40. * Get all categories list
  41. */
  42. public function getCategoriesList()
  43. {
  44. // TODO:
  45. }
  46. }
  47. /** @} */