BxBaseStudioDesign.php 2.7 KB

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