BxDolStudioNavigation.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_NAV_TYPE_MENUS', 'menus');
  10. define('BX_DOL_STUDIO_NAV_TYPE_SETS', 'sets');
  11. define('BX_DOL_STUDIO_NAV_TYPE_ITEMS', 'items');
  12. define('BX_DOL_STUDIO_NAV_TYPE_DEFAULT', BX_DOL_STUDIO_NAV_TYPE_MENUS);
  13. class BxDolStudioNavigation extends BxTemplStudioPage
  14. {
  15. protected $sPage;
  16. function __construct($sPage = "")
  17. {
  18. parent::__construct('builder_menus');
  19. $this->oDb = new BxDolStudioNavigationQuery();
  20. $this->sPage = BX_DOL_STUDIO_NAV_TYPE_DEFAULT;
  21. if(is_string($sPage) && !empty($sPage))
  22. $this->sPage = $sPage;
  23. }
  24. public function init()
  25. {
  26. if(($sAction = bx_get('nav_action')) === false)
  27. return;
  28. $sAction = bx_process_input($sAction);
  29. $aResult = array('code' => 1, 'message' => _t('_adm_nav_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. echo json_encode($aResult);
  44. exit;
  45. }
  46. }
  47. /** @} */