BxBaseStudioSettings.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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 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'), $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. 'save' => array(
  137. 'type' => 'submit',
  138. 'name' => 'save',
  139. 'value' => _t("_adm_btn_settings_save"),
  140. )
  141. )
  142. );
  143. $oForm = new BxTemplStudioFormView($aForm, $oTemplate);
  144. $oForm->initChecker();
  145. if($oForm->isSubmittedAndValid()) {
  146. echo $this->saveChanges($oForm);
  147. exit;
  148. }
  149. $bTmplVarsMixes = false;
  150. $aTmplVarsMixes = array();
  151. if($this->bMixes) {
  152. if(is_string($this->sCategory))
  153. $aMixesBrowse = array('type' => 'by_type_category', 'type' => $this->sType, 'category' => $this->sCategory);
  154. else
  155. $aMixesBrowse = array('type' => 'by_type', 'value' => $this->sType);
  156. $aMixes = array();
  157. $this->oDb->getMixes($aMixesBrowse, $aMixes, false);
  158. $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);
  159. foreach($aMixes as $aMix)
  160. $aTmplVarsMixes[] = array(
  161. 'value' => $aMix['name'],
  162. 'title' => $aMix['title'],
  163. 'bx_if:show_checked_mix' => array(
  164. 'condition' => !empty($this->sMix) && $aMix['name'] == $this->sMix,
  165. 'content' => array()
  166. )
  167. );
  168. $bTmplVarsMixes = !empty($aTmplVarsMixes);
  169. }
  170. $bMixSelected = !empty($this->sMix) && !empty($this->aMix);
  171. $aTmplVarsButton = array();
  172. if($bMixSelected)
  173. $aTmplVarsButton = array(
  174. 'js_object' => $sJsObject,
  175. 'id' => $this->aMix['id']
  176. );
  177. return $oTemplate->parseHtmlByName('settings.html', array(
  178. 'js_object' => $sJsObject,
  179. 'type' => $this->sType,
  180. 'category' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  181. 'mix' => $this->sMix,
  182. 'bx_if:show_mixes' => array(
  183. 'condition' => $this->bMixes,
  184. 'content' => array(
  185. 'js_object' => $sJsObject,
  186. 'bx_if:show_select_mix' => array(
  187. 'condition' => $bTmplVarsMixes,
  188. 'content' => array(
  189. 'js_object' => $sJsObject,
  190. 'bx_repeat:mixes' => $aTmplVarsMixes,
  191. )
  192. ),
  193. 'bx_if:show_export_mix' => array(
  194. 'condition' => $bMixSelected,
  195. 'content' => $aTmplVarsButton
  196. ),
  197. 'bx_if:show_delete_mix' => array(
  198. 'condition' => $bMixSelected,
  199. 'content' => $aTmplVarsButton
  200. ),
  201. )
  202. ),
  203. 'form' => $oForm->getCode()
  204. ));
  205. }
  206. public function getPopupCodeCreateMix()
  207. {
  208. $oTemplate = BxDolStudioTemplate::getInstance();
  209. $sJsObject = $this->getPageJsObject();
  210. $sForm = 'adm-settings-create-mix-form';
  211. $aForm = array(
  212. 'form_attrs' => array(
  213. 'id' => $sForm,
  214. 'name' => $sForm,
  215. 'action' => bx_append_url_params(BX_DOL_URL_STUDIO . 'settings.php', array('stg_action' => 'create-mix')),
  216. 'method' => 'post',
  217. 'enctype' => 'multipart/form-data'
  218. ),
  219. 'params' => array(
  220. 'db' => array(
  221. 'table' => 'sys_options_mixes',
  222. 'key' => 'id',
  223. 'uri' => 'name',
  224. 'uri_title' => 'title',
  225. 'submit_name' => 'save'
  226. ),
  227. ),
  228. 'inputs' => array(
  229. 'page' => array(
  230. 'type' => 'hidden',
  231. 'name' => 'page',
  232. 'value' => $this->sType
  233. ),
  234. 'category' => array(
  235. 'type' => 'hidden',
  236. 'name' => 'category',
  237. 'value' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  238. ),
  239. 'title' => array(
  240. 'type' => 'text',
  241. 'name' => 'title',
  242. 'caption' => _t('_adm_stg_txt_mix_title'),
  243. 'value' => '',
  244. 'required' => true,
  245. 'checker' => array(
  246. 'func' => 'avail',
  247. 'params' => array(),
  248. 'error' => _t('_adm_stg_txt_mix_title_err')
  249. ),
  250. 'db' => array (
  251. 'pass' => 'Xss',
  252. )
  253. ),
  254. 'duplicate' => array(
  255. 'type' => 'select',
  256. 'name' => 'duplicate',
  257. 'caption' => _t('_adm_stg_txt_mix_duplicate'),
  258. 'values' => array(
  259. array('key' => '', 'value' => _t('_None'))
  260. ),
  261. 'value' => '',
  262. ),
  263. 'controls' => array(
  264. 'type' => 'input_set',
  265. array(
  266. 'type' => 'submit',
  267. 'name' => 'save',
  268. 'value' => _t('_adm_btn_settings_save'),
  269. ),
  270. array(
  271. 'type' => 'button',
  272. 'name' => 'cancel',
  273. 'value' => _t('_adm_txt_confirm_cancel'),
  274. 'attrs' => array(
  275. 'class' => 'bx-def-margin-sec-left-auto',
  276. 'onclick' => '$(".bx-popup-applied:visible").dolPopupHide()'
  277. )
  278. )
  279. )
  280. )
  281. );
  282. $aMixes = array();
  283. $this->oDb->getMixes(array('type' => 'by_type_category', 'type' => $this->sType, 'category' => $this->sCategory), $aMixes, false);
  284. foreach($aMixes as $aMix)
  285. $aForm['inputs']['duplicate']['values'][] = array('key' => $aMix['name'], 'value' => $aMix['title']);
  286. $oForm = new BxTemplStudioFormView($aForm);
  287. $oForm->initChecker();
  288. if($oForm->isSubmittedAndValid()) {
  289. $iId = $oForm->insert(array(
  290. 'type' => $this->sType,
  291. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  292. 'name' => $oForm->generateUri()
  293. ));
  294. if($iId === false)
  295. return array('code' => '1', 'message' => _t('_adm_stg_err_cannot_perform'));
  296. $this->oDb->updateMixes(array('active' => 0), array(
  297. 'type' => $this->sType,
  298. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  299. 'active' => 1
  300. ));
  301. $this->oDb->updateMixes(array('active' => 1), array('id' => $iId));
  302. $aDuplicate = array();
  303. $this->oDb->getMixes(array('type' => 'by_name', 'value' => $oForm->getCleanValue('duplicate')), $aDuplicate, false);
  304. if(!empty($aDuplicate) && is_array($aDuplicate))
  305. $this->oDb->duplicateMixesOptions($aDuplicate['id'], $iId);
  306. return array(
  307. 'eval' => $sJsObject . '.onMixCreate(oData);'
  308. );
  309. }
  310. return array(
  311. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('adm-stg-create-mix-popup', _t('_adm_stg_txt_create_mix_popup'), $oTemplate->parseHtmlByName('stg_create_mix.html', array(
  312. 'js_object' => $sJsObject,
  313. 'form_id' => $sForm,
  314. 'form' => $oForm->getCode(true),
  315. )))
  316. );
  317. }
  318. public function getPopupCodeImportMix()
  319. {
  320. $oTemplate = BxDolStudioTemplate::getInstance();
  321. $sJsObject = $this->getPageJsObject();
  322. $sForm = 'adm-settings-import-mix-form';
  323. $aForm = array(
  324. 'form_attrs' => array(
  325. 'id' => $sForm,
  326. 'name' => $sForm,
  327. 'action' => bx_append_url_params(BX_DOL_URL_STUDIO . 'settings.php', array('stg_action' => 'import-mix')),
  328. 'method' => 'post',
  329. 'enctype' => 'multipart/form-data'
  330. ),
  331. 'params' => array(
  332. 'db' => array(
  333. 'table' => 'sys_options_mixes',
  334. 'key' => 'id',
  335. 'uri' => 'name',
  336. 'uri_title' => 'title',
  337. 'submit_name' => 'save'
  338. ),
  339. ),
  340. 'inputs' => array(
  341. 'page' => array(
  342. 'type' => 'hidden',
  343. 'name' => 'page',
  344. 'value' => $this->sType
  345. ),
  346. 'category' => array(
  347. 'type' => 'hidden',
  348. 'name' => 'category',
  349. 'value' => is_array($this->sCategory) ? json_encode($this->sCategory) : $this->sCategory,
  350. ),
  351. 'file' => array(
  352. 'type' => 'file',
  353. 'name' => 'file',
  354. 'caption' => '',
  355. 'value' => '',
  356. ),
  357. 'controls' => array(
  358. 'type' => 'input_set',
  359. array(
  360. 'type' => 'submit',
  361. 'name' => 'save',
  362. 'value' => _t('_adm_btn_settings_import'),
  363. ),
  364. array(
  365. 'type' => 'button',
  366. 'name' => 'cancel',
  367. 'value' => _t('_adm_txt_confirm_cancel'),
  368. 'attrs' => array(
  369. 'class' => 'bx-def-margin-sec-left-auto',
  370. 'onclick' => '$(".bx-popup-applied:visible").dolPopupHide()'
  371. )
  372. )
  373. )
  374. )
  375. );
  376. $oForm = new BxTemplStudioFormView($aForm);
  377. $oForm->initChecker();
  378. if($oForm->isSubmittedAndValid()) {
  379. $sError = _t('_adm_stg_err_cannot_perform');
  380. $aFile = $_FILES['file'];
  381. if(empty($aFile['tmp_name']))
  382. return array('code' => '1', 'message' => $sError);
  383. $sFile = $aFile['tmp_name'];
  384. $rHandle = @fopen($sFile, "r");
  385. if(!$rHandle)
  386. return array('code' => '2', 'message' => $sError);
  387. $sContents = fread($rHandle, filesize($sFile));
  388. fclose($rHandle);
  389. $aContent = json_decode($sContents, true);
  390. if(!is_array($aContent) || empty($aContent['mix']) || empty($aContent['options']))
  391. return array('code' => '3', 'message' => $sError);
  392. $iId = $oForm->insert(array(
  393. 'type' => $aContent['mix']['type'],
  394. 'category' => $aContent['mix']['category'],
  395. 'name' => $aContent['mix']['name'],
  396. 'title' => $aContent['mix']['title']
  397. ));
  398. if($iId === false)
  399. return array('code' => '4', 'message' => $sError);
  400. foreach($aContent['options'] as $sKey => $sValue)
  401. $this->oDb->insertMixesOptions(array(
  402. 'option' => $sKey,
  403. 'mix_id' => $iId,
  404. 'value' => $sValue
  405. ));
  406. $this->oDb->updateMixes(array('active' => 0), array(
  407. 'type' => $this->sType,
  408. 'category' => is_string($this->sCategory) ? $this->sCategory : '',
  409. 'active' => 1
  410. ));
  411. $this->oDb->updateMixes(array('active' => 1), array('id' => $iId));
  412. return array(
  413. 'eval' => $sJsObject . '.onMixImport(oData);'
  414. );
  415. }
  416. return array(
  417. 'popup' => BxTemplStudioFunctions::getInstance()->popupBox('adm-stg-import-mix-popup', _t('_adm_stg_txt_import_mix_popup'), $oTemplate->parseHtmlByName('stg_import_mix.html', array(
  418. 'js_object' => $sJsObject,
  419. 'form_id' => $sForm,
  420. 'form' => $oForm->getCode(true),
  421. )))
  422. );
  423. }
  424. protected function header($aCategory, $aFields)
  425. {
  426. return array_merge(
  427. array(
  428. 'category_' . $aCategory['id'] . '_beg' => array(
  429. 'type' => 'block_header',
  430. 'name' => 'category_' . $aCategory['id'] . '_beg',
  431. 'caption' => _t($aCategory['caption']),
  432. 'collapsable' => true,
  433. 'collapsed' => !$aCategory['selected']
  434. )
  435. ),
  436. $aFields);
  437. }
  438. protected function field($aItem, $aItems2Mixes)
  439. {
  440. $oTemplate = BxDolStudioTemplate::getInstance();
  441. $mixedValue = isset($aItems2Mixes[$aItem['name']]) ? $aItems2Mixes[$aItem['name']] : $aItem['value'];
  442. $aAttributes = array();
  443. if(!empty($this->aMix) && (int)$this->aMix['editable'] == 0)
  444. $aAttributes = array_merge($aAttributes, array(
  445. 'disabled' => 'disabled'
  446. ));
  447. $aField = array();
  448. switch($aItem['type']) {
  449. case 'digit':
  450. $aField = array(
  451. 'type' => 'text',
  452. 'name' => $aItem['name'],
  453. 'caption' => _t($aItem['caption']),
  454. 'value' => $mixedValue,
  455. 'attrs' => $aAttributes,
  456. 'db' => array (
  457. 'pass' => 'Xss',
  458. ),
  459. );
  460. break;
  461. case 'text':
  462. $aField = array(
  463. 'type' => 'textarea',
  464. 'name' => $aItem['name'],
  465. 'caption' => _t($aItem['caption']),
  466. 'value' => $mixedValue,
  467. 'attrs' => $aAttributes,
  468. 'db' => array (
  469. 'pass' => 'XssHtml',
  470. ),
  471. );
  472. break;
  473. case 'checkbox':
  474. $aField = array(
  475. 'type' => 'checkbox',
  476. 'name' => $aItem['name'],
  477. 'caption' => _t($aItem['caption']),
  478. 'value' => 'on',
  479. 'checked' => $mixedValue == 'on',
  480. 'attrs' => $aAttributes,
  481. 'db' => array (
  482. 'pass' => 'Xss',
  483. ),
  484. );
  485. break;
  486. case 'list':
  487. case 'rlist':
  488. $aField = array(
  489. 'type' => 'checkbox_set',
  490. 'name' => $aItem['name'],
  491. 'caption' => _t($aItem['caption']),
  492. 'value' => !empty($mixedValue) ? explode(',', $mixedValue) : array(),
  493. 'reverse' => $aItem['type'] == 'rlist',
  494. 'attrs' => $aAttributes,
  495. 'db' => array (
  496. 'pass' => 'Xss',
  497. ),
  498. );
  499. if (BxDolService::isSerializedService($aItem['extra']))
  500. $aField['values'] = BxDolService::callSerialized($aItem['extra']);
  501. else
  502. foreach(explode(',', $aItem['extra']) as $sValue)
  503. $aField['values'][$sValue] = $sValue;
  504. break;
  505. case 'select':
  506. $aField = array(
  507. 'type' => 'select',
  508. 'name' => $aItem['name'],
  509. 'caption' => _t($aItem['caption']),
  510. 'value' => $mixedValue,
  511. 'values' => array(),
  512. 'attrs' => $aAttributes,
  513. 'db' => array (
  514. 'pass' => 'Xss',
  515. ),
  516. );
  517. if (BxDolService::isSerializedService($aItem['extra']))
  518. $aField['values'] = BxDolService::callSerialized($aItem['extra']);
  519. else
  520. foreach(explode(',', $aItem['extra']) as $sValue)
  521. $aField['values'][] = array('key' => $sValue, 'value' => $sValue);
  522. break;
  523. case 'file':
  524. $aField = array(
  525. 'type' => 'file',
  526. 'name' => $aItem['name'],
  527. 'caption' => _t($aItem['caption']),
  528. 'value' => $mixedValue,
  529. 'attrs' => $aAttributes,
  530. 'db' => array (
  531. 'pass' => 'Xss'
  532. )
  533. );
  534. break;
  535. case 'image':
  536. //--- Concatenation integer values as strings is required to get unique content id
  537. $iContentId = (int)($aItem['id'] . ($this->bMixes && isset($this->aMix['id']) ? $this->aMix['id'] : 0));
  538. $aField = array(
  539. 'type' => 'files',
  540. 'name' => $aItem['name'],
  541. 'storage_object' => $this->sStorage,
  542. 'images_transcoder' => $this->sTranscoder,
  543. 'uploaders' => array('sys_settings_html5'),
  544. 'upload_buttons_titles' => array('HTML5' => _t('_sys_uploader_button_name_single')),
  545. 'multiple' => false,
  546. 'content_id' => $iContentId,
  547. 'ghost_template' => array(
  548. 'inputs' => array(),
  549. ),
  550. 'caption' => _t($aItem['caption']),
  551. 'value' => $mixedValue,
  552. 'attrs' => $aAttributes,
  553. 'db' => array (
  554. 'pass' => 'Xss'
  555. )
  556. );
  557. break;
  558. case 'rgb':
  559. case 'rgba':
  560. $aField = array(
  561. 'type' => $aItem['type'],
  562. 'name' => $aItem['name'],
  563. 'caption' => _t($aItem['caption']),
  564. 'value' => $mixedValue,
  565. 'attrs' => $aAttributes,
  566. 'db' => array (
  567. 'pass' => 'Xss',
  568. ),
  569. );
  570. break;
  571. }
  572. return $aField;
  573. }
  574. protected function getMenuIcon($sGroup, &$aType)
  575. {
  576. if(empty($aType['icon']) || ($sUrl = BxDolStudioTemplate::getInstance()->getIconUrl($aType['icon'])) == "")
  577. switch($sGroup) {
  578. case BX_DOL_STUDIO_STG_GROUP_MODULES:
  579. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  580. break;
  581. case BX_DOL_STUDIO_STG_GROUP_LANGUAGES:
  582. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_LANGUAGE);
  583. break;
  584. case BX_DOL_STUDIO_STG_GROUP_TEMPLATES:
  585. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_TEMPLATE);
  586. break;
  587. }
  588. return $aType['icon'];
  589. }
  590. }
  591. /** @} */