BxBaseStudioSettings.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioSettings extends BxDolStudioSettings
  11. {
  12. public function __construct($sType = '', $mixedCategory = '')
  13. {
  14. parent::__construct($sType, $mixedCategory);
  15. }
  16. public function getPageCss()
  17. {
  18. return array_merge(parent::getPageCss(), array('forms.css', 'settings.css'));
  19. }
  20. public function getPageJs()
  21. {
  22. return array_merge(parent::getPageJs(), array('jquery.form.min.js', 'jquery.webForms.js', 'settings.js'));
  23. }
  24. public function getPageJsObject()
  25. {
  26. return 'oBxDolStudioSettings';
  27. }
  28. public function getPageMenu($aMenu = array(), $aMarkers = array())
  29. {
  30. $aTypes = $aMenu = array();
  31. if($this->oDb->getTypes(array('type' => 'all', 'not_in_group' => array(BX_DOL_STUDIO_STG_GROUP_TEMPLATES)), $aTypes) > 0 ) {
  32. $aTypesGrouped = array();
  33. foreach($aTypes as $aType)
  34. $aTypesGrouped[$aType['group']][] = $aType;
  35. foreach($aTypesGrouped as $sGroup => $aTypes)
  36. foreach($aTypes as $aType)
  37. $aMenu[] = array(
  38. 'name' => $aType['name'],
  39. 'icon' => $this->getMenuIcon($sGroup, $aType),
  40. 'link' => BX_DOL_URL_STUDIO . 'settings.php?page=' . $aType['name'],
  41. 'title' => $aType['caption'],
  42. 'selected' => $aType['name'] == $this->sType
  43. );
  44. }
  45. return parent::getPageMenu($aMenu);
  46. }
  47. public function getPageCode($sCategorySelected = '')
  48. {
  49. $oTemplate = BxDolStudioTemplate::getInstance();
  50. $sJsObject = $this->getPageJsObject();
  51. $aCategories = array();
  52. $iCategories = $this->oDb->getCategories(array('type' => 'by_type_name_key_name', 'type_name' => $this->sType, 'category_name' => $this->sCategory, 'hidden' => 0), $aCategories);
  53. if($iCategories > 0)
  54. $aCategories = array_keys($aCategories);
  55. $bMix = false;
  56. $aOptions2Mixes = array();
  57. if($this->bMixes) {
  58. if(is_string($this->sCategory))
  59. $aMixesBrowse = array('type' => 'by_type_category', 'type' => $this->sType, 'category' => $this->sCategory, 'active' => 1);
  60. else
  61. $aMixesBrowse = array('type' => 'by_type', 'value' => $this->sType, 'active' => 1);
  62. $aMix = array();
  63. $this->oDb->getMixes($aMixesBrowse, $aMix, false);
  64. $this->sMix = BX_DOL_STUDIO_STG_MIX_DEFAULT;
  65. if(!empty($aMix) && is_array($aMix)) {
  66. $this->aMix = $aMix;
  67. $this->sMix = $aMix['name'];
  68. $bMix = true;
  69. $this->oDb->getMixesOptions(array('type' => 'by_mix_id_pair_option_value', 'value' => $this->aMix['id']), $aOptions2Mixes, false);
  70. }
  71. }
  72. $bWrap = count($aCategories) > 1;
  73. $aForm = array(
  74. 'form_attrs' => array(
  75. 'id' => 'adm-settings-form',
  76. 'name' => 'adm-settings-form',
  77. 'action' => BX_DOL_URL_STUDIO . 'settings.php?page=' . $this->sType,
  78. 'method' => 'post',
  79. 'enctype' => 'multipart/form-data',
  80. 'target' => 'adm-settings-iframe'
  81. ),
  82. 'params' => array(
  83. 'db' => array(
  84. 'table' => 'sys_options',
  85. 'key' => 'id',
  86. 'uri' => '',
  87. 'uri_title' => '',
  88. 'submit_name' => 'save'
  89. ),
  90. ),
  91. 'inputs' => array()
  92. );
  93. if($bMix)
  94. $aForm['inputs']['mix_id'] = array(
  95. 'type' => 'hidden',
  96. 'name' => 'mix_id',
  97. 'value' => $this->aMix['id'],
  98. 'db' => array (
  99. 'pass' => 'Int',
  100. ),
  101. );
  102. foreach($aCategories as $sCategory) {
  103. $aFields = array();
  104. if(empty($sCategory))
  105. continue;
  106. $aCategory = array();
  107. $iCategory = $this->oDb->getCategories(array('type' => 'by_name', 'value' => $sCategory), $aCategory);
  108. if($iCategory != 1)
  109. continue;
  110. $aOptions = array();
  111. $iOptions = $this->oDb->getOptions(array('type' => 'by_category_id', 'value' => $aCategory['id']), $aOptions);
  112. foreach($aOptions as $aOption)
  113. $aFields[$aOption['name']] = $this->field($aOption, $aOptions2Mixes);
  114. if($bWrap) {
  115. $aCategory['selected'] = $aCategory['name'] == $sCategorySelected;
  116. $aFields = $this->header($aCategory, $aFields);
  117. }
  118. $aForm['inputs'] = array_merge($aForm['inputs'], $aFields);
  119. }
  120. $aForm['inputs'] = array_merge(
  121. $aForm['inputs'],
  122. (!$bWrap ? array() : array(
  123. 'header_save' => array(
  124. 'type' => 'block_header',
  125. ),
  126. )),
  127. array(
  128. 'categories' => array(
  129. 'type' => 'hidden',
  130. 'name' => 'categories',
  131. 'value' => implode(',', $aCategories),
  132. 'db' => array (
  133. 'pass' => 'Xss',
  134. ),
  135. )
  136. ),
  137. ($this->isReadOnly() ? array() : array(
  138. 'save' => array(
  139. 'type' => 'submit',
  140. 'name' => 'save',
  141. 'value' => _t("_adm_btn_settings_save"),
  142. ),
  143. ))
  144. );
  145. $oForm = new BxTemplStudioFormView($aForm, $oTemplate);
  146. $oForm->initChecker();
  147. if($oForm->isSubmittedAndValid()) {
  148. echo $this->saveChanges($oForm);
  149. exit;
  150. }
  151. $bTmplVarsMixes = false;
  152. $aTmplVarsMixes = array();
  153. if($this->bMixes) {
  154. if(is_string($this->sCategory))
  155. $aMixesBrowse = array('type' => 'by_type_category', 'type' => $this->sType, 'category' => $this->sCategory);
  156. else
  157. $aMixesBrowse = array('type' => 'by_type', 'value' => $this->sType);
  158. $aMixes = array();
  159. $this->oDb->getMixes($aMixesBrowse, $aMixes, false);
  160. $aMixes = array_merge(array(array('name' => BX_DOL_STUDIO_STG_MIX_DEFAULT, 'title' => _t('_adm_stg_txt_mix_' . BX_DOL_STUDIO_STG_MIX_DEFAULT))), $aMixes);
  161. foreach($aMixes as $aMix)
  162. $aTmplVarsMixes[] = array(
  163. 'value' => $aMix['name'],
  164. 'title' => $aMix['title'],
  165. 'bx_if:show_checked_mix' => array(
  166. 'condition' => !empty($this->sMix) && $aMix['name'] == $this->sMix,
  167. 'content' => array()
  168. )
  169. );
  170. $bTmplVarsMixes = !empty($aTmplVarsMixes);
  171. }
  172. $bMixSelected = !empty($this->sMix) && !empty($this->aMix);
  173. $aTmplVarsButton = array();
  174. if($bMixSelected)
  175. $aTmplVarsButton = array(
  176. 'js_object' => $sJsObject,
  177. 'id' => $this->aMix['id']
  178. );
  179. return $oTemplate->parseHtmlByName('settings.html', array(
  180. 'js_object' => $sJsObject,
  181. 'type' => $this->sType,
  182. 'category' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  183. 'mix' => $this->sMix,
  184. 'bx_if:show_mixes' => array(
  185. 'condition' => $this->bMixes,
  186. 'content' => array(
  187. 'js_object' => $sJsObject,
  188. 'bx_if:show_select_mix' => array(
  189. 'condition' => $bTmplVarsMixes,
  190. 'content' => array(
  191. 'js_object' => $sJsObject,
  192. 'bx_repeat:mixes' => $aTmplVarsMixes,
  193. )
  194. ),
  195. 'bx_if:show_export_mix' => array(
  196. 'condition' => $bMixSelected,
  197. 'content' => $aTmplVarsButton
  198. ),
  199. 'bx_if:show_delete_mix' => array(
  200. 'condition' => $bMixSelected,
  201. 'content' => $aTmplVarsButton
  202. ),
  203. )
  204. ),
  205. 'form' => $oForm->getCode()
  206. ));
  207. }
  208. public function getPopupCodeCreateMix()
  209. {
  210. $oTemplate = BxDolStudioTemplate::getInstance();
  211. $sJsObject = $this->getPageJsObject();
  212. $sForm = 'adm-settings-create-mix-form';
  213. $aForm = array(
  214. 'form_attrs' => array(
  215. 'id' => $sForm,
  216. 'name' => $sForm,
  217. 'action' => bx_append_url_params(BX_DOL_URL_STUDIO . 'settings.php', array('stg_action' => 'create-mix')),
  218. 'method' => 'post',
  219. 'enctype' => 'multipart/form-data'
  220. ),
  221. 'params' => array(
  222. 'db' => array(
  223. 'table' => 'sys_options_mixes',
  224. 'key' => 'id',
  225. 'uri' => 'name',
  226. 'uri_title' => 'title',
  227. 'submit_name' => 'save'
  228. ),
  229. ),
  230. 'inputs' => array(
  231. 'page' => array(
  232. 'type' => 'hidden',
  233. 'name' => 'page',
  234. 'value' => $this->sType
  235. ),
  236. 'category' => array(
  237. 'type' => 'hidden',
  238. 'name' => 'category',
  239. 'value' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  240. ),
  241. 'title' => array(
  242. 'type' => 'text',
  243. 'name' => 'title',
  244. 'caption' => _t('_adm_stg_txt_mix_title'),
  245. 'value' => '',
  246. 'required' => true,
  247. 'checker' => array(
  248. 'func' => 'avail',
  249. 'params' => array(),
  250. 'error' => _t('_adm_stg_txt_mix_title_err')
  251. ),
  252. 'db' => array (
  253. 'pass' => 'Xss',
  254. )
  255. ),
  256. 'duplicate' => array(
  257. 'type' => 'select',
  258. 'name' => 'duplicate',
  259. 'caption' => _t('_adm_stg_txt_mix_duplicate'),
  260. 'info' => _t('_adm_stg_txt_mix_duplicate_inf'),
  261. 'values' => array(
  262. array('key' => '', 'value' => _t('_None'))
  263. ),
  264. 'value' => '',
  265. ),
  266. 'controls' => array(
  267. 'type' => 'input_set',
  268. array(
  269. 'type' => 'submit',
  270. 'name' => 'save',
  271. 'value' => _t('_adm_btn_settings_save'),
  272. ),
  273. array(
  274. 'type' => 'button',
  275. 'name' => 'cancel',
  276. 'value' => _t('_adm_txt_confirm_cancel'),
  277. 'attrs' => array(
  278. 'class' => 'bx-def-margin-sec-left-auto',
  279. 'onclick' => '$(".bx-popup-applied:visible").dolPopupHide()'
  280. )
  281. )
  282. )
  283. )
  284. );
  285. $aMixes = array();
  286. $this->oDb->getMixes(array('type' => 'by_type_category', 'type' => $this->sType, 'category' => $this->sCategory), $aMixes, false);
  287. foreach($aMixes as $aMix)
  288. $aForm['inputs']['duplicate']['values'][] = array('key' => $aMix['name'], 'value' => $aMix['title']);
  289. $oForm = new BxTemplStudioFormView($aForm);
  290. $oForm->initChecker();
  291. if($oForm->isSubmittedAndValid()) {
  292. $iId = $oForm->insert(array(
  293. 'type' => $this->sType,
  294. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  295. 'name' => $oForm->generateUri()
  296. ));
  297. if($iId === false)
  298. return array('code' => '1', 'message' => _t('_adm_stg_err_cannot_perform'));
  299. $this->oDb->updateMixes(array('active' => 0), array(
  300. 'type' => $this->sType,
  301. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  302. 'active' => 1
  303. ));
  304. $this->oDb->updateMixes(array('active' => 1), array('id' => $iId));
  305. $aDuplicate = array();
  306. $this->oDb->getMixes(array('type' => 'by_name', 'value' => $oForm->getCleanValue('duplicate')), $aDuplicate, false);
  307. if(!empty($aDuplicate) && is_array($aDuplicate))
  308. $this->oDb->duplicateMixesOptions($aDuplicate['id'], $iId);
  309. return array(
  310. 'eval' => $sJsObject . '.onMixCreate(oData);'
  311. );
  312. }
  313. return array(
  314. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('adm-stg-create-mix-popup', _t('_adm_stg_txt_create_mix_popup'), $oTemplate->parseHtmlByName('stg_create_mix.html', array(
  315. 'js_object' => $sJsObject,
  316. 'form_id' => $sForm,
  317. 'form' => $oForm->getCode(true),
  318. )))
  319. );
  320. }
  321. public function getPopupCodeImportMix()
  322. {
  323. $oTemplate = BxDolStudioTemplate::getInstance();
  324. $sJsObject = $this->getPageJsObject();
  325. $sForm = 'adm-settings-import-mix-form';
  326. $aForm = array(
  327. 'form_attrs' => array(
  328. 'id' => $sForm,
  329. 'name' => $sForm,
  330. 'action' => bx_append_url_params(BX_DOL_URL_STUDIO . 'settings.php', array('stg_action' => 'import-mix')),
  331. 'method' => 'post',
  332. 'enctype' => 'multipart/form-data'
  333. ),
  334. 'params' => array(
  335. 'db' => array(
  336. 'table' => 'sys_options_mixes',
  337. 'key' => 'id',
  338. 'uri' => 'name',
  339. 'uri_title' => 'title',
  340. 'submit_name' => 'save'
  341. ),
  342. ),
  343. 'inputs' => array(
  344. 'page' => array(
  345. 'type' => 'hidden',
  346. 'name' => 'page',
  347. 'value' => $this->sType
  348. ),
  349. 'category' => array(
  350. 'type' => 'hidden',
  351. 'name' => 'category',
  352. 'value' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  353. ),
  354. 'file' => array(
  355. 'type' => 'file',
  356. 'name' => 'file',
  357. 'caption' => '',
  358. 'value' => '',
  359. ),
  360. 'controls' => array(
  361. 'type' => 'input_set',
  362. array(
  363. 'type' => 'submit',
  364. 'name' => 'save',
  365. 'value' => _t('_adm_btn_settings_import'),
  366. ),
  367. array(
  368. 'type' => 'button',
  369. 'name' => 'cancel',
  370. 'value' => _t('_adm_txt_confirm_cancel'),
  371. 'attrs' => array(
  372. 'class' => 'bx-def-margin-sec-left-auto',
  373. 'onclick' => '$(".bx-popup-applied:visible").dolPopupHide()'
  374. )
  375. )
  376. )
  377. )
  378. );
  379. $oForm = new BxTemplStudioFormView($aForm);
  380. $oForm->initChecker();
  381. if($oForm->isSubmittedAndValid()) {
  382. $sError = _t('_adm_stg_err_cannot_perform');
  383. $aFile = $_FILES['file'];
  384. if(empty($aFile['tmp_name']))
  385. return array('code' => '1', 'message' => $sError);
  386. $sFile = $aFile['tmp_name'];
  387. $rHandle = @fopen($sFile, "r");
  388. if(!$rHandle)
  389. return array('code' => '2', 'message' => $sError);
  390. $sContents = fread($rHandle, filesize($sFile));
  391. fclose($rHandle);
  392. $aContent = json_decode($sContents, true);
  393. if(!is_array($aContent) || empty($aContent['mix']) || empty($aContent['options']))
  394. return array('code' => '3', 'message' => $sError);
  395. $iId = $oForm->insert(array(
  396. 'type' => $aContent['mix']['type'],
  397. 'category' => $aContent['mix']['category'],
  398. 'name' => $aContent['mix']['name'],
  399. 'title' => $aContent['mix']['title']
  400. ));
  401. if($iId === false)
  402. return array('code' => '4', 'message' => $sError);
  403. foreach($aContent['options'] as $sKey => $sValue)
  404. $this->oDb->insertMixesOptions(array(
  405. 'option' => $sKey,
  406. 'mix_id' => $iId,
  407. 'value' => $sValue
  408. ));
  409. $this->oDb->updateMixes(array('active' => 0), array(
  410. 'type' => $this->sType,
  411. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  412. 'active' => 1
  413. ));
  414. $this->oDb->updateMixes(array('active' => 1), array('id' => $iId));
  415. return array(
  416. 'eval' => $sJsObject . '.onMixImport(oData);'
  417. );
  418. }
  419. return array(
  420. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('adm-stg-import-mix-popup', _t('_adm_stg_txt_import_mix_popup'), $oTemplate->parseHtmlByName('stg_import_mix.html', array(
  421. 'js_object' => $sJsObject,
  422. 'form_id' => $sForm,
  423. 'form' => $oForm->getCode(true),
  424. )))
  425. );
  426. }
  427. protected function header($aCategory, $aFields)
  428. {
  429. return array_merge(
  430. array(
  431. 'category_' . $aCategory['id'] . '_beg' => array(
  432. 'type' => 'block_header',
  433. 'name' => 'category_' . $aCategory['id'] . '_beg',
  434. 'caption' => _t($aCategory['caption']),
  435. 'collapsable' => true,
  436. 'collapsed' => !$aCategory['selected']
  437. )
  438. ),
  439. $aFields);
  440. }
  441. protected function field($aItem, $aItems2Mixes)
  442. {
  443. $mixedValue = isset($aItems2Mixes[$aItem['name']]) ? $aItems2Mixes[$aItem['name']] : $aItem['value'];
  444. $aAttributes = array();
  445. if($this->isReadOnly())
  446. $aAttributes = array_merge($aAttributes, array(
  447. 'disabled' => 'disabled'
  448. ));
  449. $aField = array();
  450. switch($aItem['type']) {
  451. case 'digit':
  452. $aField = array(
  453. 'type' => 'text',
  454. 'name' => $aItem['name'],
  455. 'caption' => _t($aItem['caption']),
  456. 'value' => $mixedValue,
  457. 'attrs' => $aAttributes,
  458. 'db' => array (
  459. 'pass' => 'Xss',
  460. ),
  461. );
  462. break;
  463. case 'text':
  464. $aField = array(
  465. 'type' => 'textarea',
  466. 'name' => $aItem['name'],
  467. 'caption' => _t($aItem['caption']),
  468. 'value' => $mixedValue,
  469. 'attrs' => $aAttributes,
  470. 'db' => array (
  471. 'pass' => 'XssHtml',
  472. ),
  473. );
  474. break;
  475. case 'checkbox':
  476. $aField = array(
  477. 'type' => 'checkbox',
  478. 'name' => $aItem['name'],
  479. 'caption' => _t($aItem['caption']),
  480. 'value' => 'on',
  481. 'checked' => $mixedValue == 'on',
  482. 'attrs' => $aAttributes,
  483. 'db' => array (
  484. 'pass' => 'Xss',
  485. ),
  486. );
  487. break;
  488. case 'list':
  489. case 'rlist':
  490. $aField = array(
  491. 'type' => 'checkbox_set',
  492. 'name' => $aItem['name'],
  493. 'caption' => _t($aItem['caption']),
  494. 'value' => !empty($mixedValue) ? explode(',', $mixedValue) : array(),
  495. 'reverse' => $aItem['type'] == 'rlist',
  496. 'attrs' => $aAttributes,
  497. 'db' => array (
  498. 'pass' => 'Xss',
  499. ),
  500. );
  501. if (BxDolService::isSerializedService($aItem['extra']))
  502. $aField['values'] = BxDolService::callSerialized($aItem['extra']);
  503. else
  504. foreach(explode(',', $aItem['extra']) as $sValue)
  505. $aField['values'][$sValue] = $sValue;
  506. break;
  507. case 'select':
  508. $aField = array(
  509. 'type' => 'select',
  510. 'name' => $aItem['name'],
  511. 'caption' => _t($aItem['caption']),
  512. 'value' => $mixedValue,
  513. 'values' => array(),
  514. 'attrs' => $aAttributes,
  515. 'db' => array (
  516. 'pass' => 'Xss',
  517. ),
  518. );
  519. if (BxDolService::isSerializedService($aItem['extra']))
  520. $aField['values'] = BxDolService::callSerialized($aItem['extra']);
  521. else
  522. foreach(explode(',', $aItem['extra']) as $sValue)
  523. $aField['values'][] = array('key' => $sValue, 'value' => $sValue);
  524. break;
  525. case 'file':
  526. $aField = array(
  527. 'type' => 'file',
  528. 'name' => $aItem['name'],
  529. 'caption' => _t($aItem['caption']),
  530. 'value' => $mixedValue,
  531. 'attrs' => $aAttributes,
  532. 'db' => array (
  533. 'pass' => 'Xss'
  534. )
  535. );
  536. break;
  537. case 'image':
  538. //--- Concatenation integer values as strings is required to get unique content id
  539. $iContentId = (int)($aItem['id'] . ($this->bMixes && isset($this->aMix['id']) ? $this->aMix['id'] : 0));
  540. $aField = array(
  541. 'type' => 'files',
  542. 'name' => $aItem['name'],
  543. 'storage_object' => $this->sStorage,
  544. 'storage_private' => 0,
  545. 'images_transcoder' => $this->sTranscoder,
  546. 'uploaders' => array('sys_settings_html5'),
  547. 'upload_buttons_titles' => array('HTML5' => _t('_sys_uploader_button_name_single')),
  548. 'multiple' => false,
  549. 'content_id' => $iContentId,
  550. 'ghost_template' => array(
  551. 'inputs' => array(),
  552. ),
  553. 'caption' => _t($aItem['caption']),
  554. 'value' => $mixedValue,
  555. 'attrs' => $aAttributes,
  556. 'db' => array (
  557. 'pass' => 'Xss'
  558. )
  559. );
  560. break;
  561. case 'rgb':
  562. case 'rgba':
  563. $aField = array(
  564. 'type' => $aItem['type'],
  565. 'name' => $aItem['name'],
  566. 'caption' => _t($aItem['caption']),
  567. 'value' => $mixedValue,
  568. 'attrs' => $aAttributes,
  569. 'db' => array (
  570. 'pass' => 'Xss',
  571. ),
  572. );
  573. break;
  574. }
  575. return $aField;
  576. }
  577. protected function getMenuIcon($sGroup, &$aType)
  578. {
  579. if(empty($aType['icon']) || ($sUrl = BxDolStudioTemplate::getInstance()->getIconUrl($aType['icon'])) == "")
  580. switch($sGroup) {
  581. case BX_DOL_STUDIO_STG_GROUP_MODULES:
  582. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  583. break;
  584. case BX_DOL_STUDIO_STG_GROUP_LANGUAGES:
  585. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_LANGUAGE);
  586. break;
  587. case BX_DOL_STUDIO_STG_GROUP_TEMPLATES:
  588. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_TEMPLATE);
  589. break;
  590. }
  591. return $aType['icon'];
  592. }
  593. }
  594. /** @} */