BxBaseStudioDesign.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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('settings.css'));
  23. }
  24. function getPageJs()
  25. {
  26. return array_merge(parent::getPageJs(), array('jquery.form.min.js', 'jquery.webForms.js', 'settings.js', 'design.js'));
  27. }
  28. function getPageJsClass()
  29. {
  30. return 'BxDolStudioDesign';
  31. }
  32. function getPageJsObject()
  33. {
  34. return 'oBxDolStudioDesign';
  35. }
  36. function getPageAttributes()
  37. {
  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. {
  44. $sJsObject = $this->getPageJsObject();
  45. $aMenu = array();
  46. foreach($this->aMenuItems as $sName => $aItem)
  47. $aMenu[] = array(
  48. 'name' => $sName,
  49. 'icon' => $aItem['icon'],
  50. 'link' => bx_append_url_params($this->sManageUrl, array('page' => $sName)),
  51. 'title' => _t($aItem['caption']),
  52. 'selected' => $sName == $this->sPage
  53. );
  54. return parent::getPageMenu($aMenu);
  55. }
  56. function getPageCode($bHidden = false)
  57. {
  58. $sMethod = 'get' . ucfirst($this->sPage);
  59. if(!method_exists($this, $sMethod))
  60. return '';
  61. if((int)$this->aTemplate['enabled'] != 1)
  62. BxDolStudioTemplate::getInstance()->addInjection('injection_bg_style', 'text', ' bx-std-page-bg-empty');
  63. return $this->$sMethod();
  64. }
  65. protected function getSettings($mixedCategory = '', $sMix = '')
  66. {
  67. $oPage = new BxTemplStudioSettings($this->sTemplate, $mixedCategory, $sMix);
  68. return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
  69. 'content' => $oPage->getPageCode(),
  70. 'js_content' => $this->getPageJsCode(),
  71. ));
  72. }
  73. protected function getLogo()
  74. {
  75. $oPage = $this->getObjectDesigner();
  76. $oTemplate = BxDolStudioTemplate::getInstance();
  77. $oTemplate->addJs($oPage->getPageJs());
  78. $oTemplate->addCss($oPage->getPageCss());
  79. return $oTemplate->parseHtmlByName('design.html', array(
  80. 'content' => $oPage->getPageCode(),
  81. 'js_content' => $this->getPageJsCode()
  82. ));
  83. }
  84. }
  85. /** @} */