BxBaseStudioBuilderPage.php 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667
  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 BxBaseStudioBuilderPage extends BxDolStudioBuilderPage
  11. {
  12. protected $sParamsDivider = '#';
  13. protected $sSelectKeyPrefix = 'id-';
  14. protected $sActionPageCreate = 'page_create';
  15. protected $sActionPageDelete = 'page_delete';
  16. protected $sActionPageEdit = 'page_edit';
  17. protected $sActionBlockCreate = 'block_create';
  18. protected $sActionBlockEdit = 'block_edit';
  19. protected $sStorage;
  20. protected $sTranscoder;
  21. protected $aUploaders;
  22. protected $sBaseUrl;
  23. protected $sTypeUrl;
  24. protected $sPageUrl;
  25. protected $aHtmlIds = array(
  26. 'add_popup_id' => 'adm-bp-add-popup',
  27. 'edit_popup_id' => 'adm-bp-edit-popup',
  28. 'uri_field_id' => 'adm-bp-field-uri',
  29. 'url_field_id' => 'adm-bp-field-url',
  30. 'settings_group_id' => 'adm-bp-settings-group-',
  31. 'settings_groups_id' => 'adm-bp-settings-groups',
  32. 'create_block_popup_id' => 'adm-bp-create-block-popup',
  33. 'edit_block_popup_id' => 'adm-bp-edit-block-popup',
  34. 'edit_block_editor_id' => 'adm-bp-edit-block-editor',
  35. 'block_id' => 'adm-bpb-',
  36. 'block_list_id' => 'adm-bpl-',
  37. 'block_lists_id' => 'adm-bp-block-lists',
  38. 'layout_id' => 'adm-bpl-',
  39. );
  40. protected $aPageSettings = array(
  41. array('name' => 'options', 'title' => '_adm_bp_mi_page_options', 'active' => 1),
  42. array('name' => 'layout', 'title' => '_adm_bp_mi_page_layout', 'active' => 0),
  43. array('name' => 'visibility', 'title' => '_adm_bp_mi_page_visibility', 'active' => 0),
  44. array('name' => 'cache', 'title' => '_adm_bp_mi_page_cache', 'active' => 0),
  45. array('name' => 'seo', 'title' => '_adm_bp_mi_page_seo', 'active' => 0)
  46. );
  47. function __construct($sType = '', $sPage = '')
  48. {
  49. parent::__construct($sType, $sPage);
  50. $this->sStorage = 'sys_images';
  51. $this->sTranscoder = 'sys_builder_page_preview';
  52. $this->aUploaders = array('sys_builder_page_simple', 'sys_builder_page_html5');
  53. $this->sBaseUrl = BX_DOL_URL_STUDIO . 'builder_page.php';
  54. $this->sTypeUrl = $this->sBaseUrl . '?type=%s';
  55. $this->sPageUrl = $this->sTypeUrl . '&page=%s';
  56. }
  57. function getPageCss()
  58. {
  59. $oTemplate = BxDolStudioTemplate::getInstance();
  60. foreach($this->aUploaders as $sUploader) {
  61. $oUploader = BxDolUploader::getObjectInstance($sUploader, $this->sStorage, '', $oTemplate);
  62. if($oUploader)
  63. $oUploader->addCssJs();
  64. }
  65. return array_merge(parent::getPageCss(), array(
  66. BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css',
  67. 'page_layouts.css',
  68. 'builder_page.css'
  69. ));
  70. }
  71. function getPageJs()
  72. {
  73. return array_merge(parent::getPageJs(), array(
  74. 'codemirror/codemirror.min.js',
  75. 'jquery-ui/jquery.ui.core.min.js',
  76. 'jquery-ui/jquery.ui.widget.min.js',
  77. 'jquery-ui/jquery.ui.mouse.min.js',
  78. 'jquery-ui/jquery.ui.sortable.min.js',
  79. 'jquery.ui.touch-punch.min.js',
  80. 'jquery.easing.js',
  81. 'jquery.form.min.js',
  82. 'functions.js',
  83. 'builder_page.js'
  84. ));
  85. }
  86. function getPageJsObject()
  87. {
  88. return 'oBxDolStudioBuilderPage';
  89. }
  90. function getPageMenu($aMenu = array(), $aMarkers = array())
  91. {
  92. $aMenuItems = array(
  93. BX_DOL_STUDIO_MODULE_SYSTEM => array(
  94. 'name' => BX_DOL_STUDIO_MODULE_SYSTEM,
  95. 'icon' => 'cog',
  96. ),
  97. BX_DOL_STUDIO_MODULE_CUSTOM => array(
  98. 'name' => BX_DOL_STUDIO_MODULE_CUSTOM,
  99. 'icon' => 'wrench',
  100. 'title' => '_adm_bp_cpt_type_' . BX_DOL_STUDIO_MODULE_CUSTOM,
  101. )
  102. );
  103. $aModulesDb = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules'));
  104. foreach($aModulesDb as $aModuleDb) {
  105. $sName = $aModuleDb['name'];
  106. if(!empty($aMenuItems[$sName]))
  107. $aMenuItems[$sName] = array_merge($aMenuItems[$sName], $aModuleDb);
  108. else
  109. $aMenuItems[$sName] = $aModuleDb;
  110. if(empty($aMenuItems[$sName]['icon']))
  111. $aMenuItems[$sName]['icon'] = BxDolStudioUtils::getModuleIcon($aModuleDb, 'menu', false);
  112. }
  113. $aMenu = array();
  114. foreach($aMenuItems as $aMenuItem)
  115. $aMenu[] = array(
  116. 'name' => $aMenuItem['name'],
  117. 'icon' => $aMenuItem['icon'],
  118. 'link' => sprintf($this->sTypeUrl, $aMenuItem['name']),
  119. 'title' => $aMenuItem['title'],
  120. 'selected' => $aMenuItem['name'] == $this->sType
  121. );
  122. return parent::getPageMenu($aMenu);
  123. }
  124. function getPageCode($bHidden = false)
  125. {
  126. $oPage = BxTemplPage::getObjectInstance($this->sPage);
  127. $oTemplate = BxDolStudioTemplate::getInstance();
  128. $sJsObject = $this->getPageJsObject();
  129. $sTxtEmpty = _t('_sys_txt_empty');
  130. $sContent = "";
  131. if(($bPage = $this->sPage != '') === true) {
  132. $aTmplVars = array();
  133. for($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
  134. $aBlocks = array();
  135. $this->oDb->getBlocks(array('type' => 'by_object_cell', 'object' => $this->aPageRebuild['object'], 'cell' => $i), $aBlocks, false);
  136. $aTmplVarsCell = array('id' => $i, 'bx_repeat:blocks' => array());
  137. foreach($aBlocks as $aBlock) {
  138. $sTitle = !empty($aBlock['title_system']) ? _t($aBlock['title_system']) : $oPage->getBlockTitle($aBlock);
  139. list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock);
  140. $aTmplVarsCell['bx_repeat:blocks'][] = array(
  141. 'html_id' => $this->aHtmlIds['block_id'] . $aBlock['id'],
  142. 'bx_if:is_inactive' => array(
  143. 'condition' => (int)$aBlock['active'] == 0,
  144. 'content' => array()
  145. ),
  146. 'bx_if:show_link' => array(
  147. 'condition' => true,
  148. 'content' => array(
  149. 'onclick' => $sJsObject . ".performAction('block_edit', {id: " . $aBlock['id'] . "})",
  150. 'title' => !empty($sTitle) ? $sTitle : $sTxtEmpty,
  151. )
  152. ),
  153. 'bx_if:show_text' => array(
  154. 'condition' => false,
  155. 'content' => array()
  156. ),
  157. 'bx_if:image' => array (
  158. 'condition' => (bool)$sIconUrl,
  159. 'content' => array('icon_url' => $sIconUrl),
  160. ),
  161. 'bx_if:icon' => array (
  162. 'condition' => (bool)$sIcon,
  163. 'content' => array('icon' => $sIcon),
  164. ),
  165. 'module' => $this->getModuleTitle($aBlock['module']),
  166. 'visible_for' => _t('_adm_bp_txt_visible_for', BxDolStudioUtils::getVisibilityTitle($aBlock['visible_for_levels'])),
  167. 'bx_if:show_checkbox' => array(
  168. 'condition' => false,
  169. 'content' => array()
  170. ),
  171. 'bx_if:show_drag_handle' => array(
  172. 'condition' => true,
  173. 'content' => array()
  174. )
  175. );
  176. }
  177. $aTmplVars['cell_' . $i] = $oTemplate->parseHtmlByName('bp_cell.html', $aTmplVarsCell);
  178. }
  179. $sContent = $oTemplate->parseHtmlByName($this->aPageRebuild['layout_template'], $aTmplVars);
  180. }
  181. $aLanguages = BxDolStudioLanguagesUtils::getInstance()->getLanguages();
  182. $aTmplVars = array(
  183. 'js_object' => $sJsObject,
  184. 'action_url' => $this->sBaseUrl,
  185. 'page_url' => sprintf($this->sPageUrl, '{0}', '{1}'),
  186. 'type' => $this->sType,
  187. 'page' => $this->sPage,
  188. 'html_ids' => json_encode($this->aHtmlIds),
  189. 'languahes' => json_encode($aLanguages),
  190. 'content' => $this->getBlockCode(array(
  191. 'items' => $sContent
  192. ))
  193. );
  194. $oTemplate->addJsTranslation(array(
  195. '_adm_bp_wrn_page_delete',
  196. '_adm_bp_wrn_page_block_delete'
  197. ));
  198. return $oTemplate->parseHtmlByName('builder_page.html', $aTmplVars);
  199. }
  200. function getBlockPanelTop($aBlock)
  201. {
  202. return parent::getBlockPanelTop(
  203. array('panel_top' => BxDolStudioTemplate::getInstance()->parseHtmlByName('bp_block_panel_top.html', $this->_getTmplVarsBlockPanelTop()))
  204. );
  205. }
  206. protected function actionPageCreate()
  207. {
  208. $oTemplate = BxDolStudioTemplate::getInstance();
  209. $sModule = BX_DOL_STUDIO_MODULE_CUSTOM;
  210. $aForm = array(
  211. 'form_attrs' => array(
  212. 'id' => 'adm-bp-page-create',
  213. 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionPageCreate,
  214. 'method' => 'post'
  215. ),
  216. 'params' => array (
  217. 'db' => array(
  218. 'table' => 'sys_objects_page',
  219. 'key' => 'id',
  220. 'uri' => '',
  221. 'uri_title' => '',
  222. 'submit_name' => 'do_submit'
  223. ),
  224. ),
  225. 'inputs' => array (
  226. 'module' => array(
  227. 'type' => 'hidden',
  228. 'name' => 'module',
  229. 'value' => $sModule,
  230. 'db' => array (
  231. 'pass' => 'Xss',
  232. ),
  233. ),
  234. 'deletable' => array(
  235. 'type' => 'hidden',
  236. 'name' => 'deletable',
  237. 'value' => 1,
  238. 'db' => array (
  239. 'pass' => 'Int',
  240. ),
  241. ),
  242. 'settings' => array(
  243. 'type' => 'custom',
  244. 'name' => 'settings',
  245. 'content' => $oTemplate->parseHtmlByName('bp_edit_page_form.html', $this->_getTmplVarsPageSettings()),
  246. ),
  247. )
  248. );
  249. $oForm = new BxTemplStudioFormView($aForm);
  250. $oForm->initChecker();
  251. if($oForm->isSubmittedAndValid()) {
  252. unset($oForm->aInputs['settings']);
  253. foreach($this->aPageSettings as $aSetting)
  254. $oForm->aInputs = array_merge($oForm->aInputs, $this->{'getSettings' . $this->getClassName($aSetting['name']) . 'Fields'}());
  255. $sLanguage = BxDolStudioLanguagesUtils::getInstance()->getCurrentLangName(false);
  256. $sObject = BxDolForm::getSubmittedValue('title-' . $sLanguage, $aForm['form_attrs']['method']);
  257. $sObject = uriGenerate($sObject, 'sys_objects_page', 'object', 'object');
  258. $sUri = $oForm->getCleanValue('uri');
  259. $aPage = array();
  260. $this->oDb->getPages(array('type' => 'by_uri', 'value' => $sUri), $aPage, false);
  261. if(!empty($aPage) && is_array($aPage))
  262. return array('msg' => _t('_adm_bp_err_page_uri'));
  263. $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels'));
  264. BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $aForm['form_attrs']['method']);
  265. unset($oForm->aInputs['visible_for']);
  266. $iId = (int)$oForm->insert(array('object' => $sObject, 'url' => $this->sPageBaseUrl . $sUri));
  267. if($iId != 0)
  268. return array('eval' => $this->getPageJsObject() . '.onCreatePage(\'' . $sModule . '\', \'' . $sObject . '\')');
  269. else
  270. return array('msg' => _t('_adm_bp_err_page_create'));
  271. }
  272. $sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['add_popup_id'], _t('_adm_bp_txt_create_popup'), $oTemplate->parseHtmlByName('bp_add_page.html', array(
  273. 'form_id' => $aForm['form_attrs']['id'],
  274. 'form' => $oForm->getCode(true)
  275. )));
  276. return array('popup' => $sContent);
  277. }
  278. protected function actionPageEdit()
  279. {
  280. $sJsObject = $this->getPageJsObject();
  281. $oTemplate = BxDolStudioTemplate::getInstance();
  282. $aForm = array(
  283. 'form_attrs' => array(
  284. 'id' => 'adm-bp-page-edit',
  285. 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionPageEdit,
  286. 'method' => 'post'
  287. ),
  288. 'params' => array (
  289. 'db' => array(
  290. 'table' => 'sys_objects_page',
  291. 'key' => 'id',
  292. 'uri' => '',
  293. 'uri_title' => '',
  294. 'submit_name' => 'do_submit'
  295. ),
  296. ),
  297. 'inputs' => array (
  298. 'settings' => array(
  299. 'type' => 'custom',
  300. 'name' => 'settings',
  301. 'content' => $oTemplate->parseHtmlByName('bp_edit_page_form.html', $this->_getTmplVarsPageSettings($this->aPageRebuild, false)),
  302. ),
  303. )
  304. );
  305. $oForm = new BxTemplStudioFormView($aForm);
  306. $oForm->initChecker();
  307. if($oForm->isSubmittedAndValid()) {
  308. unset($oForm->aInputs['settings']);
  309. foreach($this->aPageSettings as $aSetting)
  310. $oForm->aInputs = array_merge($oForm->aInputs, $this->{'getSettings' . $this->getClassName($aSetting['name']) . 'Fields'}($this->aPageRebuild, false));
  311. $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels'));
  312. BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $aForm['form_attrs']['method']);
  313. unset($oForm->aInputs['visible_for']);
  314. if($oForm->update($this->aPageRebuild['id'])) {
  315. $iLevelId = $oForm->getCleanValue('layout_id');
  316. if(!empty($iLevelId) && $iLevelId != $this->aPageRebuild['layout_id']) {
  317. $aLayoutOld = array();
  318. $this->oDb->getLayouts(array('type' => 'by_id', 'value' => $this->aPageRebuild['layout_id']), $aLayoutOld, false);
  319. $aLayoutNew = array();
  320. $this->oDb->getLayouts(array('type' => 'by_id', 'value' => $iLevelId), $aLayoutNew, false);
  321. if($aLayoutOld['cells_number'] > $aLayoutNew['cells_number'] && $this->oDb->resetBlocksByPage($this->sPage, $aLayoutNew['cells_number']) === false)
  322. return array('msg' => _t('_adm_bp_err_save'));
  323. return array('eval' => $sJsObject . '.onSaveSettings()');
  324. }
  325. return array();
  326. } else
  327. return array('msg' => _t('_adm_bp_err_save'));
  328. }
  329. $sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['edit_popup_id'], _t('_adm_bp_txt_settings_popup'), $oTemplate->parseHtmlByName('bp_edit_page.html', array(
  330. 'form_id' => $aForm['form_attrs']['id'],
  331. 'form' => $oForm->getCode(true)
  332. )));
  333. return array('popup' => $sContent);
  334. }
  335. protected function actionPageDelete()
  336. {
  337. if(empty($this->sPage) || empty($this->aPageRebuild) || !is_array($this->aPageRebuild))
  338. return array('msg' => _t('_adm_bp_err_page_delete'));
  339. $oLangauge = BxDolStudioLanguagesUtils::getInstance();
  340. $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  341. $aBlocks = array();
  342. $this->oDb->getBlocks(array('type' => 'by_object', 'value' => $this->sPage), $aBlocks, false);
  343. if(is_array($aBlocks) && !empty($aBlocks)) {
  344. foreach($aBlocks as $aBlock)
  345. $this->onBlockDelete($aBlock);
  346. $this->oDb->deleteBlocks(array('type' => 'by_object', 'value' => $this->sPage));
  347. }
  348. if($this->oDb->deletePages(array('type' => 'by_object', 'value' => $this->sPage))) {
  349. $oLangauge->deleteLanguageString($this->aPageRebuild['title_system']);
  350. $oLangauge->deleteLanguageString($this->aPageRebuild['title']);
  351. return array('eval' => 'window.parent.location.href = "' . sprintf($this->sTypeUrl, $this->sType) . '";');
  352. }
  353. return array('msg' => _t('_adm_bp_err_page_delete'));
  354. }
  355. protected function actionBlockList()
  356. {
  357. $sModule = BX_DOL_STUDIO_BP_TYPE_DEFAULT;
  358. if(bx_get('bp_module') !== false)
  359. $sModule = bx_process_input(bx_get('bp_module'));
  360. return array(
  361. 'content' => $this->getBlockList($sModule)
  362. );
  363. }
  364. protected function actionBlockCreate()
  365. {
  366. $sJsObject = $this->getPageJsObject();
  367. $oTemplate = BxDolStudioTemplate::getInstance();
  368. $sSelected = BX_DOL_STUDIO_BP_SKELETONS;
  369. $aForm = array(
  370. 'form_attrs' => array(
  371. 'id' => 'adm-bp-block-create',
  372. 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionBlockCreate,
  373. 'method' => 'post'
  374. ),
  375. 'params' => array (
  376. 'db' => array(
  377. 'table' => 'sys_pages_blocks',
  378. 'key' => 'id',
  379. 'uri' => '',
  380. 'uri_title' => '',
  381. 'submit_name' => 'do_submit'
  382. ),
  383. ),
  384. 'inputs' => array (
  385. 'blocks' => array(
  386. 'type' => 'custom',
  387. 'name' => 'blocks',
  388. 'content' => '',
  389. 'db' => array (
  390. 'pass' => 'Int',
  391. ),
  392. ),
  393. )
  394. );
  395. $aMenu = array(
  396. BX_DOL_STUDIO_BP_SKELETONS => array(
  397. 'name' => BX_DOL_STUDIO_BP_SKELETONS,
  398. 'icon' => 'qrcode',
  399. 'title' => '_sys_block_types_skeletons',
  400. 'selected' => $sSelected == BX_DOL_STUDIO_BP_SKELETONS,
  401. ),
  402. BX_DOL_STUDIO_MODULE_SYSTEM => array(
  403. 'name' => BX_DOL_STUDIO_MODULE_SYSTEM,
  404. 'icon' => 'cog',
  405. 'title' => '_sys_block_types_system',
  406. 'selected' => $sSelected == BX_DOL_STUDIO_MODULE_SYSTEM,
  407. ),
  408. BX_DOL_STUDIO_MODULE_CUSTOM => array(
  409. 'name' => BX_DOL_STUDIO_MODULE_CUSTOM,
  410. 'icon' => 'wrench',
  411. 'title' => '_sys_block_types_custom',
  412. 'selected' => $sSelected == BX_DOL_STUDIO_MODULE_CUSTOM,
  413. )
  414. );
  415. $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules'));
  416. $aModulesWithBlocks = $this->oDb->getModulesWithCopyableBlocks();
  417. foreach($aModules as $aModule) {
  418. $sName = $aModule['name'];
  419. if(!in_array($sName, $aModulesWithBlocks))
  420. continue;
  421. if(!empty($aMenu[$sName]))
  422. $aMenu[$sName] = array_merge($aMenu[$sName], $aModule);
  423. else
  424. $aMenu[$sName] = $aModule;
  425. if(empty($aMenu[$sName]['icon']))
  426. $aMenu[$sName]['icon'] = BxDolStudioUtils::getModuleIcon($aModule, 'menu', false);
  427. }
  428. foreach($aMenu as $sKey => $aItem)
  429. $aMenu[$sKey]['onclick'] = $sJsObject . '.onChangeModule(\'' . $aItem['name'] . '\', this);';
  430. $oMenu = new BxTemplStudioMenu(array('template' => 'menu_side.html', 'menu_items' => $aMenu));
  431. $aTmplParams = array(
  432. 'menu' => $oMenu->getCode(),
  433. 'html_block_lists_id' => $this->aHtmlIds['block_lists_id'],
  434. 'blocks' => $this->getBlockList($sSelected)
  435. );
  436. $aForm['inputs']['blocks']['content'] = $oTemplate->parseHtmlByName('bp_add_block_form.html', $aTmplParams);
  437. $oForm = new BxTemplStudioFormView($aForm);
  438. $oForm->initChecker();
  439. if($oForm->isSubmittedAndValid()) {
  440. $aIds = $oForm->getCleanValue('blocks');
  441. $aBlocks = array();
  442. $this->oDb->getBlocks(array('type' => 'by_ids', 'value' => $aIds), $aBlocks, false);
  443. $oLanguage = BxDolStudioLanguagesUtils::getInstance();
  444. $oStorege = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
  445. $bResult = true;
  446. foreach($aBlocks as $aBlock) {
  447. $sModule = $aBlock['module'];
  448. $sTitleKey = $this->getSystemName($aBlock['title'] . '_' . time());
  449. $aTitleValues = $oLanguage->getLanguageString($aBlock['title']);
  450. unset($aBlock['id']);
  451. $aBlock['object'] = $this->sPage;
  452. $aBlock['cell_id'] = 1;
  453. $aBlock['module'] = $this->getBlockModule($aBlock);
  454. $aBlock['title'] = $sTitleKey;
  455. $aBlock['copyable'] = $sModule == BX_DOL_STUDIO_BP_SKELETONS ? 1 : 0;
  456. $aBlock['deletable'] = 1;
  457. //--- Process Lang copy
  458. $sContentKey = $sContentValue = "";
  459. if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_LANG && $aBlock['content'] != '') {
  460. $sContentKey = $this->getSystemName($aBlock['content'] . '_' . time());
  461. $sContentValue = _t($aBlock['content']);
  462. $aBlock['content'] = $sContentKey;
  463. $oLanguage->addLanguageString($sContentKey, $sContentValue);
  464. }
  465. //--- Process Image copy
  466. $iImageId = $sImageAlign = "";
  467. if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_IMAGE && $aBlock['content'] != '') {
  468. list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
  469. $aBlock['content'] = "";
  470. if(is_numeric($iImageId) && (int)$iImageId != 0 && ($iImageId = $oStorege->storeFileFromStorage(array('id' => $iImageId))) !== false)
  471. $aBlock['content'] = implode($this->sParamsDivider, array($iImageId, $sImageAlign));
  472. }
  473. if(!$this->oDb->insertBlock($aBlock)) {
  474. if($sContentKey != "")
  475. $oLanguage->deleteLanguageString($sContentKey);
  476. if($iImageId != "")
  477. $oStorege->deleteFile((int)$iImageId, 0);
  478. $bResult = false;
  479. break;
  480. }
  481. //--- Process Title copy
  482. foreach($aTitleValues as $iLangId => $aTitleValue)
  483. $oLanguage->addLanguageString($sTitleKey, $aTitleValue['string'], $iLangId);
  484. }
  485. if($bResult)
  486. return array('eval' => $sJsObject . '.onCreateBlock(oData)');
  487. else
  488. return array('msg' => _t('_adm_bp_err_block_added'));
  489. }
  490. $sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['create_block_popup_id'], _t('_adm_bp_txt_new_block_popup'), $oTemplate->parseHtmlByName('bp_add_block.html', array(
  491. 'action' => 'create',
  492. 'form_id' => $aForm['form_attrs']['id'],
  493. 'form' => $oForm->getCode(true)
  494. )));
  495. return array('popup' => $sContent);
  496. }
  497. protected function actionBlockEdit()
  498. {
  499. $sJsObject = $this->getPageJsObject();
  500. $oTemplate = BxDolStudioTemplate::getInstance();
  501. $iId = (int)bx_get('id');
  502. if(!$iId)
  503. return array();
  504. $aBlock = array();
  505. $this->oDb->getBlocks(array('type' => 'by_id', 'value' => $iId), $aBlock, false);
  506. if(empty($aBlock) || !is_array($aBlock))
  507. return array('msg' => _t('_adm_bp_err_block_not_found'));
  508. bx_import('BxDolStudioUtils');
  509. $aForm = array(
  510. 'form_attrs' => array(
  511. 'id' => 'adm-bp-block-edit',
  512. 'action' => sprintf($this->sPageUrl, $this->sType, $this->sPage) . '&bp_action=' . $this->sActionBlockEdit,
  513. 'method' => 'post'
  514. ),
  515. 'params' => array (
  516. 'db' => array(
  517. 'table' => 'sys_pages_blocks',
  518. 'key' => 'id',
  519. 'uri' => '',
  520. 'uri_title' => '',
  521. 'submit_name' => 'do_submit'
  522. ),
  523. ),
  524. 'inputs' => array (
  525. 'id' => array(
  526. 'type' => 'hidden',
  527. 'name' => 'id',
  528. 'value' => $iId,
  529. 'db' => array (
  530. 'pass' => 'Int',
  531. ),
  532. ),
  533. 'title' => array(
  534. 'type' => 'text_translatable',
  535. 'name' => 'title',
  536. 'caption' => _t('_adm_bp_txt_block_title'),
  537. 'info' => _t('_adm_bp_dsc_block_title'),
  538. 'value' => $aBlock['title'],
  539. 'required' => '1',
  540. 'db' => array (
  541. 'pass' => 'Xss',
  542. ),
  543. 'checker' => array (
  544. 'func' => 'length',
  545. 'params' => array(3,100),
  546. 'error' => _t('_adm_bp_err_block_title'),
  547. ),
  548. ),
  549. 'designbox_id' => array(
  550. 'type' => 'select',
  551. 'name' => 'designbox_id',
  552. 'caption' => _t('_adm_bp_txt_block_designbox'),
  553. 'info' => '',
  554. 'value' => $this->sSelectKeyPrefix . $aBlock['designbox_id'],
  555. 'values' => array(
  556. array('key' => '', 'value' => _t('_adm_bp_txt_block_designbox_empty')),
  557. ),
  558. 'required' => '1',
  559. 'db' => array (
  560. 'pass' => 'Xss',
  561. ),
  562. 'checker' => array (
  563. 'func' => 'avail',
  564. 'params' => array(),
  565. 'error' => _t('_adm_bp_err_block_designbox'),
  566. ),
  567. ),
  568. 'hidden_on' => array(
  569. 'type' => 'select_multiple',
  570. 'name' => 'hidden_on',
  571. 'caption' => _t('_adm_bp_txt_block_hidden_on'),
  572. 'info' => '',
  573. 'value' => $aBlock['hidden_on'],
  574. 'values' => array(
  575. BX_DB_HIDDEN_PHONE => _t('_adm_bp_txt_block_hidden_on_phone'),
  576. BX_DB_HIDDEN_TABLET => _t('_adm_bp_txt_block_hidden_on_tablet'),
  577. BX_DB_HIDDEN_DESKTOP => _t('_adm_bp_txt_block_hidden_on_desktop')
  578. ),
  579. 'db' => array (
  580. 'pass' => 'Set',
  581. )
  582. ),
  583. 'visible_for' => array(
  584. 'type' => 'select',
  585. 'name' => 'visible_for',
  586. 'caption' => _t('_adm_bp_txt_block_visible_for'),
  587. 'info' => '',
  588. 'value' => $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED,
  589. 'values' => array(
  590. array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_bp_txt_block_visible_for_all')),
  591. array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_bp_txt_block_visible_for_selected')),
  592. ),
  593. 'required' => '0',
  594. 'attrs' => array(
  595. 'onchange' => $sJsObject . '.onChangeVisibleFor(this)'
  596. ),
  597. 'db' => array (
  598. 'pass' => 'Xss',
  599. )
  600. ),
  601. 'visible_for_levels' => array(
  602. 'type' => 'checkbox_set',
  603. 'name' => 'visible_for_levels',
  604. 'caption' => _t('_adm_bp_txt_block_visible_for_levels'),
  605. 'info' => _t('_adm_bp_dsc_block_visible_for_levels'),
  606. 'value' => array(),
  607. 'values' => array(),
  608. 'tr_attrs' => array(
  609. 'style' => $aBlock['visible_for_levels'] == BX_DOL_INT_MAX ? 'display:none' : ''
  610. ),
  611. 'db' => array (
  612. 'pass' => 'Int',
  613. )
  614. ),
  615. 'active' => array(
  616. 'type' => 'switcher',
  617. 'name' => 'active',
  618. 'caption' => _t('_adm_bp_txt_block_active'),
  619. 'info' => '',
  620. 'value' => '1',
  621. 'checked' => $aBlock['active'] == '1',
  622. 'db' => array (
  623. 'pass' => 'Int',
  624. )
  625. ),
  626. 'controls' => array(
  627. 'name' => 'controls',
  628. 'type' => 'input_set',
  629. array(
  630. 'type' => 'submit',
  631. 'name' => 'do_submit',
  632. 'value' => _t('_adm_bp_btn_block_save')
  633. ),
  634. array (
  635. 'type' => 'reset',
  636. 'name' => 'close',
  637. 'value' => _t('_adm_bp_btn_block_cancel'),
  638. 'attrs' => array(
  639. 'onclick' => $sJsObject . '.onEditBlockCancel(this)',
  640. 'class' => 'bx-def-margin-sec-left',
  641. ),
  642. )
  643. )
  644. )
  645. );
  646. $aDBoxes = array();
  647. $this->oDb->getDesignBoxes(array('type' => 'ordered'), $aDBoxes, false);
  648. foreach($aDBoxes as $aDBox)
  649. $aForm['inputs']['designbox_id']['values'][] = array('key' => $this->sSelectKeyPrefix . $aDBox['id'], 'value' => _t($aDBox['title']));
  650. BxDolStudioUtils::getVisibilityValues($aBlock['visible_for_levels'], $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']);
  651. $aForm['inputs'] = $this->addInArray($aForm['inputs'], 'visible_for_levels', $this->getBlockContent($aBlock));
  652. if((int)$aBlock['deletable'] != 0)
  653. $aForm['inputs']['controls'][] = array (
  654. 'type' => 'reset',
  655. 'name' => 'close',
  656. 'value' => _t('_adm_bp_btn_block_delete'),
  657. 'attrs' => array(
  658. 'onclick' => $sJsObject . '.deleteBlock(' . $aBlock['id'] . ')',
  659. 'class' => 'bx-def-margin-sec-left',
  660. ),
  661. );
  662. $oForm = new BxTemplStudioFormView($aForm);
  663. $oForm->initChecker();
  664. if($oForm->isSubmittedAndValid()) {
  665. $this->onSaveBlock($oForm, $aBlock);
  666. if($oForm->update($iId) !== false)
  667. return array('eval' => $sJsObject . '.onEditBlock(oData)');
  668. else
  669. return array('msg' => _t('_adm_bp_err_block_edit'));
  670. }
  671. $sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->aHtmlIds['edit_block_popup_id'], _t('_adm_bp_txt_edit_block_popup', _t($aBlock['title'])), $oTemplate->parseHtmlByName('bp_add_block.html', array(
  672. 'action' => 'edit',
  673. 'form_id' => $aForm['form_attrs']['id'],
  674. 'form' => $oForm->getCode(true)
  675. )));
  676. return array('popup' => array('html' => $sContent, 'options' => array('onBeforeShow' => $sJsObject . '.onEditBlockBeforeShow($el)')));
  677. }
  678. protected function actionBlockDelete()
  679. {
  680. $sJsObject = $this->getPageJsObject();
  681. $iId = (int)bx_get('id');
  682. $aBlock = array();
  683. $this->oDb->getBlocks(array('type' => 'by_id', 'value' => $iId), $aBlock, false);
  684. if(empty($aBlock) || !is_array($aBlock))
  685. return array('msg' => _t('_adm_bp_err_block_not_found'));
  686. if((int)$aBlock['deletable'] == 0)
  687. return array('msg' => _t('_adm_bp_err_block_not_deletable'));
  688. if(!$this->oDb->deleteBlocks(array('type' => 'by_id', 'value' => $iId)))
  689. return array('msg' => _t('_adm_bp_err_block_delete'));
  690. $this->onBlockDelete($aBlock);
  691. return array('eval' => $sJsObject . '.onDeleteBlock(' . $iId . ', oData)');
  692. }
  693. protected function actionImageDelete()
  694. {
  695. $sJsObject = $this->getPageJsObject();
  696. $iId = (int)bx_get('id');
  697. $aBlock = array();
  698. $this->oDb->getBlocks(array('type' => 'by_id', 'value' => $iId), $aBlock, false);
  699. if(empty($aBlock) || !is_array($aBlock))
  700. return array('msg' => _t('_adm_bp_err_block_not_found'));
  701. $iImageId = $sImageAlign = '';
  702. if($aBlock['content'] != '')
  703. list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
  704. if(is_numeric($iImageId) && (int)$iImageId != 0) {
  705. if(!BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int)$iImageId, 0))
  706. return array('msg' => _t('_adm_bp_err_block_content_image_preview_delete'));
  707. $this->oDb->updateBlock($iId, array('content' => ''));
  708. }
  709. return $this->actionBlockEdit();
  710. }
  711. protected function actionUriGet()
  712. {
  713. $oLanguage = BxDolStudioLanguagesUtils::getInstance();
  714. $aLanguages = $oLanguage->getLanguages();
  715. $sLanguageDef = $oLanguage->getDefaultLangName();
  716. $sLanguageCur = $oLanguage->getCurrentLangName(false);
  717. $aValues = array();
  718. foreach($aLanguages as $sName => $sTitle)
  719. if(($mixedValue = bx_get($sName)) !== false)
  720. $aValues[$sName] = bx_process_input($mixedValue);
  721. $sUri = "";
  722. if(($mixedValue = bx_get('uri')) !== false)
  723. $sUri = bx_process_input($mixedValue);
  724. else if(array_key_exists('en', $aValues) && $aValues['en'] != '')
  725. $sUri = $aValues['en'];
  726. else if(array_key_exists($sLanguageDef, $aValues) && $aValues[$sLanguageDef] != '')
  727. $sUri = $aValues[$sLanguageDef];
  728. else if(array_key_exists($sLanguageCur, $aValues) && $aValues[$sLanguageCur] != '')
  729. $sUri = $aValues[$sLanguageCur];
  730. else if(count($aValues) > 0)
  731. foreach($aValues as $sValue)
  732. if(!empty($sValue)) {
  733. $sUri = $sValue;
  734. break;
  735. }
  736. $sUri = $sUri != "" ? uriGenerate($sUri, 'sys_objects_page', 'uri') : "";
  737. $sUrl = BxDolPermalinks::getInstance()->permalink($this->sPageBaseUrl . $sUri);
  738. return array('eval' => $this->getPageJsObject() . '.onGetUri(oData)', 'uri' => $sUri, 'url' => $sUrl);
  739. }
  740. protected function getSettingsOptions($aPage = array(), $bCreate = true, $bInputsOnly = false)
  741. {
  742. $aForm = array(
  743. 'form_attrs' => array(
  744. 'id' => 'adm-bp-settings-seo',
  745. ),
  746. 'params' => array (
  747. 'remove_form' => '1',
  748. 'csrf' => array(
  749. 'disable' => true
  750. )
  751. ),
  752. 'inputs' => array (
  753. 'title_system' => array(
  754. 'type' => 'text_translatable',
  755. 'name' => 'title_system',
  756. 'caption' => _t('_adm_bp_txt_page_title_system'),
  757. 'info' => _t('_adm_bp_dsc_page_title_system'),
  758. 'value' => isset($aPage['title_system']) ? $aPage['title_system'] : '',
  759. 'required' => '1',
  760. 'db' => array (
  761. 'pass' => 'Xss',
  762. ),
  763. 'checker' => array (
  764. 'func' => 'length',
  765. 'params' => array(3,100),
  766. 'error' => _t('_adm_bp_err_page_title_system'),
  767. ),
  768. ),
  769. 'title' => array(
  770. 'type' => 'text_translatable',
  771. 'name' => 'title',
  772. 'caption' => _t('_adm_bp_txt_page_title'),
  773. 'info' => _t('_adm_bp_dsc_page_title'),
  774. 'value' => isset($aPage['title']) ? $aPage['title'] : '',
  775. 'required' => '1',
  776. 'db' => array (
  777. 'pass' => 'Xss',
  778. ),
  779. 'checker' => array (
  780. 'func' => 'length',
  781. 'params' => array(3,100),
  782. 'error' => _t('_adm_bp_err_page_title'),
  783. ),
  784. ),
  785. 'url' => array(
  786. 'type' => 'text',
  787. 'name' => 'url',
  788. 'caption' => _t('_adm_bp_txt_page_url'),
  789. 'info' => _t('_adm_bp_dsc_page_url'),
  790. 'value' => isset($aPage['url']) ? BxDolPermalinks::getInstance()->permalink($aPage['url']) : '',
  791. 'required' => '0',
  792. 'attrs' => array(
  793. 'id' => $this->aHtmlIds['url_field_id'],
  794. 'disabled' => 'disabled'
  795. ),
  796. ),
  797. 'cover' => array(
  798. 'type' => 'switcher',
  799. 'name' => 'cover',
  800. 'caption' => _t('_adm_bp_txt_page_cover'),
  801. 'info' => '',
  802. 'value' => '1',
  803. 'checked' => $aPage['cover'] == '1',
  804. 'db' => array (
  805. 'pass' => 'Int',
  806. )
  807. ),
  808. )
  809. );
  810. if($bCreate) {
  811. $sJsObject = $this->getPageJsObject();
  812. $aForm['inputs']['title']['attrs']['onblur'] = $sJsObject . '.getUri(this);';
  813. $aForm['inputs'] = bx_array_insert_before(array(
  814. 'uri' => array(
  815. 'type' => 'text',
  816. 'name' => 'uri',
  817. 'caption' => _t('_adm_bp_txt_page_uri'),
  818. 'info' => _t('_adm_bp_dsc_page_uri'),
  819. 'value' => '',
  820. 'required' => '1',
  821. 'attrs' => array(
  822. 'id' => $this->aHtmlIds['uri_field_id'],
  823. 'onblur' => $sJsObject . '.getUri(this);'
  824. ),
  825. 'db' => array (
  826. 'pass' => 'Xss',
  827. ),
  828. 'checker' => array (
  829. 'func' => 'length',
  830. 'params' => array(3,100),
  831. 'error' => _t('_adm_bp_err_page_uri'),
  832. ),
  833. )
  834. ), $aForm['inputs'], 'url');
  835. }
  836. if($bInputsOnly)
  837. return $aForm['inputs'];
  838. $oForm = new BxTemplStudioFormView($aForm);
  839. return $oForm->getCode();
  840. }
  841. protected function getSettingsOptionsFields($aPage = array(), $bCreate = true, $bInputsOnly = false)
  842. {
  843. return $this->getSettingsOptions($aPage, $bCreate, true);
  844. }
  845. protected function getSettingsLayout($aPage = array(), $bCreate = true, $bInputsOnly = false)
  846. {
  847. $sJsObject = $this->getPageJsObject();
  848. $oTemplate = BxDolStudioTemplate::getInstance();
  849. $iLayout = isset($aPage['layout_id']) ? (int)$aPage['layout_id'] : 5;
  850. $aLayouts = array();
  851. $this->oDb->getLayouts(array('type' => 'all'), $aLayouts, false);
  852. $aTmplParams = array(
  853. 'bx_repeat:layouts' => array(),
  854. 'form' => ''
  855. );
  856. foreach($aLayouts as $aLayout)
  857. $aTmplParams['bx_repeat:layouts'][] = array(
  858. 'id' => $aLayout['id'],
  859. 'html_id' => $this->aHtmlIds['layout_id'] . $aLayout['id'],
  860. 'js_object' => $sJsObject,
  861. 'bx_if:active' => array(
  862. 'condition' => (int)$aLayout['id'] == $iLayout,
  863. 'content' => array()
  864. ),
  865. 'icon' => $oTemplate->getImageUrl($aLayout['icon']),
  866. 'title' => _t($aLayout['title']),
  867. );
  868. $aForm = array(
  869. 'form_attrs' => array(
  870. 'id' => 'adm-bp-settings-seo',
  871. ),
  872. 'params' => array (
  873. 'remove_form' => '1',
  874. 'csrf' => array(
  875. 'disable' => true
  876. )
  877. ),
  878. 'inputs' => array (
  879. 'layout_id' => array(
  880. 'type' => 'hidden',
  881. 'name' => 'layout_id',
  882. 'value' => $iLayout,
  883. 'db' => array (
  884. 'pass' => 'Int',
  885. ),
  886. )
  887. )
  888. );
  889. if($bInputsOnly)
  890. return $aForm['inputs'];
  891. $oForm = new BxTemplStudioFormView($aForm);
  892. $aTmplParams['form'] = $oForm->getCode();
  893. return $oTemplate->parseHtmlByName('bp_layouts.html', $aTmplParams);
  894. }
  895. protected function getSettingsLayoutFields($aPage = array(), $bCreate = true)
  896. {
  897. return $this->getSettingsLayout($aPage, $bCreate, true);
  898. }
  899. protected function getSettingsVisibility($aPage = array(), $bCreate = true, $bInputsOnly = false)
  900. {
  901. $iVisibleForLevels = isset($aPage['visible_for_levels']) ? (int)$aPage['visible_for_levels'] : BX_DOL_INT_MAX;
  902. if(isset($aPage['visible_for_levels_editable']) && (int)$aPage['visible_for_levels_editable'] == 0)
  903. $aInputs = array(
  904. 'visible_for_levels' => array(
  905. 'type' => 'custom',
  906. 'name' => 'visible_for_levels',
  907. 'content' => MsgBox(_t('_adm_bp_err_page_visible_for_levels'))
  908. )
  909. );
  910. else
  911. bx_import('BxDolStudioUtils');
  912. $aInputs = array(
  913. 'visible_for' => array(
  914. 'type' => 'select',
  915. 'name' => 'visible_for',
  916. 'caption' => _t('_adm_bp_txt_block_visible_for'),
  917. 'info' => '',
  918. 'value' => $iVisibleForLevels == BX_DOL_INT_MAX ? BX_DOL_STUDIO_VISIBLE_ALL : BX_DOL_STUDIO_VISIBLE_SELECTED,
  919. 'values' => array(
  920. array('key' => BX_DOL_STUDIO_VISIBLE_ALL, 'value' => _t('_adm_bp_txt_block_visible_for_all')),
  921. array('key' => BX_DOL_STUDIO_VISIBLE_SELECTED, 'value' => _t('_adm_bp_txt_block_visible_for_selected')),
  922. ),
  923. 'required' => '0',
  924. 'attrs' => array(
  925. 'onchange' => $this->getPageJsObject() . '.onChangeVisibleFor(this)'
  926. ),
  927. 'db' => array (
  928. 'pass' => 'Xss',
  929. )
  930. ),
  931. 'visible_for_levels' => array(
  932. 'type' => 'checkbox_set',
  933. 'name' => 'visible_for_levels',
  934. 'caption' => _t('_adm_bp_txt_page_visible_for_levels'),
  935. 'info' => _t('_adm_bp_dsc_page_visible_for_levels'),
  936. 'value' => '',
  937. 'values' => array(),
  938. 'tr_attrs' => array(
  939. 'style' => $iVisibleForLevels == BX_DOL_INT_MAX ? 'display:none' : ''
  940. ),
  941. 'db' => array (
  942. 'pass' => 'Int',
  943. )
  944. )
  945. );
  946. $aForm = array(
  947. 'form_attrs' => array(
  948. 'id' => 'adm-bp-settings-visibility',
  949. ),
  950. 'params' => array (
  951. 'remove_form' => '1',
  952. 'csrf' => array(
  953. 'disable' => true
  954. )
  955. ),
  956. 'inputs' => $aInputs
  957. );
  958. BxDolStudioUtils::getVisibilityValues($iVisibleForLevels, $aForm['inputs']['visible_for_levels']['values'], $aForm['inputs']['visible_for_levels']['value']);
  959. if($bInputsOnly)
  960. return $aForm['inputs'];
  961. $oForm = new BxTemplStudioFormView($aForm);
  962. return $oForm->getCode();
  963. }
  964. protected function getSettingsVisibilityFields($aPage = array(), $bCreate = true)
  965. {
  966. return $this->getSettingsVisibility($aPage = array(), $bCreate, true);
  967. }
  968. protected function getSettingsCache($aPage = array(), $bCreate = true, $bInputsOnly = false)
  969. {
  970. $aForm = array(
  971. 'form_attrs' => array(
  972. 'id' => 'adm-bp-settings-cache',
  973. ),
  974. 'params' => array (
  975. 'remove_form' => '1',
  976. 'csrf' => array(
  977. 'disable' => true
  978. )
  979. ),
  980. 'inputs' => array (
  981. 'cache_lifetime' => array(
  982. 'type' => 'text',
  983. 'name' => 'cache_lifetime',
  984. 'caption' => _t('_adm_bp_txt_page_cache_lifetime'),
  985. 'info' => _t('_adm_bp_dsc_page_cache_lifetime'),
  986. 'value' => isset($aPage['cache_lifetime']) ? $aPage['cache_lifetime'] : 0,
  987. 'required' => '',
  988. 'attrs' => array(
  989. 'disabled' => isset($aPage['cache_editable']) && (int)$aPage['cache_editable'] == 0 ? 'disabled' : ''
  990. ),
  991. 'db' => array (
  992. 'pass' => 'Int',
  993. )
  994. ),
  995. )
  996. );
  997. if($bInputsOnly)
  998. return $aForm['inputs'];
  999. $oForm = new BxTemplStudioFormView($aForm);
  1000. return $oForm->getCode();
  1001. }
  1002. protected function getSettingsCacheFields($aPage = array(), $bCreate = true)
  1003. {
  1004. return $this->getSettingsCache($aPage, $bCreate, true);
  1005. }
  1006. protected function getSettingsSeo($aPage = array(), $bCreate = true, $bInputsOnly = false)
  1007. {
  1008. $aForm = array(
  1009. 'form_attrs' => array(
  1010. 'id' => 'adm-bp-settings-seo',
  1011. ),
  1012. 'params' => array (
  1013. 'remove_form' => '1',
  1014. 'csrf' => array(
  1015. 'disable' => true
  1016. )
  1017. ),
  1018. 'inputs' => array (
  1019. 'meta_description' => array(
  1020. 'type' => 'textarea',
  1021. 'name' => 'meta_description',
  1022. 'caption' => _t('_adm_bp_txt_page_meta_description'),
  1023. 'info' => _t('_adm_bp_dsc_page_meta_description'),
  1024. 'value' => isset($aPage['meta_description']) ? $aPage['meta_description'] : '',
  1025. 'db' => array (
  1026. 'pass' => 'Xss',
  1027. ),
  1028. ),
  1029. 'meta_keywords' => array(
  1030. 'type' => 'textarea',
  1031. 'name' => 'meta_keywords',
  1032. 'caption' => _t('_adm_bp_txt_page_meta_keywords'),
  1033. 'info' => _t('_adm_bp_dsc_page_meta_keywords'),
  1034. 'value' => isset($aPage['meta_keywords']) ? $aPage['meta_keywords'] : '',
  1035. 'db' => array (
  1036. 'pass' => 'Xss',
  1037. ),
  1038. ),
  1039. 'meta_robots' => array(
  1040. 'type' => 'text',
  1041. 'name' => 'meta_robots',
  1042. 'caption' => _t('_adm_bp_txt_page_meta_robots'),
  1043. 'info' => _t('_adm_bp_dsc_page_meta_robots'),
  1044. 'value' => isset($aPage['meta_robots']) ? $aPage['meta_robots'] : '',
  1045. 'required' => '0',
  1046. 'db' => array (
  1047. 'pass' => 'Xss',
  1048. )
  1049. )
  1050. )
  1051. );
  1052. if($bInputsOnly)
  1053. return $aForm['inputs'];
  1054. $oForm = new BxTemplStudioFormView($aForm);
  1055. return $oForm->getCode();
  1056. }
  1057. protected function getSettingsSeoFields($aPage = array(), $bCreate = true)
  1058. {
  1059. return $this->getSettingsSeo($aPage, $bCreate, true);
  1060. }
  1061. protected function getBlockIcon($aBlock)
  1062. {
  1063. $sIcon = $sIconUrl = "";
  1064. $sResult = '';
  1065. switch($aBlock['type']) {
  1066. case BX_DOL_STUDIO_BP_BLOCK_RAW:
  1067. $sResult = 'file-text-o';
  1068. break;
  1069. case BX_DOL_STUDIO_BP_BLOCK_HTML:
  1070. $sResult = 'code';
  1071. break;
  1072. case BX_DOL_STUDIO_BP_BLOCK_RSS:
  1073. $sResult = 'rss';
  1074. break;
  1075. case BX_DOL_STUDIO_BP_BLOCK_IMAGE:
  1076. $sResult = 'picture-o';
  1077. break;
  1078. case BX_DOL_STUDIO_BP_BLOCK_LANG:
  1079. $sResult = 'globe';
  1080. break;
  1081. case BX_DOL_STUDIO_BP_BLOCK_MENU:
  1082. $sResult = 'list-alt';
  1083. break;
  1084. case BX_DOL_STUDIO_BP_BLOCK_SERVICE:
  1085. $sResult = $this->getModuleIcon($aBlock['module'], 'page');
  1086. break;
  1087. }
  1088. if(strpos($sResult, '.') === false)
  1089. $sIcon = $sResult;
  1090. else
  1091. $sIconUrl = $sResult;
  1092. return array($sIcon, $sIconUrl);
  1093. }
  1094. protected function getBlockModule($aBlock)
  1095. {
  1096. return $aBlock['module'] != BX_DOL_STUDIO_BP_SKELETONS ? $aBlock['module'] : BX_DOL_STUDIO_MODULE_CUSTOM;
  1097. }
  1098. protected function getBlockContent($aBlock)
  1099. {
  1100. $aFields = array();
  1101. switch($aBlock['type']) {
  1102. case BX_DOL_STUDIO_BP_BLOCK_RAW:
  1103. $aFields = array(
  1104. 'content' => array(
  1105. 'type' => 'textarea',
  1106. 'name' => 'content',
  1107. 'caption' => _t('_adm_bp_txt_block_content_raw'),
  1108. 'info' => _t('_adm_bp_dsc_block_content_raw'),
  1109. 'value' => $aBlock['content'],
  1110. 'required' => '0',
  1111. 'code' => 1,
  1112. 'db' => array (
  1113. 'pass' => 'XssHtml',
  1114. ),
  1115. ),
  1116. );
  1117. break;
  1118. case BX_DOL_STUDIO_BP_BLOCK_HTML:
  1119. $aFields = array(
  1120. 'content' => array(
  1121. 'type' => 'textarea',
  1122. 'name' => 'content',
  1123. 'caption' => _t('_adm_bp_txt_block_content_raw'),
  1124. 'info' => _t('_adm_bp_dsc_block_content_raw'),
  1125. 'value' => $aBlock['content'],
  1126. 'required' => '0',
  1127. 'html' => 1,
  1128. 'attrs' => array('id' => $this->aHtmlIds['edit_block_editor_id']),
  1129. 'db' => array (
  1130. 'pass' => 'XssHtml',
  1131. ),
  1132. ),
  1133. 'attachments' => array(
  1134. 'type' => 'files',
  1135. 'name' => 'attachments',
  1136. 'storage_object' => $this->sStorage,
  1137. 'images_transcoder' => $this->sTranscoder,
  1138. 'uploaders' => $this->aUploaders,
  1139. 'multiple' => true,
  1140. 'content_id' => $aBlock['id'],
  1141. 'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('bp_form_ghost_template.html', array(
  1142. 'js_object' => $this->getPageJsObject(),
  1143. 'name' => 'attachments',
  1144. 'editor_id' => $this->aHtmlIds['edit_block_editor_id'],
  1145. )),
  1146. 'caption' => _t('_adm_bp_txt_block_content_attachments_html')
  1147. )
  1148. );
  1149. break;
  1150. case BX_DOL_STUDIO_BP_BLOCK_LANG:
  1151. $aFields = array(
  1152. 'content' => array(
  1153. 'type' => 'textarea',
  1154. 'name' => 'content',
  1155. 'caption' => _t('_adm_bp_txt_block_content_lang'),
  1156. 'info' => _t('_adm_bp_dsc_block_content_lang'),
  1157. 'value' => $aBlock['content'] != '' ? _t($aBlock['content']) : '',
  1158. 'required' => '0',
  1159. 'html' => 1,
  1160. 'db' => array (
  1161. 'pass' => 'XssHtml',
  1162. ),
  1163. ),
  1164. );
  1165. break;
  1166. case BX_DOL_STUDIO_BP_BLOCK_IMAGE:
  1167. $iImageId = $sImageAlign = '';
  1168. if($aBlock['content'] != '')
  1169. list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
  1170. $aFields = array(
  1171. 'content' => array(
  1172. 'type' => 'hidden',
  1173. 'name' => 'content',
  1174. 'value' => '',
  1175. 'db' => array (
  1176. 'pass' => 'Xss',
  1177. ),
  1178. ),
  1179. 'image_file' => array(
  1180. 'type' => 'image_uploader',
  1181. 'name' => 'image_file',
  1182. 'caption' => _t('_adm_bp_txt_block_content_image_file'),
  1183. 'caption_preview' => _t('_adm_bp_txt_block_content_image_preview'),
  1184. 'info' => _t('_adm_bp_dsc_block_content_image_file'),
  1185. 'ajax_action_delete' => $this->getPageJsObject() . '.deleteBlockImage(' . $aBlock['id'] . ')',
  1186. 'value' => (int)$iImageId
  1187. ),
  1188. 'image_align' => array(
  1189. 'type' => 'select',
  1190. 'name' => 'image_align',
  1191. 'caption' => _t('_adm_bp_txt_block_content_image_align'),
  1192. 'info' => '',
  1193. 'value' => $sImageAlign,
  1194. 'values' => array(
  1195. array('key' => '', 'value' => _t('_adm_bp_txt_block_content_image_align_empty')),
  1196. array('key' => 'left', 'value' => _t('_adm_bp_txt_block_content_image_align_left')),
  1197. array('key' => 'center', 'value' => _t('_adm_bp_txt_block_content_image_align_center')),
  1198. array('key' => 'right', 'value' => _t('_adm_bp_txt_block_content_image_align_right')),
  1199. ),
  1200. 'required' => '0',
  1201. 'db' => array (
  1202. 'pass' => 'Xss',
  1203. ),
  1204. ),
  1205. );
  1206. break;
  1207. case BX_DOL_STUDIO_BP_BLOCK_RSS:
  1208. $sRssUrl = $sRssLength = '';
  1209. if($aBlock['content'] != '')
  1210. list($sRssUrl, $sRssLength) = explode($this->sParamsDivider, $aBlock['content']);
  1211. $aFields = array(
  1212. 'content' => array(
  1213. 'type' => 'hidden',
  1214. 'name' => 'content',
  1215. 'value' => '',
  1216. 'db' => array (
  1217. 'pass' => 'Xss',
  1218. ),
  1219. ),
  1220. 'rss_url' => array(
  1221. 'type' => 'text',
  1222. 'name' => 'rss_url',
  1223. 'caption' => _t('_adm_bp_txt_block_content_rss_url'),
  1224. 'info' => _t('_adm_bp_dsc_block_content_rss_url'),
  1225. 'value' => $sRssUrl,
  1226. 'required' => '0',
  1227. 'db' => array (
  1228. 'pass' => 'Xss',
  1229. ),
  1230. ),
  1231. 'rss_length' => array(
  1232. 'type' => 'text',
  1233. 'name' => 'rss_length',
  1234. 'caption' => _t('_adm_bp_txt_block_content_rss_length'),
  1235. 'info' => _t('_adm_bp_dsc_block_content_rss_length'),
  1236. 'value' => $sRssLength,
  1237. 'required' => '0',
  1238. 'db' => array (
  1239. 'pass' => 'Int',
  1240. ),
  1241. ),
  1242. );
  1243. break;
  1244. case BX_DOL_STUDIO_BP_BLOCK_MENU:
  1245. $aFields = array(
  1246. 'content' => array(
  1247. 'type' => 'select',
  1248. 'name' => 'content',
  1249. 'caption' => _t('_adm_bp_txt_block_content_menu'),
  1250. 'info' => '',
  1251. 'value' => $aBlock['content'],
  1252. 'values' => array(),
  1253. 'required' => '0',
  1254. 'db' => array (
  1255. 'pass' => 'Xss',
  1256. ),
  1257. )
  1258. );
  1259. $aMenus = $this->oDb->getMenus();
  1260. foreach($aMenus as $sKey => $sValue)
  1261. $aFields['content']['values'][$sKey] = _t($sValue);
  1262. asort($aFields['content']['values']);
  1263. $aFields['content']['values'] = array_merge(array('' => _t('_adm_bp_txt_block_content_menu_empty')), $aFields['content']['values']);
  1264. break;
  1265. case BX_DOL_STUDIO_BP_BLOCK_SERVICE:
  1266. $aService = array('module' => '', 'method' => '');
  1267. if($aBlock['content'] != '')
  1268. $aService = unserialize($aBlock['content']);
  1269. $aFields = array(
  1270. 'service_module' => array(
  1271. 'type' => 'value',
  1272. 'name' => 'service_module',
  1273. 'caption' => _t('_adm_bp_txt_block_content_service_module'),
  1274. 'value' => $this->getModuleTitle($aService['module'])
  1275. ),
  1276. 'service_method' => array(
  1277. 'type' => 'value',
  1278. 'name' => 'service_method',
  1279. 'caption' => _t('_adm_bp_txt_block_content_service_method'),
  1280. 'value' => $aService['method']
  1281. )
  1282. );
  1283. break;
  1284. }
  1285. return $aFields;
  1286. }
  1287. protected function getBlockList($sModule)
  1288. {
  1289. if(empty($sModule))
  1290. return '';
  1291. $sJsObject = $this->getPageJsObject();
  1292. $oTemplate = BxDolStudioTemplate::getInstance();
  1293. $oForm = new BxTemplStudioFormView(array());
  1294. $aInputCheckbox = array(
  1295. 'type' => 'checkbox',
  1296. 'name' => 'blocks[]',
  1297. 'attrs' => array(
  1298. 'onChange' => 'javascript:' . $sJsObject . '.onSelectBlock(this);'
  1299. ),
  1300. 'value' => ''
  1301. );
  1302. $aTmplParams = array(
  1303. 'html_block_list_id' => $this->aHtmlIds['block_list_id'] . $sModule,
  1304. 'bx_repeat:blocks' => array()
  1305. );
  1306. $aBlocks = $this->getBlocks($sModule);
  1307. foreach($aBlocks as $aBlock) {
  1308. list($sIcon, $sIconUrl) = $this->getBlockIcon($aBlock);
  1309. $aInputCheckbox['value'] = $aBlock['id'];
  1310. $aTmplParams['bx_repeat:blocks'][] = array(
  1311. 'js_object' => $sJsObject,
  1312. 'html_id' => $this->aHtmlIds['block_id'] . $aBlock['id'],
  1313. 'bx_if:is_inactive' => array(
  1314. 'condition' => false,
  1315. 'content' => array()
  1316. ),
  1317. 'bx_if:show_link' => array(
  1318. 'condition' => false,
  1319. 'content' => array()
  1320. ),
  1321. 'bx_if:show_text' => array(
  1322. 'condition' => true,
  1323. 'content' => array(
  1324. 'title' => _t(!empty($aBlock['title_system']) ? $aBlock['title_system'] : $aBlock['title']),
  1325. )
  1326. ),
  1327. 'bx_if:image' => array (
  1328. 'condition' => (bool)$sIconUrl,
  1329. 'content' => array('icon_url' => $sIconUrl),
  1330. ),
  1331. 'bx_if:icon' => array (
  1332. 'condition' => (bool)$sIcon,
  1333. 'content' => array('icon' => $sIcon),
  1334. ),
  1335. 'module' => $this->getModuleTitle($aBlock['module']),
  1336. 'visible_for' => _t('_adm_bp_txt_visible_for', BxDolStudioUtils::getVisibilityTitle($aBlock['visible_for_levels'])),
  1337. 'bx_if:show_checkbox' => array(
  1338. 'condition' => true,
  1339. 'content' => array(
  1340. 'content' => $oForm->genRow($aInputCheckbox)
  1341. )
  1342. ),
  1343. 'bx_if:show_drag_handle' => array(
  1344. 'condition' => false,
  1345. 'content' => array()
  1346. )
  1347. );
  1348. }
  1349. return $oTemplate->parseHtmlByName('bp_blocks_list.html', $aTmplParams);
  1350. }
  1351. protected function onBlockDelete($aBlock)
  1352. {
  1353. if($aBlock['module'] != BX_DOL_STUDIO_MODULE_CUSTOM)
  1354. return;
  1355. BxDolStudioLanguagesUtils::getInstance()->deleteLanguageString($aBlock['title']);
  1356. //--- Process Lang block
  1357. if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_LANG && $aBlock['content'] != '')
  1358. BxDolStudioLanguagesUtils::getInstance()->deleteLanguageString($aBlock['content']);
  1359. //--- Process Image block
  1360. if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_IMAGE && $aBlock['content'] != '') {
  1361. $iImageId = $sImageAlign = '';
  1362. list($iImageId, $sImageAlign) = explode($this->sParamsDivider, $aBlock['content']);
  1363. if(is_numeric($iImageId) && (int)$iImageId != 0)
  1364. BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->deleteFile((int)$iImageId, 0);
  1365. }
  1366. }
  1367. protected function getBlocks($sModule)
  1368. {
  1369. $aBlocks = array();
  1370. $this->oDb->getBlocks(array('type' => 'by_module_to_copy', 'value' => $sModule), $aBlocks, false);
  1371. return $aBlocks;
  1372. }
  1373. protected function _getTmplVarsBlockPanelTop()
  1374. {
  1375. $sJsObject = $this->getPageJsObject();
  1376. $oForm = new BxTemplStudioFormView(array());
  1377. $aInputPages = array(
  1378. 'type' => 'select',
  1379. 'name' => 'page',
  1380. 'attrs' => array(
  1381. 'onChange' => 'javascript:' . $this->getPageJsObject() . '.onChangePage(this)'
  1382. ),
  1383. 'value' => $this->sPage,
  1384. 'values' => array(
  1385. array('key' => '', 'value' => _t('_adm_bp_txt_select_page'))
  1386. )
  1387. );
  1388. $aPages = $aCounter = array();
  1389. $this->oDb->getPages(array('type' => 'by_module', 'value' => $this->sType), $aPages, false);
  1390. $this->oDb->getBlocks(array('type' => 'counter_by_pages'), $aCounter, false);
  1391. foreach($aPages as $aPage)
  1392. $aInputPages['values'][] = array('key' => $aPage['object'], 'value' => _t($aPage['title_system']) . " (" . (isset($aCounter[$aPage['object']]) ? $aCounter[$aPage['object']] : "0") . ")");
  1393. $aTmplVarsActions = array();
  1394. if(($this->sPage != '' && !empty($this->aPageRebuild)) !== false)
  1395. $aTmplVarsActions = $this->_getTmplVarsBlockPanelTopActions();
  1396. return array(
  1397. 'js_object' => $this->getPageJsObject(),
  1398. 'selector' => $oForm->genRow($aInputPages),
  1399. 'action_page_create' => $this->sActionPageCreate,
  1400. 'bx_if:show_actions' => array(
  1401. 'condition' => $this->sPage != '',
  1402. 'content' => $aTmplVarsActions
  1403. )
  1404. );
  1405. }
  1406. protected function _getTmplVarsBlockPanelTopActions()
  1407. {
  1408. $sJsObject = $this->getPageJsObject();
  1409. $oPermalinks = BxDolPermalinks::getInstance();
  1410. return array(
  1411. 'js_object' => $sJsObject,
  1412. 'url_view' => BX_DOL_URL_ROOT . $oPermalinks->permalink($this->aPageRebuild['url']),
  1413. 'action_page_edit' => $this->sActionPageEdit,
  1414. 'bx_if:can_delete' => array(
  1415. 'condition' => (int)$this->aPageRebuild['deletable'] == 1,
  1416. 'content' => array(
  1417. 'js_object' => $sJsObject
  1418. )
  1419. ),
  1420. 'action_block_create' => $this->sActionBlockCreate,
  1421. );
  1422. }
  1423. protected function _getTmplVarsPageSettings($aPage = array(), $bCreate = true)
  1424. {
  1425. $sJsObject = $this->getPageJsObject();
  1426. $aTmplParams = array(
  1427. 'menu' => array(),
  1428. 'html_settings_groups_id' => $this->aHtmlIds['settings_groups_id'],
  1429. 'bx_repeat:settings_groups' => array(),
  1430. 'submit' => _t($bCreate ? '_adm_bp_btn_page_create' : '_adm_bp_btn_page_apply')
  1431. );
  1432. foreach($this->aPageSettings as $aSetting) {
  1433. //--- get menu items
  1434. $aTmplParams['menu'][$aSetting['name']] = array(
  1435. 'name' => $aSetting['name'],
  1436. 'icon' => '',
  1437. 'onclick' => $sJsObject . '.onChangeSettingGroup(\'' . $aSetting['name'] . '\', this);',
  1438. 'title' => $aSetting['title'],
  1439. 'selected' => isset($aSetting['active']) && (int)$aSetting['active'] == 1
  1440. );
  1441. //--- get settings
  1442. $aTmplParams['bx_repeat:settings_groups'][] = array(
  1443. 'html_settings_group_id' => $this->aHtmlIds['settings_group_id'] . $aSetting['name'],
  1444. 'bx_if:hidden' => array(
  1445. 'condition' => $aSetting['active'] != 1,
  1446. 'content' => array()
  1447. ),
  1448. 'content' => $this->{'getSettings' . $this->getClassName($aSetting['name'])}($aPage, $bCreate)
  1449. );
  1450. }
  1451. $oMenu = new BxTemplStudioMenu(array('template' => 'menu_side.html', 'menu_items' => $aTmplParams['menu']));
  1452. $aTmplParams['menu'] = $oMenu->getCode();
  1453. return $aTmplParams;
  1454. }
  1455. }
  1456. /** @} */