BxBaseStudioDesign.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 TridentView Trident Studio Representation classes
  7. * @ingroup TridentStudio
  8. * @{
  9. */
  10. class BxBaseStudioDesign extends BxDolStudioDesign
  11. {
  12. protected $aMenuItems = array(
  13. BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS => array('caption' => '_adm_lmi_cpt_settings', 'icon' => 'cogs'),
  14. BX_DOL_STUDIO_TEMPL_TYPE_LOGO => array('caption' => '_adm_lmi_cpt_logo', 'icon' => 'pencil')
  15. );
  16. function __construct($sTemplate = "", $sPage = "")
  17. {
  18. parent::__construct($sTemplate, $sPage);
  19. }
  20. function getPageCss()
  21. {
  22. return array_merge(parent::getPageCss(), array());
  23. }
  24. function getPageJs()
  25. {
  26. return array_merge(parent::getPageJs(), array('settings.js', 'design.js'));
  27. }
  28. function getPageJsObject()
  29. {
  30. return 'oBxDolStudioDesign';
  31. }
  32. function getPageCaption()
  33. {
  34. $oTemplate = BxDolStudioTemplate::getInstance();
  35. $aTmplVars = array(
  36. 'js_object' => $this->getPageJsObject(),
  37. 'content' => parent::getPageCaption(),
  38. );
  39. return $oTemplate->parseHtmlByName('dsn_page_caption.html', $aTmplVars);
  40. }
  41. function getPageAttributes()
  42. {
  43. if((int)$this->aTemplate['enabled'] == 0)
  44. return 'style="display:none"';
  45. return parent::getPageAttributes();
  46. }
  47. function getPageMenu($aMenu = array(), $aMarkers = array())
  48. {
  49. $sJsObject = $this->getPageJsObject();
  50. $aMenu = array();
  51. foreach($this->aMenuItems as $sName => $aItem)
  52. $aMenu[] = array(
  53. 'name' => $sName,
  54. 'icon' => $aItem['icon'],
  55. 'link' => bx_append_url_params($this->sManageUrl, array('page' => $sName)),
  56. 'title' => _t($aItem['caption']),
  57. 'selected' => $sName == $this->sPage
  58. );
  59. return parent::getPageMenu($aMenu);
  60. }
  61. function getPageCode($bHidden = false)
  62. {
  63. $sMethod = 'get' . ucfirst($this->sPage);
  64. if(!method_exists($this, $sMethod))
  65. return '';
  66. if((int)$this->aTemplate['enabled'] != 1)
  67. BxDolStudioTemplate::getInstance()->addInjection('injection_bg_style', 'text', ' bx-std-page-bg-empty');
  68. return $this->$sMethod();
  69. }
  70. protected function getSettings($sCategory = '')
  71. {
  72. $oPage = new BxTemplStudioSettings($this->sTemplate, $sCategory);
  73. return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
  74. 'content' => $oPage->getPageCode()
  75. ));
  76. }
  77. protected function getLogo()
  78. {
  79. $oPage = $this->getObjectDesigner();
  80. $oTemplate = BxDolStudioTemplate::getInstance();
  81. $oTemplate->addJs($oPage->getPageJs());
  82. $oTemplate->addCss($oPage->getPageCss());
  83. return $oTemplate->parseHtmlByName('design.html', array(
  84. 'content' => $oPage->getPageCode()
  85. ));
  86. }
  87. }
  88. /** @} */