BxBaseFormView.php 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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 TridentCore Trident Core
  7. * @{
  8. */
  9. class BxBaseFormView extends BxDolForm
  10. {
  11. protected static $_isToggleJsAdded = false;
  12. protected static $_isCssJsAdded = false;
  13. protected static $_isCssJsAddedViewMode = false;
  14. /**
  15. * Enable or disable error message displaying
  16. */
  17. protected $bEnableErrorIcon = true;
  18. /**
  19. * HTML Code of this form
  20. */
  21. protected $sCode;
  22. /**
  23. * Code which will be added to the beginning of the form.
  24. * For example, hidden inputs.
  25. * For internal use only
  26. */
  27. protected $_sCodeAdd = '';
  28. /**
  29. * for internal use only
  30. */
  31. protected $_isSectionOpened = false;
  32. /**
  33. * Default divider for several inputs
  34. */
  35. protected $_sDivider = '<span class="bx-def-margin-left"></span>';
  36. /**
  37. * Alternative divider for several inputs
  38. */
  39. protected $_sDividerAlt = '<br />';
  40. /**
  41. * Form is added dynamically.
  42. */
  43. protected $_bDynamicMode = false;
  44. /**
  45. * Function name for generation close form section HTML.
  46. */
  47. protected $_sSectionClose = 'getCloseSection';
  48. /**
  49. * Function name for generation open form section HTML.
  50. */
  51. protected $_sSectionOpen = 'getOpenSection';
  52. /**
  53. * Constructor
  54. *
  55. * @param array $aInfo Form contents
  56. *
  57. * $aInfo['params'] = array(
  58. * 'remove_form' => true|false,
  59. * );
  60. *
  61. * @return BxBaseFormView
  62. */
  63. function __construct($aInfo, $oTemplate)
  64. {
  65. parent::__construct($aInfo, $oTemplate);
  66. if (isset($this->aParams['view_mode']) && $this->aParams['view_mode']) {
  67. $this->_sSectionClose = 'getCloseSectionViewMode';
  68. $this->_sSectionOpen = 'getOpenSectionViewMode';
  69. }
  70. }
  71. /**
  72. * Return Form code
  73. * @param $bDynamicMode - set it to true if form is added via JS/AJAX call, for example form in AJAX popup.
  74. * @return string
  75. */
  76. function getCode($bDynamicMode = false)
  77. {
  78. $this->_bDynamicMode = $bDynamicMode;
  79. $this->addCssJs ();
  80. $this->aFormAttrs = $this->_replaceMarkers($this->aFormAttrs);
  81. return ($this->sCode = $this->genForm());
  82. }
  83. /**
  84. * Generate the whole form
  85. *
  86. * @return string
  87. */
  88. function genForm()
  89. {
  90. $this->_sCodeAdd = '';
  91. $sTable = $this->genRows();
  92. $sHtmlBefore = isset($this->aParams['html_before']) ? $this->aParams['html_before'] : '';
  93. $sHtmlAfter = isset($this->aParams['html_after']) ? $this->aParams['html_after'] : '';
  94. if (!empty($this->aParams['remove_form']) || (isset($this->aParams['view_mode']) && $this->aParams['view_mode'])) {
  95. $sForm = <<<BLAH
  96. $sHtmlBefore
  97. {$this->_sCodeAdd}
  98. <div class="bx-form-advanced-wrapper {$this->id}_wrapper">
  99. $sTable
  100. </div>
  101. $sHtmlAfter
  102. BLAH;
  103. } else {
  104. $sFormAttrs = bx_convert_array2attrs($this->aFormAttrs, 'bx-form-advanced');
  105. $sForm = <<<BLAH
  106. $sHtmlBefore
  107. <form $sFormAttrs>
  108. {$this->_sCodeAdd}
  109. <div class="bx-form-advanced-wrapper {$this->id}_wrapper">
  110. $sTable
  111. </div>
  112. </form>
  113. <script>
  114. $(document).ready(function() {
  115. $(this).addWebForms();
  116. });
  117. </script>
  118. $sHtmlAfter
  119. BLAH;
  120. }
  121. return $sForm;
  122. }
  123. /**
  124. * Generate Table HTML code
  125. *
  126. * @return string
  127. */
  128. function genRows()
  129. {
  130. // add CSRF token if it's needed.
  131. if (!(isset($this->aParams['view_mode']) && $this->aParams['view_mode']) && getParam('sys_security_form_token_enable') == 'on' && (!isset($this->aParams['csrf']['disable']) || (isset($this->aParams['csrf']['disable']) && $this->aParams['csrf']['disable'] !== true)) && ($mixedCsrfToken = BxDolForm::getCsrfToken()) !== false) {
  132. $this->aInputs['csrf_token'] = array(
  133. 'type' => 'hidden',
  134. 'name' => 'csrf_token',
  135. 'value' => $mixedCsrfToken,
  136. 'db' => array ('pass' => 'Xss'),
  137. 'visible_for_levels' => PHP_INT_MAX,
  138. );
  139. }
  140. // check if we need to generate open section clause
  141. $sOpenSection = '';
  142. foreach ($this->aInputs as $aInput) {
  143. if (isset($aInput['type']) && 'hidden' == $aInput['type'])
  144. continue;
  145. if (isset($aInput['type']) && 'block_header' != $aInput['type'])
  146. $sOpenSection = $this->{$this->_sSectionOpen}();
  147. break;
  148. }
  149. // generate rows contents
  150. $sCont = '';
  151. $sFuncGenRow = isset($this->aParams['view_mode']) && $this->aParams['view_mode'] ? 'genViewRow' : 'genRow';
  152. foreach ($this->aInputs as $aInput)
  153. if (!isset($aInput['visible_for_levels']) || self::isVisible($aInput))
  154. $sCont .= $this->$sFuncGenRow($aInput);
  155. $sCloseSection = $this->{$this->_sSectionClose}();
  156. return $sOpenSection . $sCont . $sCloseSection;
  157. }
  158. /**
  159. * Generate single Table Row
  160. *
  161. * @param array $aInput
  162. * @return string
  163. */
  164. function genRow(&$aInput)
  165. {
  166. if (!isset($aInput['type']))
  167. $aInput['type'] = false;
  168. if (!empty($aInput['name'])) {
  169. $sCustomMethod = 'genCustomRow' . $this->_genMethodName($aInput['name']);
  170. if (method_exists($this, $sCustomMethod))
  171. return $this->$sCustomMethod($aInput);
  172. }
  173. switch ($aInput['type']) {
  174. case 'block_header':
  175. $sRow = $this->genRowBlockHeader($aInput);
  176. break;
  177. case 'block_end':
  178. $sRow = $this->genBlockEnd($aInput);
  179. break;
  180. case 'hidden':
  181. // do not generate row for hidden inputs
  182. $sRow = '';
  183. $this->_sCodeAdd .= $this->genInput($aInput);
  184. break;
  185. case 'select_box':
  186. $sRow = $this->genRowCustom($aInput, 'genInputSelectBox');
  187. break;
  188. case 'files':
  189. $sRow = $this->genRowCustom($aInput, 'genInputFiles');
  190. break;
  191. case 'switcher':
  192. case 'checkbox':
  193. $sRow = $this->genRowStandard($aInput, true);
  194. break;
  195. default:
  196. $sRow = $this->genRowStandard($aInput);
  197. }
  198. return $sRow;
  199. }
  200. /**
  201. * Generate single Table Row for view mode
  202. *
  203. * @param array $aInput
  204. * @return string
  205. */
  206. function genViewRow(&$aInput)
  207. {
  208. if (!isset($aInput['type']))
  209. $aInput['type'] = false;
  210. if (!empty($aInput['name'])) {
  211. $sCustomMethod = 'genCustomRow' . $this->_genMethodName($aInput['name']);
  212. if (method_exists($this, $sCustomMethod))
  213. return $this->$sCustomMethod($aInput);
  214. }
  215. switch ($aInput['type']) {
  216. case 'block_header':
  217. $sRow = $this->genRowBlockHeader($aInput);
  218. break;
  219. case 'block_end':
  220. $sRow = $this->genBlockEnd($aInput);
  221. break;
  222. default:
  223. $sRow = $this->genViewRowWrapped($aInput);
  224. }
  225. return $sRow;
  226. }
  227. /**
  228. * Generate complete wrapped row for view mode form
  229. *
  230. * @param array $aInput
  231. * @return string
  232. */
  233. function genViewRowWrapped(&$aInput)
  234. {
  235. $sValue = $this->genViewRowValue($aInput);
  236. if (null === $sValue)
  237. return '';
  238. $sCaption = isset($aInput['caption']) ? bx_process_output($aInput['caption']) : '';
  239. return <<<EOS
  240. <div class="bx-form-row-view-wrapper bx-form-row-view-wrapper-{$aInput['type']} bx-def-padding-sec-top">
  241. <div class="bx-form-row-view-caption bx-def-margin-sec-right">{$sCaption}:</div>
  242. <div class="bx-form-row-view-value">{$sValue}</div>
  243. </div>
  244. EOS;
  245. }
  246. /**
  247. * Generate value for view mode row
  248. *
  249. * @param array $aInput
  250. * @return string
  251. */
  252. function genViewRowValue(&$aInput)
  253. {
  254. switch ($aInput['type']) {
  255. case 'hidden':
  256. $sValue = null;
  257. break;
  258. case 'select':
  259. case 'radio_set':
  260. $sValue = $this->genViewRowValueForSelect($aInput);
  261. break;
  262. case 'datepicker':
  263. $iTime = bx_process_input ($aInput['value'], BX_DATA_DATE_TS, false, false);
  264. $sValue = bx_time_js ($iTime, BX_FORMAT_DATE);
  265. break;
  266. case 'date_time':
  267. case 'datetime':
  268. $iTime = bx_process_input ($aInput['value'], BX_DATA_DATETIME_TS, false, false);
  269. $sValue = bx_time_js ($iTime, BX_FORMAT_DATE_TIME);
  270. break;
  271. case 'checkbox_set':
  272. case 'select_multiple':
  273. $sValue = null;
  274. if (!empty($aInput['value']) && is_array($aInput['value'])) {
  275. $sValue = '';
  276. foreach ($aInput['value'] as $sVal)
  277. $sValue .= $aInput['values'][$sVal] . ', ';
  278. $sValue = trim ($sValue, ', ');
  279. }
  280. break;
  281. case 'checkbox':
  282. case 'switcher':
  283. $sValue = isset($aInput['checked']) && $aInput['checked'] ? _t('_sys_form_checkbox_value_on') : _t('_sys_form_checkbox_value_off');
  284. break;
  285. case 'textarea':
  286. if (isset($aInput['value']) && '' !== $aInput['value'])
  287. $sValue = isset($aInput['html']) && $aInput['html'] ? $aInput['value'] : nl2br(bx_process_output($aInput['value']));
  288. else
  289. $sValue = null;
  290. break;
  291. default:
  292. $sValue = isset($aInput['value']) && '' !== $aInput['value'] ? bx_process_output($aInput['value']) : null;
  293. }
  294. return $sValue;
  295. }
  296. function genViewRowValueForSelect(&$aInput)
  297. {
  298. $s = isset($aInput['value']) && isset($aInput['values'][$aInput['value']]) ? $aInput['values'][$aInput['value']] : null;
  299. if (isset($aInput['values_list_name']) && ($oCategory = BxDolCategory::getObjectInstanceByFormAndList($this->aFormAttrs['name'], $aInput['values_list_name'])))
  300. return $oCategory->getCategoryLink($s, $aInput['value']);
  301. return $s;
  302. }
  303. /**
  304. * Generate standard row
  305. *
  306. * @param array $aInput
  307. * @return string
  308. */
  309. function genRowStandard(&$aInput, $isOneLine = false)
  310. {
  311. $sCaption = isset($aInput['caption']) ? bx_process_output($aInput['caption']) : '';
  312. $sRequired = !empty($aInput['required']) ? '<span class="bx-form-required">*</span> ' : '';
  313. $sClassAdd = !empty($aInput['error']) ? ' bx-form-error' : '';
  314. $sInfoIcon = !empty($aInput['info']) ? $this->genInfoIcon($aInput['info']) : '';
  315. $sErrorIcon = $this->genErrorIcon(empty($aInput['error']) ? '' : $aInput['error']);
  316. if (isset($aInput['name']))
  317. $aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name'];
  318. $sTrAttrs = bx_convert_array2attrs(isset($aInput['tr_attrs']) && is_array($aInput['tr_attrs']) ? $aInput['tr_attrs'] : array(), "bx-form-element-wrapper bx-def-margin-top");
  319. $sClassOneLineCaption = '';
  320. $sClassOneLineValue = '';
  321. if ($isOneLine) {
  322. $sClassOneLineCaption = ' bx-form-caption-oneline bx-form-caption-oneline-' . $aInput['type'] . ' bx-def-margin-sec-left';
  323. $sClassOneLineValue = ' bx-form-value-oneline bx-form-value-oneline-' . $aInput['type'];
  324. $aInput['attrs']['id'] = $this->getInputId($aInput);
  325. if ($sCaption)
  326. $sCaption = '<label for="' . $aInput['attrs']['id'] . '">' . $sCaption . '</label>';
  327. }
  328. $sInput = $this->genInput($aInput);
  329. $sCaptionCode = '';
  330. if ($sCaption)
  331. $sCaptionCode = '<div class="bx-form-caption' . $sClassOneLineCaption . '">' . $sCaption . $sRequired . '</div>';
  332. else
  333. $sInput .= $sRequired;
  334. $sInputCode = $this->genWrapperInput($aInput, $sInput);
  335. if (empty($sInputCodeExtra)) $sInputCodeExtra = '';
  336. if (empty($sInfoIcon)) $sInfoIcon = '';
  337. if (empty($sInputCode)) $sInputCode = '';
  338. if (empty($sErrorIcon)) $sErrorIcon = '';
  339. $sValueCode = '
  340. <div class="bx-form-value bx-clearfix' . $sClassAdd . $sClassOneLineValue . '">
  341. ' . $sInputCode . '
  342. ' . ($isOneLine ? '' : $sInfoIcon . $sErrorIcon) . '
  343. ' . $sInputCodeExtra . '
  344. </div>';
  345. if ($isOneLine)
  346. $sCode = $sValueCode . $sCaptionCode . '<div class="bx-clear"></div>' . $sInfoIcon . $sErrorIcon;
  347. else
  348. $sCode = $sCaptionCode . $sValueCode;
  349. return "<div $sTrAttrs>" . $sCode . "</div>";
  350. }
  351. function genWrapperInput($aInput, $sContent)
  352. {
  353. $sAttr = isset($aInput['attrs_wrapper']) && is_array($aInput['attrs_wrapper']) ? bx_convert_array2attrs($aInput['attrs_wrapper']) : '';
  354. $sCode = <<<BLAH
  355. <div class="bx-form-input-wrapper bx-form-input-wrapper-{$aInput['type']}" $sAttr>
  356. $sContent
  357. </div>
  358. BLAH;
  359. return $sCode;
  360. }
  361. /**
  362. * Generate custom row
  363. *
  364. * @param array $aInput
  365. * @param string $sCustomMethod custom method to generate code for input
  366. * @return string
  367. */
  368. function genRowCustom(&$aInput, $sCustomMethod)
  369. {
  370. $sCaption = isset($aInput['caption']) ? bx_process_output($aInput['caption']) : '';
  371. $sRequired = !empty($aInput['required']) ? '<span class="bx-form-required">*</span> ' : '';
  372. $sClassAdd = !empty($aInput['error']) ? ' bx-form-error' : '';
  373. $sInfoIcon = !empty($aInput['info']) ? $this->genInfoIcon($aInput['info']) : '';
  374. $sErrorIcon = $this->genErrorIcon(empty($aInput['error']) ? '' : $aInput['error']);
  375. $sInput = $this->$sCustomMethod($aInput, $sInfoIcon, $sErrorIcon);
  376. if (isset($aInput['name']))
  377. $aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name'];
  378. $sTrAttrs = bx_convert_array2attrs(empty($aInput['tr_attrs']) ? array() : $aInput['tr_attrs'], "bx-form-element-wrapper bx-def-margin-top");
  379. $sCaptionCode = '';
  380. if ($sCaption)
  381. $sCaptionCode = '<div class="bx-form-caption">' . $sCaption . $sRequired . '</div>';
  382. $sCode = <<<BLAH
  383. <div $sTrAttrs>
  384. $sCaptionCode
  385. <div class="bx-form-value$sClassAdd">
  386. <div class="bx-clear"></div>
  387. $sInput
  388. <div class="bx-clear"></div>
  389. </div>
  390. </div>
  391. BLAH;
  392. return $sCode;
  393. }
  394. /**
  395. * Generate Block Headers row
  396. *
  397. * @param array $aInput
  398. * @return string
  399. */
  400. function genRowBlockHeader(&$aInput)
  401. {
  402. $aAttrs = empty($aInput['attrs']) ? '' : $aInput['attrs'];
  403. // if there is no caption - show divider only
  404. if (empty($aInput['caption'])) {
  405. $sCode = $this->{$this->_sSectionClose}();
  406. $sCode .= $this->{$this->_sSectionOpen}($aAttrs);
  407. return $sCode;
  408. }
  409. // if section is collapsed by default, add necessary code
  410. $sClassAddCollapsable = 'bx-form-collapsable';
  411. if (isset($aInput['collapsed']) and $aInput['collapsed'])
  412. $sClassAddCollapsable .= ' bx-form-collapsed bx-form-section-hidden';
  413. // display section with caption
  414. $sCode = $this->{$this->_sSectionClose}();
  415. if (empty($aAttrs))
  416. $aAttrs['class'] = 'bx-form-collapsable ' . $sClassAddCollapsable;
  417. else
  418. $aAttrs['class'] .= ' bx-form-collapsable ' . $sClassAddCollapsable;
  419. if (isset($this->aParams['view_mode']) && $this->aParams['view_mode'])
  420. $sLegend = '<legend class="bx-def-padding-sec-right bx-def-font-grayed bx-def-font-h3">' . bx_process_output($aInput['caption']) . '</legend>';
  421. else
  422. $sLegend = '<legend class="bx-def-padding-left bx-def-padding-sec-right bx-def-font-grayed bx-def-font-h3"><a href="javascript:void(0);">' . bx_process_output($aInput['caption']) . '</a></legend>';
  423. $sCode .= $this->{$this->_sSectionOpen}($aAttrs, $sLegend);
  424. return $sCode;
  425. }
  426. function genBlockEnd()
  427. {
  428. $aNextTbodyAdd = false; // need to have some default
  429. $sCode = '';
  430. $sCode .= $this->{$this->_sSectionClose}();
  431. $sCode .= $this->{$this->_sSectionOpen}($aNextTbodyAdd);
  432. return $sCode;
  433. }
  434. /**
  435. * Generate HTML Input Element
  436. *
  437. * @param array $aInput
  438. * @return string Output HTML Code
  439. */
  440. function genInput(&$aInput)
  441. {
  442. if (!empty($aInput['name'])) {
  443. $sCustomMethod = 'genCustomInput' . $this->_genMethodName($aInput['name']);
  444. if (method_exists($this, $sCustomMethod))
  445. return $this->$sCustomMethod($aInput);
  446. }
  447. switch ($aInput['type']) {
  448. // standard inputs (and non-standard, interpreted as standard)
  449. case 'text':
  450. case 'datepicker':
  451. case 'date_time':
  452. case 'datetime':
  453. case 'number':
  454. case 'checkbox':
  455. case 'radio':
  456. case 'file':
  457. case 'image':
  458. case 'password':
  459. case 'slider':
  460. case 'doublerange':
  461. case 'hidden':
  462. $sInput = $this->genInputStandard($aInput);
  463. break;
  464. case 'switcher':
  465. $sInput = $this->genInputSwitcher($aInput);
  466. break;
  467. case 'button':
  468. case 'reset':
  469. case 'submit':
  470. $sInput = $this->genInputButton($aInput);
  471. break;
  472. case 'textarea':
  473. $sInput = $this->genInputTextarea($aInput);
  474. break;
  475. case 'select':
  476. $sInput = $this->genInputSelect($aInput);
  477. break;
  478. case 'select_multiple':
  479. $sInput = $this->genInputSelectMultiple($aInput);
  480. break;
  481. case 'checkbox_set':
  482. $sInput = $this->genInputCheckboxSet($aInput);
  483. break;
  484. case 'radio_set':
  485. $sInput = $this->genInputRadioSet($aInput);
  486. break;
  487. case 'input_set': // numeric array of inputs
  488. $sInput = '';
  489. $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' ';
  490. foreach ($aInput as $iKey => $aSubInput) {
  491. if (!is_int($iKey) or !$aSubInput)
  492. continue; // parse only integer keys and existing values
  493. $sInput .= $this->genInput($aSubInput); // recursive call
  494. $sInput .= $sDivider;
  495. }
  496. $sInput .= '<div class="bx-clear"></div>';
  497. break;
  498. case 'custom':
  499. $sInput = isset($aInput['content']) ? $aInput['content'] : '';
  500. break;
  501. case 'captcha':
  502. $sInput = $this->genInputCaptcha($aInput);
  503. break;
  504. case 'value':
  505. $sInput = $aInput['value'];
  506. break;
  507. default:
  508. //unknown control type
  509. $sInput = 'Unknown control type';
  510. }
  511. // create input label
  512. $sInput .= $this->genLabel($aInput);
  513. return $sInput;
  514. }
  515. /**
  516. * Generate new Input Element id
  517. *
  518. * @param array $aInput
  519. * @return string
  520. */
  521. function getInputId(&$aInput)
  522. {
  523. if (isset($aInput['id']))
  524. return $aInput['id'];
  525. $sName = md5($aInput['name']);
  526. $sID = $this->id . '_input_' . $sName;
  527. if ( // multiple elements cause identical id's
  528. (
  529. (
  530. $aInput['type'] == 'checkbox' and
  531. substr($aInput['name'], -2) == '[]' // it is multiple element
  532. ) or
  533. $aInput['type'] == 'radio' // it is always multiple (i think so... hm)
  534. ) and
  535. isset($aInput['value']) // if we can make difference
  536. ) {
  537. $sValue = md5($aInput['value']);
  538. // add value
  539. $sID .= '_' . $sValue;
  540. }
  541. $sID = trim($sID, '_');
  542. $aInput['id'] = $sID; // just for repeated calls
  543. return $sID;
  544. }
  545. /**
  546. * Generate standard Input Element
  547. *
  548. * @param array $aInput
  549. * @return string
  550. */
  551. function genInputStandard(&$aInput)
  552. {
  553. // clone attributes for system use ;)
  554. $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
  555. // add default className to attributes
  556. $aAttrs['type'] = $aInput['type'];
  557. if ('datetime' == $aAttrs['type'])
  558. $aAttrs['type'] = 'date_time';
  559. if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name'];
  560. if (isset($aInput['value'])) $aAttrs['value'] = $aInput['value'];
  561. // for inputs with labels generate id
  562. if (isset($aInput['label']))
  563. $aAttrs['id'] = $this->getInputId($aInput);
  564. // for checkboxes
  565. if (isset($aInput['checked']) and $aInput['checked'])
  566. $aAttrs['checked'] = 'checked';
  567. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}");
  568. return "<input $sAttrs />\n";
  569. }
  570. /**
  571. * Generate Switcher Input Element (based on checkbox)
  572. *
  573. * @param array $aInput
  574. * @return string
  575. */
  576. function genInputSwitcher(&$aInput)
  577. {
  578. $aInput['type'] = 'checkbox';
  579. $sCheckbox = $this->genInputStandard($aInput);
  580. $aInput['type'] = 'switcher';
  581. $sClass = 'off';
  582. if (isset($aInput['checked']) and $aInput['checked'])
  583. $sClass = 'on';
  584. return '
  585. <div class="bx-switcher-cont ' . $sClass . '">' . $sCheckbox . '
  586. <div class="bx-switcher-canvas">
  587. <div class="bx-switcher-on"><i class="sys-icon check"></i></div>
  588. <div class="bx-switcher-off"><i class="sys-icon times"></i></div>
  589. <div class="bx-switcher-handler">&nbsp;</div>
  590. </div>
  591. </div>';
  592. }
  593. /**
  594. * Generate Button Input Element
  595. *
  596. * @param array $aInput
  597. * @return string
  598. */
  599. function genInputButton(&$aInput)
  600. {
  601. // clone attributes for system use ;)
  602. $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
  603. // add default className to attributes
  604. $aAttrs['type'] = $aInput['type'];
  605. if (isset($aInput['value']))
  606. $aAttrs['value'] = $aInput['value'];
  607. if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name'];
  608. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']} bx-btn" . ('submit' == $aInput['type'] ? ' bx-btn-primary' : ''));
  609. return "<button $sAttrs>" . $aInput['value'] . "</button>\n";
  610. }
  611. /**
  612. * Generate Textarea Element
  613. *
  614. * @param array $aInput
  615. * @return string
  616. */
  617. function genInputTextarea(&$aInput)
  618. {
  619. // clone attributes for system use ;)
  620. $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
  621. $aAttrs['name'] = $aInput['name'];
  622. // for inputs with labels generate id
  623. if (isset($aInput['label']))
  624. $aAttrs['id'] = $this->getInputId($aInput);
  625. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}" . ((isset($aInput['html']) and $aInput['html'] and $this->addHtmlEditor($aInput['html'], $aInput)) ? ' bx-form-input-html' : ''));
  626. $sValue = isset($aInput['value']) ? bx_process_output($aInput['value']) : '';
  627. return "<textarea $sAttrs>$sValue</textarea>";
  628. }
  629. function addHtmlEditor($iViewMode, &$aInput)
  630. {
  631. $oEditor = BxDolEditor::getObjectInstance(false, $this->oTemplate);
  632. if (!$oEditor)
  633. return false;
  634. $this->_sCodeAdd .= $oEditor->attachEditor ('#' . $this->aFormAttrs['id'] . ' [name='.$aInput['name'].']', $iViewMode, $this->_bDynamicMode);
  635. return true;
  636. }
  637. /**
  638. * Generate Select Box Element
  639. *
  640. * @param array $aInput
  641. * @return string
  642. */
  643. function genInputSelectBox(&$aInput, $sInfo = '', $sError = '')
  644. {
  645. $aNewInput = $aInput;
  646. $aNewInput['type'] = 'select';
  647. $aNewInput['name'] .= '[]';
  648. $sInput = $this->genInput($aNewInput);
  649. return <<<BLAH
  650. <div class="bx-form-input-wrapper input-wrapper-{$aInput['type']}">
  651. $sInput
  652. </div>
  653. $sInfo
  654. $sError
  655. BLAH;
  656. }
  657. /**
  658. * Generate Select Box Element
  659. *
  660. * @param array $aInput
  661. * @return string
  662. */
  663. function genInputFiles(&$aInput, $sInfo = '', $sError = '')
  664. {
  665. $sUniqId = genRndPwd (8, false);
  666. $sUploaders = '';
  667. $oUploader = null;
  668. foreach ($aInput['uploaders'] as $sUploaderObject) {
  669. $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], $sUniqId);
  670. if (!$oUploader)
  671. continue;
  672. $sGhostTemplate = false;
  673. if (isset($aInput['ghost_template']) && is_object($aInput['ghost_template'])) { // form is not submitted and ghost template is BxDolFormNested object
  674. $oFormNested = $aInput['ghost_template'];
  675. if ($oFormNested instanceof BxDolFormNested)
  676. $sGhostTemplate = $oFormNested->getCode();
  677. } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) { // form is not submitted and ghost template is form array
  678. $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate);
  679. $sGhostTemplate = $oFormNested->getCode();
  680. } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && $aInput['ghost_template']) { // form is submitted and ghost template is array of BxDolFormNested objects
  681. $sGhostTemplate = array ();
  682. foreach ($aInput['ghost_template'] as $iFileId => $oFormNested)
  683. if (is_object($oFormNested) && $oFormNested instanceof BxDolFormNested)
  684. $sGhostTemplate[$iFileId] = $oFormNested->getCode();
  685. } elseif (isset($aInput['ghost_template']) && is_string($aInput['ghost_template'])) { // ghost template is just string template, without nested form
  686. $sGhostTemplate = $aInput['ghost_template'];
  687. }
  688. $aParams = array(
  689. 'button_title' => bx_js_string($oUploader->getUploaderButtonTitle(isset($aInput['upload_buttons_titles']) ? $aInput['upload_buttons_titles'] : false)),
  690. 'content_id' => isset($aInput['content_id']) ? $aInput['content_id'] : '',
  691. 'storage_private' => isset($aInput['storage_private']) ? $aInput['storage_private'] : '1',
  692. );
  693. if (isset($aInput['images_transcoder']) && $aInput['images_transcoder'])
  694. $aParams['images_transcoder'] = bx_js_string($aInput['images_transcoder']);
  695. $sUploaders .= $oUploader->getUploaderButton($sGhostTemplate, isset($aInput['multiple']) ? $aInput['multiple'] : true, $aParams);
  696. }
  697. return $this->oTemplate->parseHtmlByName('form_field_uploader.html', array(
  698. 'uploaders_buttons' => $sUploaders,
  699. 'info' => $sInfo,
  700. 'error' => $sError,
  701. 'id_container_errors' => $oUploader ? $oUploader->getIdContainerErrors() : '',
  702. 'id_container_result' => $oUploader ? $oUploader->getIdContainerResult() : '',
  703. 'uploader_instance_name' => $oUploader ? $oUploader->getNameJsInstanceUploader() : '',
  704. 'is_init_ghosts' => isset($aInput['init_ghosts']) && !$aInput['init_ghosts'] ? 0 : 1,
  705. ));
  706. }
  707. /**
  708. * Generate Select Element
  709. *
  710. * @param array $aInput
  711. * @return string
  712. */
  713. function genInputSelect(&$aInput)
  714. {
  715. $sCurValue = isset($aInput['value']) ? $aInput['value'] : '';
  716. return $this->_genInputSelect($aInput, false, $sCurValue, '_isSelected');
  717. }
  718. /**
  719. * Generate Multiple Select Element
  720. *
  721. * @param array $aInput
  722. * @return string
  723. */
  724. function genInputSelectMultiple(&$aInput)
  725. {
  726. $aCurValues = array();
  727. if (isset($aInput['value']) && $aInput['value'])
  728. $aCurValues = is_array($aInput['value']) ? $aInput['value'] : array();
  729. return $this->_genInputSelect($aInput, true, $aCurValues, '_isSelectedMultiple');
  730. }
  731. /**
  732. * Generate Checkbox Set Element
  733. *
  734. * @param array $aInput
  735. * @return string
  736. */
  737. function genInputCheckboxSet(&$aInput)
  738. {
  739. $aCurValues = array();
  740. if (isset($aInput['value']) && $aInput['value'])
  741. $aCurValues = is_array($aInput['value']) ? $aInput['value'] : array();
  742. return $this->_genInputsSet($aInput, 'checkbox', $aCurValues, '_isSelectedMultiple', '[]');
  743. }
  744. /**
  745. * Generate Radiobuttons Set Element
  746. *
  747. * @param array $aInput
  748. * @return string
  749. */
  750. function genInputRadioSet(&$aInput)
  751. {
  752. $sCurValue = isset($aInput['value']) ? $aInput['value'] : '';
  753. return $this->_genInputsSet($aInput, 'radio', $sCurValue, '_isSelected');
  754. }
  755. function _isSelected ($sValue, $sCurValue)
  756. {
  757. return ((string)$sValue === (string)$sCurValue);
  758. }
  759. function _isSelectedMultiple ($sValue, $aCurValues)
  760. {
  761. return in_array($sValue, $aCurValues);
  762. }
  763. function _genInputSelect(&$aInput, $isMultiple, $mixedCurrentVal, $sIsSelectedFunc)
  764. {
  765. $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
  766. $aAttrs['name'] = $aInput['name'];
  767. if ($isMultiple) {
  768. $aAttrs['name'] .= '[]';
  769. $aAttrs['multiple'] = 'multiple';
  770. }
  771. // for inputs with labels generate id
  772. if (isset($aInput['label']))
  773. $aAttrs['id'] = $this->getInputId($aInput);
  774. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}");
  775. // generate options
  776. $sOptions = '';
  777. if (isset($aInput['values']) and is_array($aInput['values'])) {
  778. foreach ($aInput['values'] as $sValue => $sTitle) {
  779. $sClassC = $sStyleC = "";
  780. if(is_array($sTitle)) {
  781. if(isset($sTitle['type'])) {
  782. switch($sTitle['type']) {
  783. case 'group_header':
  784. $sTitle = bx_process_output($sTitle['value']);
  785. $sOptions .= <<<BLAH
  786. <optgroup label="$sTitle">
  787. BLAH;
  788. break;
  789. case 'group_end':
  790. $sOptions .= <<<BLAH
  791. </optgroup>
  792. BLAH;
  793. break;
  794. }
  795. continue;
  796. }
  797. $sClassC = isset($sTitle['class']) ? " class=\"" . $sTitle['class'] . "\"" : "";
  798. $sStyleC = isset($sTitle['style']) ? " style=\"" . $sTitle['style'] . "\"" : "";
  799. $sValue = $sTitle['key'];
  800. $sTitle = $sTitle['value'];
  801. }
  802. $sValueC = bx_html_attribute($sValue);
  803. $sTitleC = bx_process_output($sTitle);
  804. $sSelected = $this->$sIsSelectedFunc($sValue, $mixedCurrentVal) ? 'selected="selected"' : '';
  805. $sOptions .= <<<BLAH
  806. <option value="$sValueC"$sClassC$sStyleC $sSelected>$sTitleC</option>
  807. BLAH;
  808. }
  809. }
  810. // generate element
  811. $sCode = <<<BLAH
  812. <select $sAttrs>
  813. $sOptions
  814. </select>
  815. BLAH;
  816. return $sCode;
  817. }
  818. function _genInputsSet(&$aInput, $sType, $mixedCurrentVal, $sIsCheckedFunc, $sNameAppend = '')
  819. {
  820. $aAttrs = empty($aInput['attrs']) || 'radio_set' == $aInput['type'] || 'checkbox_set' == $aInput['type'] ? array() : $aInput['attrs'];
  821. $aAttrs['name'] = $aInput['name'];
  822. // for inputs with labels generate id
  823. if (isset($aInput['label']))
  824. $aAttrs['id'] = $this->getInputId($aInput);
  825. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}");
  826. // generate options
  827. $sDivider = isset($aInput['dv']) ? $aInput['dv'] : $this->_sDivider;
  828. $sOptions = '';
  829. if (isset($aInput['values']) and is_array($aInput['values'])) {
  830. if (count($aInput['values']) > 3 && $sDivider == $this->_sDivider)
  831. $sDivider = $this->_sDividerAlt;
  832. // generate complex input using simple standard inputs
  833. foreach ($aInput['values'] as $sValue => $sLabel) {
  834. // create new simple input
  835. $aNewInput = array(
  836. 'type' => $sType,
  837. 'name' => $aInput['name'] . $sNameAppend,
  838. 'value' => $sValue,
  839. 'checked' => $this->$sIsCheckedFunc($sValue, $mixedCurrentVal),
  840. 'label' => $sLabel,
  841. 'attrs' => !empty($aInput['attrs']) && ('radio_set' == $aInput['type'] || 'checkbox_set' == $aInput['type']) ? $aInput['attrs'] : false,
  842. );
  843. $sNewInput = $this->genInput($aNewInput);
  844. // attach new input to complex
  845. $sOptions .= ($sNewInput . $sDivider);
  846. }
  847. }
  848. // generate element
  849. $sCode = <<<BLAH
  850. <div $sAttrs>
  851. $sOptions
  852. </div>
  853. BLAH;
  854. return $sCode;
  855. }
  856. function genInputCaptcha(&$aInput)
  857. {
  858. $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
  859. // for inputs with labels generate id
  860. if (isset($aInput['label']))
  861. $aAttrs['id'] = $this->getInputId($aInput);
  862. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-input-{$aInput['type']}");
  863. $oCaptcha = BxDolCaptcha::getObjectInstance();
  864. return "<div $sAttrs>" . ($oCaptcha ? $oCaptcha->display($this->_bDynamicMode) : _t('_sys_txt_captcha_not_available')) . "</div>";
  865. }
  866. /**
  867. * Generate Label Element
  868. *
  869. * @param string $sLabel Text of the Label
  870. * @param string $sInputID Dependant Input Element ID
  871. * @return string HTML code
  872. */
  873. function genLabel(&$aInput)
  874. {
  875. if (!isset($aInput['label']) or empty($aInput['label']))
  876. return '';
  877. $sLabel = $aInput['label'];
  878. $sInputID = $this->getInputId($aInput);
  879. $sRet = '<label for="' . $sInputID . '">' . bx_process_output($sLabel) . '</label>';
  880. return $sRet;
  881. }
  882. function genInfoIcon($sInfo)
  883. {
  884. return '<div class="bx-form-info bx-def-font-grayed bx-def-font-small">' . bx_process_output($sInfo) . '</div>';
  885. }
  886. function genErrorIcon( $sError = '' )
  887. {
  888. if ($this->bEnableErrorIcon) {
  889. $sStyle = '';
  890. if (!$sError)
  891. $sStyle = 'style="display:none;"';
  892. return '<div class="bx-form-warn" ' . $sStyle . '>' . $sError . '</div>';
  893. }
  894. }
  895. function getOpenSection($aAttrs = array(), $sLegend = '')
  896. {
  897. if (!$this->_isSectionOpened) {
  898. if (!$aAttrs || !is_array($aAttrs))
  899. $aAttrs = array();
  900. if ($sLegend)
  901. $sClassesAdd = "bx-form-section-header";
  902. else
  903. $sClassesAdd = "bx-form-section-divider";
  904. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-section bx-def-padding-sec-top bx-def-border-top " . $sClassesAdd);
  905. $this->_isSectionOpened = true;
  906. return "<!-- form header content begins -->\n <div class=\"bx-form-section-wrapper bx-def-margin-top\"> <fieldset $sAttrs> $sLegend <div class=\"bx-form-section-content bx-def-padding-top bx-def-padding-bottom" . ($sLegend ? ' bx-def-padding-left bx-def-padding-right' : '') . "\">\n";
  907. } else {
  908. return '';
  909. }
  910. }
  911. function getCloseSection()
  912. {
  913. if ($this->_isSectionOpened) {
  914. $this->_isSectionOpened = false;
  915. return "</div> </fieldset> </div> \n<!-- form header content ends -->\n";
  916. } else {
  917. return '';
  918. }
  919. }
  920. function getOpenSectionViewMode($aAttrs = array(), $sLegend = '')
  921. {
  922. if (!$this->_isSectionOpened) {
  923. if (!$aAttrs || !is_array($aAttrs))
  924. $aAttrs = array();
  925. if ($sLegend)
  926. $sClassesAdd = "bx-form-section-header";
  927. else
  928. $sClassesAdd = "bx-form-section-divider";
  929. $sAttrs = bx_convert_array2attrs($aAttrs, "bx-form-section bx-form-view-section bx-def-padding-sec-top bx-def-border-top " . $sClassesAdd);
  930. $this->_isSectionOpened = true;
  931. return "<!-- form header content begins -->\n <div class=\"bx-form-section-wrapper bx-def-margin-top\"> <fieldset $sAttrs> $sLegend <div class=\"bx-form-section-content bx-def-padding-top\">\n";
  932. } else {
  933. return '';
  934. }
  935. }
  936. function getCloseSectionViewMode()
  937. {
  938. if ($this->_isSectionOpened) {
  939. $this->_isSectionOpened = false;
  940. return "</div> </fieldset> </div> \n<!-- form header content ends -->\n";
  941. } else {
  942. return '';
  943. }
  944. }
  945. function addCssJs ()
  946. {
  947. if (isset($this->aParams['view_mode']) && $this->aParams['view_mode']) {
  948. if (self::$_isCssJsAddedViewMode)
  949. return;
  950. $this->oTemplate->addCss('forms.css');
  951. self::$_isCssJsAddedViewMode = true;
  952. } else {
  953. if (self::$_isCssJsAdded)
  954. return;
  955. $aCss = array(
  956. 'forms.css',
  957. 'jquery-ui/jquery-ui.css',
  958. 'timepicker-addon/jquery-ui-timepicker-addon.css',
  959. );
  960. $aUiLangs = array ('af' => 1, 'ar-DZ' => 1, 'ar' => 1, 'az' => 1, 'be' => 1, 'bg' => 1, 'bs' => 1, 'ca' => 1, 'cs' => 1, 'cy-GB' => 1, 'da' => 1, 'de' => 1, 'el' => 1, 'en-AU' => 1, 'en-GB' => 1, 'en-NZ' => 1, 'en' => 1, 'eo' => 1, 'es' => 1, 'et' => 1, 'eu' => 1, 'fa' => 1, 'fi' => 1, 'fo' => 1, 'fr-CA' => 1, 'fr-CH' => 1, 'fr' => 1, 'gl' => 1, 'he' => 1, 'hi' => 1, 'hr' => 1, 'hu' => 1, 'hy' => 1, 'id' => 1, 'is' => 1, 'it' => 1, 'ja' => 1, 'ka' => 1, 'kk' => 1, 'km' => 1, 'ko' => 1, 'ky' => 1, 'lb' => 1, 'lt' => 1, 'lv' => 1, 'mk' => 1, 'ml' => 1, 'ms' => 1, 'nb' => 1, 'nl-BE' => 1, 'nl' => 1, 'nn' => 1, 'no' => 1, 'pl' => 1, 'pt-BR' => 1, 'pt' => 1, 'rm' => 1, 'ro' => 1, 'ru' => 1, 'sk' => 1, 'sl' => 1, 'sq' => 1, 'sr-SR' => 1, 'sr' => 1, 'sv' => 1, 'ta' => 1, 'th' => 1, 'tj' => 1, 'tr' => 1, 'uk' => 1, 'vi' => 1, 'zh-CN' => 1, 'zh-HK' => 1, 'zh-TW' => 1);
  961. $aCalendarLangs = array ('af' => 1, 'am' => 1, 'bg' => 1, 'ca' => 1, 'cs' => 1, 'da' => 1, 'de' => 1, 'el' => 1, 'es' => 1, 'et' => 1, 'eu' => 1, 'fa' => 1, 'fi' => 1, 'fr' => 1, 'gl' => 1, 'he' => 1, 'hr' => 1, 'hu' => 1, 'id' => 1, 'it' => 1, 'ja' => 1, 'ko' => 1, 'lt' => 1, 'lv' => 1, 'mk' => 1, 'nl' => 1, 'no' => 1, 'pl' => 1, 'pt-BR' => 1, 'pt' => 1, 'ro' => 1, 'ru' => 1, 'sk' => 1, 'sl' => 1, 'sr-RS' => 1, 'sr-YU' => 1, 'sv' => 1, 'th' => 1, 'tr' => 1, 'uk' => 1, 'vi' => 1, 'zh-CN' => 1, 'zh-TW' => 1);
  962. $sCalendarLang = BxDolLanguages::getInstance()->detectLanguageFromArray ($aCalendarLangs);
  963. $sUiLang = BxDolLanguages::getInstance()->detectLanguageFromArray ($aUiLangs);
  964. $aJs = array(
  965. 'jquery.webForms.js',
  966. 'jquery-ui/jquery.ui.core.min.js',
  967. 'jquery-ui/jquery.ui.widget.min.js',
  968. 'jquery-ui/jquery.ui.mouse.min.js',
  969. 'jquery-ui/jquery.ui.position.min.js',
  970. 'jquery-ui/jquery.ui.slider.min.js',
  971. 'jquery-ui/jquery.ui.datepicker.min.js',
  972. 'jquery-ui/i18n/jquery.ui.datepicker-' . $sUiLang . '.js',
  973. 'timepicker-addon/jquery-ui-timepicker-addon.min.js',
  974. 'timepicker-addon/jquery-ui-sliderAccess.js',
  975. 'timepicker-addon/i18n/jquery-ui-timepicker-' . $sCalendarLang . '.js',
  976. );
  977. foreach ($this->aInputs as $aInput) {
  978. if (!isset($aInput['type']) || 'files' != $aInput['type'] || !isset($aInput['uploaders']))
  979. continue;
  980. foreach ($aInput['uploaders'] as $sUploaderObject) {
  981. $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], '');
  982. if ($oUploader)
  983. $oUploader->addCssJs();
  984. }
  985. }
  986. $this->oTemplate->addJs($aJs);
  987. $this->oTemplate->addCss($aCss);
  988. self::$_isCssJsAdded = true;
  989. }
  990. }
  991. }
  992. /** @} */