8 require_once( CH_DIRECTORY_PATH_CLASSES .
'ChWsbForm.php' );
48 parent::__construct(
$aInfo);
60 function toggle_password(dbeye, dbid) {
61 $(dbeye).toggleClass('eye eye-slash');
62 if ($('#'+dbid).attr('type') == 'password') {
63 $('#'+dbid).attr('type', 'text');
65 $('#'+dbid).attr('type', 'password');
70 return ($this->sCode = $this->
genForm() . $sExtraScript);
81 if(!
empty($this->aParams[
'remove_form']))
85 $this->aFormAttrs[
'class'] =
'form_advanced' . (isset($this->aFormAttrs[
'class']) ? (
' ' . $this->aFormAttrs[
'class']) :
'');
88 return '<form ' . $sFormAttrs .
'>' . $sTable .
'</form>';
99 $this->aTableAttrs[
'class'] =
'form_advanced_table' . (isset($this->aTableAttrs[
'class']) ? (
' ' . $this->aTableAttrs[
'class']) :
'');
102 if(
$GLOBALS[
'MySQL']->
getParam(
'sys_security_form_token_enable') ==
'on' && !defined(
'CH_WSB_CRON_EXECUTE') && (!isset($this->aParams[
'csrf'][
'disable']) || (isset($this->aParams[
'csrf'][
'disable']) && $this->aParams[
'csrf'][
'disable'] !==
true)) && ($mixedCsrfToken =
ChWsbForm::getCsrfToken()) !==
false)
103 $this->aInputs[
'csrf_token'] = array(
105 'name' =>
'csrf_token',
106 'value' => $mixedCsrfToken,
114 foreach ($this->aInputs
as $aInput)
115 $sTableContent .= $this->
genRow($aInput);
117 $this->
addCssJs($this->_isDateControl, $this->_isDateTimeControl);
118 return $this->_sCodeAdd .
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_content.html', array(
119 'wrapper_id' => $this->
id,
133 switch ($aInput[
'type']) {
149 $this->_sCodeAdd .= $this->
genInput($aInput);
172 $sRequired = !
empty($aInput[
'required']) ?
'<span class="ch-form-required">*</span>' :
'';
175 $sInfoIcon = !
empty($aInput[
'info']) ? $this->
genInfoIcon($aInput[
'info']) :
'';
176 $sErrorIcon = $this->
genErrorIcon(
empty($aInput[
'error']) ?
'' : $aInput[
'error']);
178 $bMultiplyable = isset($aInput[
'attrs']) && isset($aInput[
'value']) && is_array($aInput[
'value']) && $aInput[
'attrs'][
'multiplyable'];
180 $sValFirst = array_shift($aInput[
'value']);
181 $aInputCopy = $aInput;
182 $aInputCopy[
'value'] = $sValFirst;
183 $sInputCopy = $this->
genInput($aInputCopy);
185 $sInputCodeExtra =
'';
186 foreach ($aInput[
'value'] AS $v) {
187 unset($aInputCopy[
'attrs'][
'multiplyable']);
188 $aInputCopy[
'attrs'][
'deletable'] =
'true';
189 $aInputCopy[
'value'] = $v;
190 $sInputCopy = $this->
genInput($aInputCopy);
191 $sInputCodeExtra .=
'<div class="clear_both"></div>' . $this->
genWrapperInput($aInputCopy, $sInputCopy);
199 if(!
empty($aInput[
'tr_attrs'][
'class'])) {
200 $sElementClass =
' ' . $aInput[
'tr_attrs'][
'class'];
201 unset($aInput[
'tr_attrs'][
'class']);
205 $sElementClass .=
' ch-form-element-multiplyable';
207 if(!
empty($aInput[
'error']))
208 $sElementClass .=
' ch-form-element-error';
212 $sCode .=
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_row_standard_' . (!
empty($aInput[
'colspan']) ?
'colspan' :
'simple') .
'.html', array(
213 'element_type' =>
'ch-form-element-' . $aInput[
'type'],
214 'element_class' => $sElementClass,
216 'class_add' => $sClassAdd,
217 'required' => $sRequired,
219 'input_code' => !
empty($sInputCode) ? $sInputCode :
'',
220 'info_icon' => !
empty($sInfoIcon) ? $sInfoIcon :
'',
221 'error_icon' => !
empty($sErrorIcon) ? $sErrorIcon :
'',
222 'input_code_extra' => !
empty($sInputCodeExtra) ? $sInputCodeExtra :
'',
223 'ch_if:show_toggle_html' => array(
224 'condition' => isset($aInput[
'html']) && (isset($aInput[
'html_toggle']) && $aInput[
'html_toggle']),
226 'attrs_id' => (!isset($aInput[
'attrs'][
'id'])) ?: $aInput[
'attrs'][
'id'],
242 $sCaption = (!
empty($aInput[
'caption'])) ? $aInput[
'caption'] :
' ';
243 $sRequired = (!
empty($aInput[
'required'])) ?
'<span class="ch-form-required">*</span>' :
'';
246 $sInfoIcon = (!
empty($aInput[
'info'])) ? $this->
genInfoIcon($aInput[
'info']) :
'';
247 $sErrorIcon = $this->
genErrorIcon(
empty($aInput[
'error']) ?
'' : $aInput[
'error']);
252 if(!
empty($aInput[
'tr_attrs'][
'class'])) {
253 $sElementClass =
' ' . $aInput[
'tr_attrs'][
'class'];
254 unset($aInput[
'tr_attrs'][
'class']);
257 if(!
empty($aInput[
'error']))
258 $sElementClass .=
' ch-form-element-error';
261 $sCode .=
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_row_select_' . (!
empty($aInput[
'colspan']) ?
'colspan' :
'simple') .
'.html', array(
262 'element_type' =>
'ch-form-element-' . $aInput[
'type'],
263 'element_class' => $sElementClass,
265 'class_add' => $sClassAdd,
266 'required' => $sRequired,
268 'input_code' => $sInput,
269 'info_icon' => !
empty($sInfoIcon) ? $sInfoIcon :
'',
270 'error_icon' => !
empty($sErrorIcon) ? $sErrorIcon :
'',
284 $sCode .=
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_row_headers.html', array(
285 'class' => isset($aInput[
'tr_class']) ?
' ' . $aInput[
'tr_class'] :
'',
286 'header_first' => $aInput[0],
287 'header_second' => $aInput[1]
303 $aNextFieldsetAdd =
false;
304 $bCollapsable = $bCollapsed =
false;
305 if(isset($aInput[
'collapsable']) && $aInput[
'collapsable']) {
306 $bCollapsable =
true;
307 $sElementClass =
' collapsable';
309 if(isset($aInput[
'collapsed']) && $aInput[
'collapsed']) {
311 $sElementClass .=
' collapsed';
312 $aNextFieldsetAdd = array(
313 'style' =>
'display:none;',
318 $aAttrs = !
empty($aInput[
'attrs']) ? $aInput[
'attrs'] :
'';
321 if(isset($aAttrs[
'class'])) {
322 $sClass =
' ' . $aAttrs[
'class'];
323 unset($aAttrs[
'class']);
327 $sCode .=
$GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_row_block_header.html', array(
328 'element_class' => $sElementClass,
331 'caption' => $aInput[
'caption'],
332 'ch_if:show_collapse' => array(
333 'condition' => $bCollapsable,
335 'icon_name' => $bCollapsed ?
'chevron-down' :
'chevron-up'
351 return $GLOBALS[
'oSysTemplate']->parseHtmlByName(
'form_input_wrapper.html', array(
352 'type' => $aInput[
'type'],
353 'class' => isset($aInput[
'wrap_text']) && $aInput[
'wrap_text'] ?
'input_wrapper_wraptext' :
'',
354 'attrs' => isset($aInput[
'attrs_wrapper']) && is_array($aInput[
'attrs_wrapper']) ? $this->
convertArray2Attrs($aInput[
'attrs_wrapper']) :
'',
368 $sDivider = isset($aInput[
'dv']) ? $aInput[
'dv'] :
' ';
370 switch ($aInput[
'type']) {
374 $this->_isDateTimeControl =
true;
376 $this->_isDateControl =
true;
393 if(strpos($aInput[
'name'],
'confirm')) {
394 $dbid =
'form_input_' . $aInput[
'type'] .
'_confirm';
396 $dbid =
'form_input_' . $aInput[
'type'];
398 $sInput .=
'<i class="sys-icon eye toogle-password" onclick="toggle_password(this, \'' . $dbid .
'\');
"></i>';
402 if (!isset($aInput['attrs']['size']))
403 $aInput['attrs']['size'] = 12;
404 $sInput = $this->genInputStandard($aInput);
410 $sInput = $this->genInputButton($aInput);
414 $sInput = $this->genInputTextarea($aInput);
418 $sInput = $this->genInputSelect($aInput);
421 case 'select_multiple':
422 $sInput = $this->genInputSelectMultiple($aInput);
426 $sInput = $this->genInputCheckboxSet($aInput);
430 $sInput = $this->genInputRadioSet($aInput);
433 case 'input_set': // numeric array of inputs
436 foreach ($aInput as $iKey => $aSubInput) {
437 if (!is_int($iKey) or !$aSubInput)
438 continue; // parse only integer keys and existing values
440 $sInput .= $this->genInput($aSubInput); // recursive call
441 $sInput .= $sDivider;
446 $sInput = isset($aInput['content']) ? $aInput['content'] : '';
450 //TODO: do we need canvas?
454 $sInput = $this->genInputCaptcha($aInput);
458 $sInput = $aInput['value'];
462 //unknown control type
463 $sInput = 'Unknown control type';
466 // create input label
467 $sInput .= $this->genLabel($aInput);
478 function getInputId(&$aInput)
480 if (isset($aInput['id']))
481 return $aInput['id'];
483 $sName = preg_replace("/[^
a-z0-9]/i
", '_', $aInput['name']);
485 $sID = $this->id . '_input_' . $sName;
487 if ( // multiple elements cause identical id's
490 $aInput['type'] == 'checkbox' and
491 substr($aInput['name'], -2) == '[]' // it is multiple element
493 $aInput['type'] == 'radio' // it is always multiple (i think so... hm)
495 isset($aInput['value']) // if we can make difference
497 $sValue = md5($aInput['value']);
500 $sID .= '_' . $sValue;
503 $sID = trim($sID, '_');
505 $aInput['id'] = $sID; // just for repeated calls
516 function genInputStandard(&$aInput)
518 $sInputName = 'input';
520 // clone attributes for system use ;)
521 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
523 // add default className to attributes
524 $aAttrs['class'] = "form_input_{$aInput[
'type']} ch-def-font-inputs
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
526 if(isset($aInput['type'])) {
527 switch($aInput['type']) {
529 $aAttrs['type'] = 'date_time';
532 $aAttrs['type'] = 'date_calendar';
535 $sInputName = 'file';
536 $aAttrs['type'] = $aInput['type'];
539 if(strpos($aInput['name'], 'confirm')) {
540 $aAttrs['id'] = 'form_input_' . $aInput['type'] . '_confirm';
542 $aAttrs['id'] = 'form_input_' . $aInput['type'];
544 $aAttrs['type'] = $aInput['type'];
547 $aAttrs['type'] = $aInput['type'];
550 if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name'];
551 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);
558 if (isset($aInput['checked']) and $aInput['checked'])
559 $aAttrs['checked'] = 'checked';
561 $sInputAttrs = $this->convertArray2Attrs($aAttrs);
562 return $this->getInput($sInputName, $sInputAttrs);
571 function genInputButton(&$aInput)
573 $aInput['colspan'] = 2;
575 // clone attributes for system use ;)
576 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
578 // add default className to attributes
579 $aAttrs['class'] = "form_input_{$aInput[
'type']} ch-btn
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
580 $aAttrs['type'] = $aInput['type'];
581 $aAttrs['name'] = $aInput['name'];
582 $aAttrs['value'] = $aInput['value'];
584 // for inputs with labels generate id
585 if (isset($aInput['label']))
586 $aAttrs['id'] = $this->getInputId($aInput);
589 if(isset($aInput['checked']) && $aInput['checked'])
590 $aAttrs['checked'] = 'checked';
592 $sAttrs = $this->convertArray2Attrs($aAttrs);
594 return $this->getInput('button', $sAttrs);
603 function genInputTextarea(&$aInput)
605 // for inputs with labels generate id
606 if (!isset($aInput['attrs']['id']) && (isset($aInput['label']) || isset($aInput['html'])))
607 $aInput['attrs']['id'] = $this->getInputId($aInput);
609 // clone attributes for system use ;)
610 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
612 // add default className to attributes
614 "form_input_{$aInput[
'type']} ch-def-font-inputs
" .
615 (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '') .
616 ((isset($aInput['html']) and $aInput['html'] and $this->addHtmlEditor($aInput['html'], $aInput)) ? ' form_input_html' : '');
618 $aAttrs['name'] = $aInput['name'];
620 $sAttrs = $this->convertArray2Attrs($aAttrs);
622 $sValue = (isset($aInput['value'])) ? htmlspecialchars_adv($aInput['value']) : '';
624 return $this->getInput('textarea', $sAttrs, $sValue);
627 function addHtmlEditor($iViewMode, &$aInput)
629 ch_import('ChWsbEditor');
630 $oEditor = ChWsbEditor::getObjectInstance();
634 if (isset($aInput['html_no_link_conversion']) && $aInput['html_no_link_conversion'])
635 $oEditor->setCustomConf ("remove_script_host:
false,\nrelative_urls:
false,\n
");
637 $this->_sCodeAdd .= $oEditor->attachEditor ((!empty($this->aFormAttrs['id']) ? '#' . $this->aFormAttrs['id'] . ' ': '') . '[name="'.$aInput['name'].'"]', $iViewMode, isset($aInput['dynamic']) ? $aInput['dynamic'] : false);
638 if (!isset($aInput['attrs_wrapper']['style']))
639 $aInput['attrs_wrapper']['style'] = '';
640 $aInput['attrs_wrapper']['style'] = 'width:' . $oEditor->getWidth($iViewMode) . $aInput['attrs_wrapper']['style'];
651 function genInputSelect(&$aInput)
653 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
655 // add default className to attributes
656 $aAttrs['class'] = "form_input_{$aInput[
'type']} ch-def-font-inputs
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
658 $aAttrs['name'] = $aInput['name'];
660 // for inputs with labels generate id
661 if (isset($aInput['label']))
662 $aAttrs['id'] = $this->getInputId($aInput);
664 $sAttrs = $this->convertArray2Attrs($aAttrs);
667 $sCurValue = isset($aInput['value']) ? $aInput['value'] : null;
670 if (isset($aInput['values']) and is_array($aInput['values'])) {
671 foreach ($aInput['values'] as $sValue => $sTitle) {
672 if(is_array($sTitle)) {
673 $sValue = $sTitle['key'];
674 $sTitle = $sTitle['value'];
676 $sValueC = htmlspecialchars_adv($sValue);
677 $sTitleC = htmlspecialchars_adv($sTitle);
679 $aAttrsOption = array('value' => $sValueC);
680 if((string)$sValue === (string)$sCurValue)
681 $aAttrsOption['selected'] = 'selected';
683 $sOptions .= $this->getInput('option', $this->convertArray2Attrs($aAttrsOption), $sTitleC);
688 return $this->getInput('select', $sAttrs, $sOptions);
697 function genInputSelectBox(&$aInput, $sInfo = '', $sError = '')
701 if (isset($aInput['value']) and is_array($aInput['value'])) {
703 foreach ($aInput['value'] as $sValue) {
704 $aNewInput = $aInput;
706 $aNewInput['name'] .= '[]';
707 $aNewInput['value'] = $sValue;
709 if (isset($aInput['values'][$sValue])) { // draw select if value exists in values
711 $aNewInput['type'] = 'select';
713 if ($iCounter == 0) { // for the first input create multiplyable select and add info and error icons (if set)
714 $aNewInput['attrs']['multiplyable'] = 'true';
715 $aNewInput['attrs']['add_other'] = isset($aNewInput['attrs']['add_other']) ? $aNewInput['attrs']['add_text'] : 'true';
716 $sInputAdd = $sInfo . ' ' . $sError;
717 } else { // for the others inputs create only deletable
718 $aNewInput['attrs']['deletable'] = 'true';
723 } else { // draw text input for non-existent value (man, it is select_box, wow!)
724 $aNewInput['type'] = 'text';
725 $aNewInput['attrs']['deletable'] = 'true';
728 $sInput = $this->genInput($aNewInput);
730 $sCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('form_input_wrapper.html', array(
731 'type' => $aInput['type'],
734 'content' => $sInput,
735 'content_add' => $sInputAdd
741 $aNewInput = $aInput;
743 $aNewInput['type'] = 'select';
744 $aNewInput['name'] .= '[]';
745 $aNewInput['attrs']['multiplyable'] = 'true';
746 $aNewInput['attrs']['add_other'] =
747 isset($aNewInput['attrs']['add_other'])
748 ? (empty($aNewInput['attrs']['add_text']) ? '' : $aNewInput['attrs']['add_text'])
751 $sInput = $this->genInput($aNewInput);
753 $sCode .= $GLOBALS['oSysTemplate']->parseHtmlByName('form_input_wrapper.html', array(
754 'type' => $aInput['type'],
757 'content' => $sInput,
758 'content_add' => $sInfo . $sError
771 function genInputSelectMultiple(&$aInput)
773 $aAttrs = $aInput['attrs'];
775 // add default className to attributes
776 $aAttrs['class'] = "form_input_{$aInput[
'type']} ch-def-font-inputs
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
778 $aAttrs['name'] = $aInput['name'] . '[]';
779 $aAttrs['multiple'] = 'multiple';
781 // for inputs with labels generate id
782 if (isset($aInput['label']))
783 $aAttrs['id'] = $this->getInputId($aInput);
785 $sAttrs = $this->convertArray2Attrs($aAttrs);
788 $aCurValues = $aInput['value'] ? (is_array($aInput['value']) ? $aInput['value'] : array($aInput['value'])) : array();
791 if (isset($aInput['values']) and is_array($aInput['values'])) {
792 foreach ($aInput['values'] as $sValue => $sTitle) {
793 $sValueC = htmlspecialchars_adv($sValue);
794 $sTitleC = htmlspecialchars_adv($sTitle);
796 $aAttrsOption = array('value' => $sValueC);
797 if(in_array($sValue, $aCurValues))
798 $aAttrsOption['selected'] = 'selected';
800 $sOptions .= $this->getInput('option', $this->convertArray2Attrs($aAttrsOption), $sTitleC);
806 return $this->getInput('select', $sAttrs, $sOptions);
815 function genInputCheckboxSet(&$aInput)
817 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
819 // add default className to attributes
820 $aAttrs['class'] = "form_input_{$aInput[
'type']}
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
822 $aAttrs['name'] = $aInput['name'];
824 // for inputs with labels generate id
825 if (isset($aInput['label']))
826 $aAttrs['id'] = $this->getInputId($aInput);
828 $sAttrs = $this->convertArray2Attrs($aAttrs);
831 $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' ';
832 $aCurValues = $aInput['value'] ? (is_array($aInput['value']) ? $aInput['value'] : array($aInput['value'])) : array();
836 if (isset($aInput['values']) and is_array($aInput['values'])) {
837 if (count($aInput['values']) > 3 && $sDivider == ' ')
838 $sDivider = '<br />';
839 // generate complex input using simple standard inputs
840 foreach ($aInput['values'] as $sValue => $sLabel) {
841 // create new simple input
843 'type' => 'checkbox',
844 'name' => $aInput['name'] . '[]',
846 'checked' => in_array($sValue, $aCurValues),
850 $sNewInput = $this->genInput($aNewInput);
852 // attach new input to complex
853 $sOptions .= ($sNewInput . $sDivider);
858 return $this->getInput('checkbox_set', $sAttrs, $sOptions);
866 function genInputRadioSet(&$aInput)
868 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
870 // add default className to attributes
871 $aAttrs['class'] = "form_input_{$aInput[
'type']}
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
873 $aAttrs['name'] = $aInput['name'];
875 // for inputs with labels generate id
876 if (isset($aInput['label']))
877 $aAttrs['id'] = $this->getInputId($aInput);
879 $sAttrs = $this->convertArray2Attrs($aAttrs);
882 $sDivider = isset($aInput['dv']) ? $aInput['dv'] : ' ';
883 $sCurValue = isset($aInput['value']) ? $aInput['value'] : '';
887 if (isset($aInput['values']) and is_array($aInput['values'])) {
888 if (count($aInput['values']) > 3 && $sDivider == ' ')
889 $sDivider = '<br />';
890 // generate complex input using simple standard inputs
891 foreach ($aInput['values'] as $sValue => $sLabel) {
892 // create new simple input
895 'name' => $aInput['name'],
897 'checked' => ((string)$sValue === (string)$sCurValue),
901 $sNewInput = $this->genInput($aNewInput);
903 // attach new input to complex
904 $sOptions .= ($sNewInput . $sDivider);
909 return $this->getInput('radio_set', $sAttrs, $sOptions);
912 function genInputCaptcha(&$aInput)
914 $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
916 // add default className to attributes
917 $aAttrs['class'] = "form_input_{$aInput[
'type']}
" . (isset($aAttrs['class']) ? (' ' . $aAttrs['class']) : '');
919 // for inputs with labels generate id
920 if (isset($aInput['label']))
921 $aAttrs['id'] = $this->getInputId($aInput);
923 $sAttrs = $this->convertArray2Attrs($aAttrs);
925 ch_import('ChWsbCaptcha');
926 $oCaptcha = ChWsbCaptcha::getObjectInstance();
927 $sCaptcha = $oCaptcha ? $oCaptcha->display(isset($aInput['dynamic']) ? $aInput['dynamic'] : false) : _t('_sys_txt_captcha_not_available');
928 $sCaptcha .= $this->getInput('input', $this->convertArray2Attrs(array('type' => 'hidden', 'name' => $aInput['name'])));
930 return $this->getInput('captcha', $sAttrs, $sCaptcha);
940 function genLabel(&$aInput)
942 if (!isset($aInput['label']) or empty($aInput['label']))
945 $sLabel = $aInput['label'];
946 $sInputID = $this->getInputId($aInput);
948 return $this->getInput('label', $this->convertArray2Attrs(array('for' => $sInputID)), $sLabel);
966 function convertArray2Attrs($a)
971 foreach ($a as $sKey => $sValue) {
973 if (!isset($sValue) || is_null($sValue)) // pass NULL values
976 $sValueC = htmlspecialchars_adv($sValue);
978 $sRet .= " $sKey=\
"$sValueC\"";
987 return $this->getInput(
'icon_info', $this->convertArray2Attrs(array(
988 'class' =>
'sys-icon info-circle',
995 if (!$this->bEnableErrorIcon)
1005 return $this->getInput(
'icon_error', $this->convertArray2Attrs(array(
1006 'class' =>
'sys-icon exclamation-circle',
1007 'float_info' => $sErrorH
1013 if($this->_isTbodyOpened)
1016 $this->_isTbodyOpened =
true;
1018 $aAttrsAdd[
'class'] =
'ch-form-fields-wrapper' . (!
empty($aAttrsAdd[
'class']) ?
' ' . $aAttrsAdd[
'class'] :
'');
1020 return '<fieldset ' . $this->convertArray2Attrs($aAttrsAdd) .
'>';
1025 if(!$this->_isTbodyOpened)
1028 $this->_isTbodyOpened =
false;
1030 return '</fieldset>';
1038 $sResult =
'<input ' . $sAttrs .
' />';
1041 $sResult =
'<label class="ch-btn form_input_multiply_select"><input ' . $sAttrs .
' /><span>' .
_t(
'_Select file') .
'</span></label>';
1044 $sResult =
'<input ' . $sAttrs .
' />';
1057 case 'checkbox_set':
1064 $sResult =
'<span class="ch-form-info"><i ' . $sAttrs .
'></i></span>';
1067 $sResult =
'<span class="ch-form-error"><i ' . $sAttrs .
'></i></span>';
1073 function addCssJs($isDateControl =
false, $isDateTimeControl =
false)
1075 $aTranslations = array(
1081 'jquery.ui.core.min.js',
1082 'jquery.ui.widget.min.js',
1083 'jquery.ui.mouse.min.js',
1084 'jquery.ui.slider.min.js',
1089 'plugins/jquery/themes/|jquery-ui.css',
1093 $sLanguageCountry = str_replace(
'_',
'-', $aLang[
'LanguageCountry']);
1095 if ($isDateControl || $isDateTimeControl) {
1097 $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);
1100 if (isset($aUiLangs[$sLanguageCountry]))
1101 $sLang = $sLanguageCountry;
1102 elseif (isset($aUiLangs[$aLang[
'Name']]))
1103 $sLang = $aLang[
'Name'];
1107 $aJs [] =
'jquery.ui.datepicker.min.js';
1108 $aJs [] =
'plugins/jquery/i18n/|jquery.ui.datepicker-' . $sLang .
'.js';
1111 if ($isDateTimeControl) {
1113 $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);
1115 $aJs[] =
'jquery-ui-timepicker-addon.min.js';
1116 $aJs[] =
'jquery-ui-sliderAccess.js';
1119 if (isset($aCalendarLangs[$sLanguageCountry]))
1120 $aJs[] =
'plugins/jquery/i18n/|jquery-ui-timepicker-' . $sLanguageCountry .
'.js';
1121 elseif (isset($aCalendarLangs[$aLang[
'Name']]))
1122 $aJs[] =
'plugins/jquery/i18n/|jquery-ui-timepicker-' . $aLang[
'Name'] .
'.js';
1124 $aCss[] =
'plugins/jquery/themes/|jquery-ui-timepicker-addon.css';
1127 if (isset(
$GLOBALS[
'oSysTemplate'])) {
1128 $GLOBALS[
'oSysTemplate']->addCss($aCss);
1129 $GLOBALS[
'oSysTemplate']->addJs($aJs);
1130 $GLOBALS[
'oSysTemplate']->addJsTranslation($aTranslations);
1132 if (isset(
$GLOBALS[
'oAdmTemplate'])) {
1133 $GLOBALS[
'oAdmTemplate']->addJs($aJs);
1134 $GLOBALS[
'oAdmTemplate']->addCss($aCss);