BxAclGridLevels.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 PaidLevels Paid Levels
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAclGridLevels extends BxTemplGrid
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. protected $_aPeriodUnits;
  16. public function __construct ($aOptions, $oTemplate = false)
  17. {
  18. $this->MODULE = 'bx_acl';
  19. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  20. parent::__construct ($aOptions, $oTemplate);
  21. $CNF = $this->_oModule->_oConfig->CNF;
  22. $this->_aPeriodUnits = BxDolForm::getDataItems($CNF['OBJECT_FORM_PRELISTS_PERIOD_UNITS']);
  23. }
  24. protected function _getCellPeriod($mixedValue, $sKey, $aField, $aRow)
  25. {
  26. if((int)$mixedValue == 0)
  27. $mixedValue = _t('_bx_acl_txt_lifetime');
  28. else
  29. $mixedValue = _t('_bx_acl_txt_n_unit', $mixedValue, _t($this->_aPeriodUnits[$aRow['period_unit']]));
  30. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  31. }
  32. protected function _getCellPrice($mixedValue, $sKey, $aField, $aRow)
  33. {
  34. if((float)$mixedValue != 0) {
  35. $aCurrency = $this->_oModule->_oConfig->getCurrency();
  36. $mixedValue = $aCurrency['sign'] . $mixedValue;
  37. }
  38. else
  39. $mixedValue = _t('_bx_acl_txt_free');
  40. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  41. }
  42. protected function _getCellTrial($mixedValue, $sKey, $aField, $aRow)
  43. {
  44. $mixedValue = (int)$mixedValue != 0 ? _t('_bx_acl_txt_n_unit', $mixedValue, _t($this->_aPeriodUnits['day'])) : _t('_bx_acl_txt_none');
  45. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  46. }
  47. protected function _getIds()
  48. {
  49. $aIds = bx_get('ids');
  50. if(!$aIds || !is_array($aIds)) {
  51. $iId = (int)bx_get('id');
  52. if(!$iId)
  53. return false;
  54. $aIds = array($iId);
  55. }
  56. return $aIds;
  57. }
  58. }
  59. /** @} */