BxDevStudioPage.php 4.1 KB

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