BxAclResponse.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 BxAclResponse extends BxDolAlertsResponse
  12. {
  13. protected $MODULE;
  14. protected $_oModule;
  15. public function __construct()
  16. {
  17. $this->MODULE = 'bx_acl';
  18. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  19. parent::__construct();
  20. }
  21. /**
  22. * Overwtire the method of parent class.
  23. *
  24. * @param BxDolAlerts $oAlert an instance of alert.
  25. */
  26. public function response($oAlert)
  27. {
  28. $sMethod = '_process' . bx_gen_method_name($oAlert->sUnit . '_' . $oAlert->sAction);
  29. if(!method_exists($this, $sMethod))
  30. return;
  31. $this->$sMethod($oAlert);
  32. }
  33. protected function _processSystemPageOutputBlockAclLevel($oAlert)
  34. {
  35. if((int)$oAlert->aExtras['block_owner'] != $this->_oModule->getUserId())
  36. return;
  37. $oAlert->aExtras['block_tmpl_vars']['bx_if:show_actions']['content']['bx_repeat:actions'][] = [
  38. 'href' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oModule->_oConfig->CNF['URL_VIEW']),
  39. 'bx_if:show_onclick' => [
  40. 'condition' => false,
  41. 'content' => [
  42. 'onclick' => ''
  43. ]
  44. ],
  45. 'content' => _t('_bx_acl_txt_upgrade')
  46. ];
  47. $oAlert->aExtras['block_code'] = BxDolTemplate::getInstance()->parseHtmlByName($oAlert->aExtras['block_tmpl_name'], $oAlert->aExtras['block_tmpl_vars']);
  48. }
  49. protected function _processAclDeleted($oAlert)
  50. {
  51. $this->_oModule->_oDb->deletePrices(array('level_id' => $oAlert->iObject));
  52. }
  53. }
  54. /** @} */