BxBaseStudioDesign.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  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 DolphinView Dolphin Studio Representation classes
  7. * @ingroup DolphinStudio
  8. * @{
  9. */
  10. defined('BX_DOL') or die('hack attempt');
  11. bx_import('BxDolStudioTemplate');
  12. bx_import('BxDolStudioDesign');
  13. class BxBaseStudioDesign extends BxDolStudioDesign {
  14. protected $aMenuItems = array(
  15. 'general' => '_adm_lmi_cpt_general'
  16. );
  17. function BxBaseStudioDesign($sTemplate = "", $sPage = "") {
  18. parent::BxDolStudioDesign($sTemplate, $sPage);
  19. }
  20. function getPageCss() {
  21. return array_merge(parent::getPageCss(), array());
  22. }
  23. function getPageJs() {
  24. return array_merge(parent::getPageJs(), array('settings.js', 'design.js'));
  25. }
  26. function getPageJsObject() {
  27. return 'oBxDolStudioDesign';
  28. }
  29. function getPageCaption() {
  30. $oTemplate = BxDolStudioTemplate::getInstance();
  31. $aTmplVars = array(
  32. 'js_object' => $this->getPageJsObject(),
  33. 'content' => parent::getPageCaption(),
  34. );
  35. return $oTemplate->parseHtmlByName('dsn_page_caption.html', $aTmplVars);
  36. }
  37. function getPageAttributes() {
  38. if((int)$this->aTemplate['enabled'] == 0)
  39. return 'style="display:none"';
  40. return parent::getPageAttributes();
  41. }
  42. function getPageMenu($aMenu = array(), $aMarkers = array()) {
  43. $sJsObject = $this->getPageJsObject();
  44. $aMenu = array();
  45. foreach($this->aMenuItems as $sName => $sCaption)
  46. $aMenu[] = array(
  47. 'name' => $sName,
  48. 'icon' => 'mi-templ-' . $sName . '.png',
  49. 'link' => BX_DOL_URL_STUDIO . 'design.php?name=' . $this->sTemplate . '&page=' . $sName,
  50. 'title' => _t($sCaption),
  51. 'selected' => $sName == $this->sPage
  52. );
  53. return parent::getPageMenu($aMenu);
  54. }
  55. function getPageCode($bHidden = false) {
  56. $sMethod = 'get' . ucfirst($this->sPage);
  57. if(!method_exists($this, $sMethod))
  58. return '';
  59. if((int)$this->aTemplate['enabled'] != 1)
  60. BxDolStudioTemplate::getInstance()->addInjection('injection_bg_style', 'text', ' bx-std-page-bg-empty');
  61. return $this->$sMethod();
  62. }
  63. protected function getGeneral() {
  64. $oTemplate = BxDolStudioTemplate::getInstance();
  65. bx_import('BxTemplStudioSettings');
  66. $oPage = new BxTemplStudioSettings($this->sTemplate);
  67. $aTmplVars = array(
  68. 'bx_repeat:blocks' => $oPage->getPageCode(),
  69. );
  70. return $oTemplate->parseHtmlByName('design.html', $aTmplVars);
  71. }
  72. }
  73. /** @} */