BxDolStudioNavigation.php 1.9 KB

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