BxBaseModPaymentGridCommissions.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup BasePayment Base classes for Payment like modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModPaymentGridCommissions extends BxTemplGrid
  12. {
  13. protected $_sModule;
  14. protected $_oModule;
  15. protected $_sLangsPrefix;
  16. protected $_aAclLevels;
  17. public function __construct ($aOptions, $oTemplate = false)
  18. {
  19. parent::__construct ($aOptions, $oTemplate);
  20. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  21. $this->_sLangsPrefix = $this->_oModule->_oConfig->getPrefix('langs');
  22. $this->_aAclLevels = BxDolAcl::getInstance()->getMemberships(false, true, true, true);
  23. }
  24. protected function _getCellAclId($mixedValue, $sKey, $aField, $aRow)
  25. {
  26. $mixedValue = isset($this->_aAclLevels[$mixedValue]) > 0 ? $this->_aAclLevels[$mixedValue] : _t('_all');
  27. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  28. }
  29. protected function _getCellPercentage($mixedValue, $sKey, $aField, $aRow)
  30. {
  31. $mixedValue = (float)$mixedValue > 0 ? $mixedValue . '%' : '';
  32. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  33. }
  34. protected function _getCellInstallment($mixedValue, $sKey, $aField, $aRow)
  35. {
  36. $mixedValue = (float)$mixedValue > 0 ? _t_format_currency($mixedValue) : '';
  37. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  38. }
  39. }
  40. /** @} */