BxDolStudioNavigation.php 1.6 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 BxTemplStudioWidget
  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 checkAction()
  25. {
  26. $sAction = bx_get('nav_action');
  27. if($sAction === false)
  28. return false;
  29. $sAction = bx_process_input($sAction);
  30. $aResult = array('code' => 1, 'message' => _t('_adm_nav_err_cannot_process_action'));
  31. switch($sAction) {
  32. case 'get-page-by-type':
  33. $sValue = bx_process_input(bx_get('nav_value'));
  34. if(empty($sValue))
  35. break;
  36. $this->sPage = $sValue;
  37. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  38. break;
  39. default:
  40. $sMethod = 'action' . $this->getClassName($sAction);
  41. if(method_exists($this, $sMethod))
  42. $aResult = $this->$sMethod();
  43. }
  44. return $aResult;
  45. }
  46. }
  47. /** @} */