BxDolStudioNavigation.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 DolphinStudio Dolphin 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. protected $sPage;
  17. function __construct($sPage = "") {
  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. //--- Check actions ---//
  24. if(($sAction = bx_get('nav_action')) !== false) {
  25. $sAction = bx_process_input($sAction);
  26. $aResult = array('code' => 1, 'message' => _t('_adm_nav_err_cannot_process_action'));
  27. switch($sAction) {
  28. case 'get-page-by-type':
  29. $sValue = bx_process_input(bx_get('nav_value'));
  30. if(empty($sValue))
  31. break;
  32. $this->sPage = $sValue;
  33. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  34. break;
  35. default:
  36. $sMethod = 'action' . $this->getClassName($sAction);
  37. if(method_exists($this, $sMethod))
  38. $aResult = $this->$sMethod();
  39. }
  40. $oJson = new Services_JSON();
  41. echo $oJson->encode($aResult);
  42. exit;
  43. }
  44. }
  45. }
  46. /** @} */