1
0

BxDolStudioStorages.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_STRG_TYPE_FILES', 'files');
  10. define('BX_DOL_STUDIO_STRG_TYPE_IMAGES', 'images');
  11. define('BX_DOL_STUDIO_STRG_TYPE_DEFAULT', BX_DOL_STUDIO_STRG_TYPE_FILES);
  12. class BxDolStudioStorages extends BxTemplStudioWidget
  13. {
  14. protected $sPage;
  15. function __construct($sPage = "")
  16. {
  17. parent::__construct('storages');
  18. $this->oDb = new BxDolStudioStoragesQuery();
  19. $this->sPage = BX_DOL_STUDIO_STRG_TYPE_DEFAULT;
  20. if(is_string($sPage) && !empty($sPage))
  21. $this->sPage = $sPage;
  22. }
  23. public function checkAction()
  24. {
  25. $sAction = bx_get('strg_action');
  26. if($sAction === false)
  27. return false;
  28. $sAction = bx_process_input($sAction);
  29. $aResult = array('code' => 1, 'message' => _t('_adm_strg_err_cannot_process_action'));
  30. switch($sAction) {
  31. case 'get-page-by-type':
  32. $sValue = bx_process_input(bx_get('nav_value'));
  33. if(empty($sValue))
  34. break;
  35. $this->sPage = $sValue;
  36. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  37. break;
  38. default:
  39. $sMethod = 'action' . $this->getClassName($sAction);
  40. if(method_exists($this, $sMethod))
  41. $aResult = $this->$sMethod();
  42. }
  43. return $aResult;
  44. }
  45. }
  46. /** @} */