BxAclGridView.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 ACL ACL
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. class BxAclGridView extends BxTemplGrid
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. protected $_iOwner;
  16. protected $_oPayment;
  17. public function __construct ($aOptions, $oTemplate = false)
  18. {
  19. $this->MODULE = 'bx_acl';
  20. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  21. parent::__construct ($aOptions, $this->_oModule->_oTemplate);
  22. $this->_iOwner = $this->_oModule->_oConfig->getOwner();
  23. $this->_oPayment = BxDolPayments::getInstance();
  24. }
  25. public function getCode($isDisplayHeader = true)
  26. {
  27. return $this->_oPayment->getCartJs() . parent::getCode($isDisplayHeader);
  28. }
  29. protected function _getCellPeriodUnit($mixedValue, $sKey, $aField, $aRow)
  30. {
  31. $mixedValue = _t('_bx_acl_pre_values_' . $mixedValue);
  32. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  33. }
  34. protected function _getCellPrice($mixedValue, $sKey, $aField, $aRow)
  35. {
  36. $aCurrency = $this->_oModule->_oConfig->getCurrency();
  37. return parent::_getCellDefault($aCurrency['sign'] . $mixedValue, $sKey, $aField, $aRow);
  38. }
  39. protected function _getActionBuy ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  40. {
  41. $aJs = $this->_oPayment->getAddToCartJs($this->_iOwner, $this->MODULE, $aRow['id'], 1, true);
  42. if(!empty($aJs) && is_array($aJs)) {
  43. list($sJsCode, $sJsMethod) = $aJs;
  44. $a['attr'] = array(
  45. 'onclick' => $sJsMethod
  46. );
  47. }
  48. return parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
  49. }
  50. protected function _getActionSubscribe ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
  51. {
  52. $aJs = $this->_oPayment->getSubscribeJs($this->_iOwner, '', $this->MODULE, $aRow['id'], 1);
  53. if(!empty($aJs) && is_array($aJs)) {
  54. list($sJsCode, $sJsMethod) = $aJs;
  55. $a['attr'] = array(
  56. 'onclick' => $sJsMethod
  57. );
  58. }
  59. return parent::_getActionDefault($sType, $sKey, $a, false, $isDisabled, $aRow);
  60. }
  61. }
  62. /** @} */