1
0

BxDolStudioNavigation.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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('BxDolStudioNavigationQuery');
  11. define('BX_DOL_STUDIO_NAV_TYPE_MENUS', 'menus');
  12. define('BX_DOL_STUDIO_NAV_TYPE_SETS', 'sets');
  13. define('BX_DOL_STUDIO_NAV_TYPE_ITEMS', 'items');
  14. define('BX_DOL_STUDIO_NAV_TYPE_DEFAULT', BX_DOL_STUDIO_NAV_TYPE_MENUS);
  15. class BxDolStudioNavigation extends BxTemplStudioPage
  16. {
  17. protected $sPage;
  18. function __construct($sPage = "")
  19. {
  20. parent::__construct('builder_menus');
  21. $this->oDb = new BxDolStudioNavigationQuery();
  22. $this->sPage = BX_DOL_STUDIO_NAV_TYPE_DEFAULT;
  23. if(is_string($sPage) && !empty($sPage))
  24. $this->sPage = $sPage;
  25. }
  26. public function init()
  27. {
  28. if(($sAction = bx_get('nav_action')) === false)
  29. return;
  30. $sAction = bx_process_input($sAction);
  31. $aResult = array('code' => 1, 'message' => _t('_adm_nav_err_cannot_process_action'));
  32. switch($sAction) {
  33. case 'get-page-by-type':
  34. $sValue = bx_process_input(bx_get('nav_value'));
  35. if(empty($sValue))
  36. break;
  37. $this->sPage = $sValue;
  38. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  39. break;
  40. default:
  41. $sMethod = 'action' . $this->getClassName($sAction);
  42. if(method_exists($this, $sMethod))
  43. $aResult = $this->$sMethod();
  44. }
  45. echo json_encode($aResult);
  46. exit;
  47. }
  48. }
  49. /** @} */