BxDevStudioPage.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php defined('BX_DOL') or die('hack attempt');
  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 Developer Developer
  7. * @ingroup DolphinModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxTemplStudioModule');
  12. class BxDevStudioPage extends BxTemplStudioModule
  13. {
  14. protected $oModule;
  15. protected $sUrl;
  16. function __construct($sModule = "", $sPage = "")
  17. {
  18. parent::__construct($sModule, $sPage);
  19. bx_import('BxDolModule');
  20. $this->oModule = BxDolModule::getInstance($this->sModule);
  21. $this->sUrl = BX_DOL_URL_STUDIO . 'module.php?name=%s&page=%s';
  22. }
  23. function getPageMenu($aMenu = array(), $aMarkers = array())
  24. {
  25. $this->aMenuItems = array();
  26. foreach($this->oModule->aTools as $aTool)
  27. $this->aMenuItems[] = array(
  28. 'name' => $aTool['name'],
  29. 'icon' => $aTool['icon'],
  30. 'link' => sprintf($this->sUrl, $this->sModule, $aTool['name']),
  31. 'title' => $aTool['title'],
  32. 'selected' => $aTool['name'] == $this->sPage
  33. );
  34. bx_import('BxTemplStudioMenu');
  35. $oMenu = new BxTemplStudioMenu(array('template' => 'menu_main.html', 'menu_items' => $this->aMenuItems), $this->oModule->_oTemplate);
  36. return $oMenu->getCode();
  37. }
  38. protected function getSettings()
  39. {
  40. bx_import('BxTemplStudioSettings');
  41. $oContent = new BxTemplStudioSettings($this->sModule);
  42. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  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. $oContent->init();
  54. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  55. }
  56. protected function getNavigation()
  57. {
  58. $sPage = bx_get('nav_page');
  59. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  60. bx_import('Navigation', $this->aModule);
  61. $oContent = new BxDevNavigation(array(
  62. 'page' => $sPage,
  63. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_NAVIGATION),
  64. ));
  65. $oContent->init();
  66. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  67. }
  68. protected function getPages()
  69. {
  70. $sType = bx_get('bp_type');
  71. $sType = $sType !== false ? bx_process_input($sType) : '';
  72. $sPage = bx_get('bp_page');
  73. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  74. bx_import('BuilderPage', $this->aModule);
  75. $oContent = new BxDevBuilderPage(array(
  76. 'type' => $sType,
  77. 'page' => $sPage,
  78. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PAGES),
  79. ));
  80. $oContent->init();
  81. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  82. }
  83. protected function getPolyglot()
  84. {
  85. $sType = bx_get('pgt_type');
  86. $sType = $sType !== false ? bx_process_input($sType) : '';
  87. $sPage = bx_get('pgt_page');
  88. $sPage = $sPage !== false ? bx_process_input($sPage) : 'manager';
  89. bx_import('Polyglot', $this->aModule);
  90. $oContent = new BxDevPolyglot(array(
  91. 'page' => $sPage,
  92. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_POLYGLOT),
  93. ));
  94. $oContent->init();
  95. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  96. }
  97. protected function getPermissions()
  98. {
  99. $sPage = bx_get('prm_page');
  100. $sPage = $sPage !== false ? bx_process_input($sPage) : '';
  101. bx_import('Permissions', $this->aModule);
  102. $oContent = new BxDevPermissions(array(
  103. 'page' => $sPage,
  104. 'url' => sprintf($this->sUrl, $this->sModule, BX_DEV_TOOLS_PERMISSIONS),
  105. ));
  106. $oContent->init();
  107. return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent);
  108. }
  109. }
  110. /** @} */