BxDolStudioPermissions.php 1.4 KB

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