BxDolStudioPermissions.php 1.4 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 UnaStudio UNA Studio
  7. * @{
  8. */
  9. define('BX_DOL_STUDIO_PRM_TYPE_LEVELS', 'levels');
  10. define('BX_DOL_STUDIO_PRM_TYPE_ACTIONS', 'actions');
  11. define('BX_DOL_STUDIO_PRM_TYPE_DEFAULT', BX_DOL_STUDIO_PRM_TYPE_LEVELS);
  12. class BxDolStudioPermissions extends BxTemplStudioWidget
  13. {
  14. protected $sPage;
  15. function __construct($sPage = "")
  16. {
  17. parent::__construct('builder_permissions');
  18. $this->oDb = new BxDolStudioPermissionsQuery();
  19. $this->sPage = BX_DOL_STUDIO_PRM_TYPE_DEFAULT;
  20. if(is_string($sPage) && !empty($sPage))
  21. $this->sPage = $sPage;
  22. }
  23. public function checkAction()
  24. {
  25. $sAction = bx_get('pgt_action');
  26. if($sAction === false)
  27. return false;
  28. $sAction = bx_process_input($sAction);
  29. $aResult = array('code' => 1, 'message' => _t('_adm_pgt_err_cannot_process_action'));
  30. switch($sAction) {
  31. case 'get-page-by-type':
  32. $sValue = bx_process_input(bx_get('pgt_value'));
  33. if(empty($sValue))
  34. break;
  35. $this->sPage = $sValue;
  36. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  37. break;
  38. }
  39. return $aResult;
  40. }
  41. }
  42. /** @} */