BxDevStudioPage.php 4.7 KB

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