BxDevStudioPage.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 = "", $sPage = "")
  16. {
  17. parent::__construct($sModule, $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. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  39. }
  40. protected function getForms()
  41. {
  42. $sPage = bx_get('form_page');
  43. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  44. bx_import('Forms', $this->aModule);
  45. $oContent = new BxDevForms(array(
  46. 'page' => $sPage,
  47. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_FORMS),
  48. ));
  49. $oContent->init();
  50. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  51. }
  52. protected function getNavigation()
  53. {
  54. $sPage = bx_get('nav_page');
  55. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  56. bx_import('Navigation', $this->aModule);
  57. $oContent = new BxDevNavigation(array(
  58. 'page' => $sPage,
  59. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_NAVIGATION),
  60. ));
  61. $oContent->init();
  62. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  63. }
  64. protected function getPages()
  65. {
  66. $sType = bx_get('bp_type');
  67. $sType = $sType !== false ? bx_process_input($sType) : '';
  68. $sPage = bx_get('bp_page');
  69. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  70. bx_import('BuilderPage', $this->aModule);
  71. $oContent = new BxDevBuilderPage(array(
  72. 'type' => $sType,
  73. 'page' => $sPage,
  74. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PAGES),
  75. ));
  76. $oContent->init();
  77. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  78. }
  79. protected function getPolyglot()
  80. {
  81. $sType = bx_get('pgt_type');
  82. $sType = $sType !== false ? bx_process_input($sType) : '';
  83. $sPage = bx_get('pgt_page');
  84. $sPage = $sPage !== false ? bx_process_input($sPage) : 'manager';
  85. bx_import('Polyglot', $this->aModule);
  86. $oContent = new BxDevPolyglot(array(
  87. 'page' => $sPage,
  88. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_POLYGLOT),
  89. ));
  90. $oContent->init();
  91. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  92. }
  93. protected function getPermissions()
  94. {
  95. $sPage = bx_get('prm_page');
  96. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  97. bx_import('Permissions', $this->aModule);
  98. $oContent = new BxDevPermissions(array(
  99. 'page' => $sPage,
  100. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PERMISSIONS),
  101. ));
  102. $oContent->init();
  103. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  104. }
  105. }
  106. /** @} */