BxDevStudioPage.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 Developer Developer
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxDevStudioPage extends BxTemplStudioModule
  12. {
  13. protected $oModule;
  14. protected $sUrl;
  15. function __construct($sModule, $mixedPageName, $sPage = "")
  16. {
  17. parent::__construct($sModule, $mixedPageName, $sPage);
  18. $this->aPageCodeNoWrap = array('polyglot', 'forms', 'navigation', 'pages');
  19. $this->oModule = BxDolModule::getInstance($this->sModule);
  20. $this->sUrl = BX_DOL_URL_STUDIO . 'module.php?name=%s&page=%s';
  21. }
  22. function getPageMenu($aMenu = array(), $aMarkers = array())
  23. {
  24. $this->aMenuItems = array();
  25. foreach($this->oModule->aTools as $aTool)
  26. $this->aMenuItems[] = array(
  27. 'name' => $aTool['name'],
  28. 'icon' => $aTool['icon'],
  29. 'link' => sprintf($this->sUrl, $this->sModule, $aTool['name']),
  30. 'title' => $aTool['title'],
  31. 'selected' => $aTool['name'] == $this->sPage
  32. );
  33. $oMenu = new BxTemplStudioMenu(array('template' => 'menu_main.html', 'menu_items' => $this->aMenuItems), $this->oModule->_oTemplate);
  34. return $oMenu->getCode();
  35. }
  36. protected function getSettings()
  37. {
  38. $oContent = new BxTemplStudioSettings('system', 'hidden');
  39. if(($mixedResult = $oContent->checkAction()) !== false) {
  40. echoJson($mixedResult);
  41. exit;
  42. }
  43. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent, 'getFormCode');
  44. }
  45. protected function getForms()
  46. {
  47. $sPage = bx_get('form_page');
  48. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  49. bx_import('Forms', $this->aModule);
  50. $oContent = new BxDevForms(array(
  51. 'page' => $sPage,
  52. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_FORMS),
  53. ));
  54. if(($mixedResult = $oContent->checkAction()) !== false) {
  55. echoJson($mixedResult);
  56. exit;
  57. }
  58. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  59. }
  60. protected function getNavigation()
  61. {
  62. $sPage = bx_get('nav_page');
  63. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  64. bx_import('Navigation', $this->aModule);
  65. $oContent = new BxDevNavigation(array(
  66. 'page' => $sPage,
  67. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_NAVIGATION),
  68. ));
  69. if(($mixedResult = $oContent->checkAction()) !== false) {
  70. echoJson($mixedResult);
  71. exit;
  72. }
  73. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  74. }
  75. protected function getPages()
  76. {
  77. $sType = bx_get('bp_type');
  78. $sType = $sType !== false ? bx_process_input($sType) : '';
  79. $sPage = bx_get('bp_page');
  80. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  81. bx_import('BuilderPage', $this->aModule);
  82. $oContent = new BxDevBuilderPage(array(
  83. 'type' => $sType,
  84. 'page' => $sPage,
  85. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PAGES),
  86. ));
  87. if(($mixedResult = $oContent->checkAction()) !== false) {
  88. echoJson($mixedResult);
  89. exit;
  90. }
  91. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  92. }
  93. protected function getPolyglot()
  94. {
  95. $sType = bx_get('pgt_type');
  96. $sType = $sType !== false ? bx_process_input($sType) : '';
  97. $sPage = bx_get('pgt_page');
  98. $sPage = $sPage !== false ? bx_process_input($sPage) : 'manager';
  99. bx_import('Polyglot', $this->aModule);
  100. $oContent = new BxDevPolyglot(array(
  101. 'page' => $sPage,
  102. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_POLYGLOT),
  103. ));
  104. if(($mixedResult = $oContent->checkAction()) !== false) {
  105. echoJson($mixedResult);
  106. exit;
  107. }
  108. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  109. }
  110. protected function getPermissions()
  111. {
  112. $sPage = bx_get('prm_page');
  113. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  114. bx_import('Permissions', $this->aModule);
  115. $oContent = new BxDevPermissions(array(
  116. 'page' => $sPage,
  117. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PERMISSIONS),
  118. ));
  119. if(($mixedResult = $oContent->checkAction()) !== false) {
  120. echoJson($mixedResult);
  121. exit;
  122. }
  123. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  124. }
  125. }
  126. /** @} */