BxBaseFormView.php 41 KB

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