|
@@ -824,7 +824,7 @@ BLAH;
|
|
|
$sClassWrapper = 'bx-form-element-wrapper';
|
|
$sClassWrapper = 'bx-form-element-wrapper';
|
|
|
if($isOneLine)
|
|
if($isOneLine)
|
|
|
$sClassWrapper .= ' ' . $sClassWrapper . '-oneline';
|
|
$sClassWrapper .= ' ' . $sClassWrapper . '-oneline';
|
|
|
- $sClassWrapper .= ' bx-def-margin-top';
|
|
|
|
|
|
|
+ $sClassWrapper .= ' bx-def-margin-top-auto';
|
|
|
|
|
|
|
|
if (isset($aInput['name']))
|
|
if (isset($aInput['name']))
|
|
|
$aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name'];
|
|
$aInput['tr_attrs']['id'] = "bx-form-element-" . $aInput['name'];
|
|
@@ -1180,6 +1180,15 @@ BLAH;
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
function genInputStandard(&$aInput)
|
|
function genInputStandard(&$aInput)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = $this->_genInputStandardAttrs($aInput);
|
|
|
|
|
+
|
|
|
|
|
+ return $this->oTemplate->parseHtmlByName('form_field_standard.html', [
|
|
|
|
|
+ 'attrs' => bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}")
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected function _genInputStandardAttrs(&$aInput)
|
|
|
{
|
|
{
|
|
|
// clone attributes for system use ;)
|
|
// clone attributes for system use ;)
|
|
|
$aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
|
|
$aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
|
|
@@ -1221,9 +1230,7 @@ BLAH;
|
|
|
if (isset($aInput['checked']) and $aInput['checked'])
|
|
if (isset($aInput['checked']) and $aInput['checked'])
|
|
|
$aAttrs['checked'] = 'checked';
|
|
$aAttrs['checked'] = 'checked';
|
|
|
|
|
|
|
|
- $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}");
|
|
|
|
|
-
|
|
|
|
|
- return "<input $sAttrs />\n";
|
|
|
|
|
|
|
+ return $aAttrs;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1236,20 +1243,17 @@ BLAH;
|
|
|
{
|
|
{
|
|
|
$aInput['type'] = 'checkbox';
|
|
$aInput['type'] = 'checkbox';
|
|
|
$sCheckbox = $this->genInputStandard($aInput);
|
|
$sCheckbox = $this->genInputStandard($aInput);
|
|
|
|
|
+
|
|
|
$aInput['type'] = 'switcher';
|
|
$aInput['type'] = 'switcher';
|
|
|
|
|
|
|
|
$sClass = 'off';
|
|
$sClass = 'off';
|
|
|
- if (isset($aInput['checked']) and $aInput['checked'])
|
|
|
|
|
|
|
+ if(isset($aInput['checked']) && $aInput['checked'])
|
|
|
$sClass = 'on';
|
|
$sClass = 'on';
|
|
|
|
|
|
|
|
- return '
|
|
|
|
|
- <div class="bx-switcher-cont ' . $sClass . '">' . $sCheckbox . '
|
|
|
|
|
- <div class="bx-switcher-canvas">
|
|
|
|
|
- <div class="bx-switcher-on"><i class="sys-icon check"></i></div>
|
|
|
|
|
- <div class="bx-switcher-off"><i class="sys-icon times"></i></div>
|
|
|
|
|
- <div class="bx-switcher-handler"> </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>';
|
|
|
|
|
|
|
+ return $this->oTemplate->parseHtmlByName('form_field_switcher.html', [
|
|
|
|
|
+ 'class' => $sClass,
|
|
|
|
|
+ 'checkbox' => $sCheckbox
|
|
|
|
|
+ ]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1260,19 +1264,31 @@ BLAH;
|
|
|
*/
|
|
*/
|
|
|
function genInputButton(&$aInput)
|
|
function genInputButton(&$aInput)
|
|
|
{
|
|
{
|
|
|
- // clone attributes for system use ;)
|
|
|
|
|
- $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
|
|
|
|
|
|
|
+ $aAttrs = $this->_genInputButtonAttrs($aInput);
|
|
|
|
|
+
|
|
|
|
|
+ $sClassAdd = "bx-def-font-inputs bx-form-input-{$aInput['type']} bx-btn";
|
|
|
|
|
+ if($aInput['type'] == 'submit')
|
|
|
|
|
+ $sClassAdd .= ' bx-btn-primary';
|
|
|
|
|
+
|
|
|
|
|
+ return $this->oTemplate->parseHtmlByName('form_field_button.html', [
|
|
|
|
|
+ 'attrs' => bx_convert_array2attrs($aAttrs, $sClassAdd),
|
|
|
|
|
+ 'value' => $aInput['value']
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected function _genInputButtonAttrs(&$aInput)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = !empty($aInput['attrs']) ? $aInput['attrs'] : [];
|
|
|
|
|
|
|
|
// add default className to attributes
|
|
// add default className to attributes
|
|
|
$aAttrs['type'] = $aInput['type'];
|
|
$aAttrs['type'] = $aInput['type'];
|
|
|
- if (isset($aInput['value']))
|
|
|
|
|
|
|
+ if(isset($aInput['value']))
|
|
|
$aAttrs['value'] = $aInput['value'];
|
|
$aAttrs['value'] = $aInput['value'];
|
|
|
|
|
|
|
|
- if (isset($aInput['name'])) $aAttrs['name'] = $aInput['name'];
|
|
|
|
|
-
|
|
|
|
|
- $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']} bx-btn" . ('submit' == $aInput['type'] ? ' bx-btn-primary' : ''));
|
|
|
|
|
-
|
|
|
|
|
- return "<button $sAttrs>" . $aInput['value'] . "</button>\n";
|
|
|
|
|
|
|
+ if(isset($aInput['name']))
|
|
|
|
|
+ $aAttrs['name'] = $aInput['name'];
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1283,20 +1299,31 @@ BLAH;
|
|
|
*/
|
|
*/
|
|
|
function genInputTextarea(&$aInput)
|
|
function genInputTextarea(&$aInput)
|
|
|
{
|
|
{
|
|
|
- // clone attributes for system use ;)
|
|
|
|
|
- $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
|
|
|
|
|
|
|
+ $aAttrs = $this->_genInputTextareaAttrs($aInput);
|
|
|
|
|
+
|
|
|
|
|
+ $sClassAdd = "bx-def-font-inputs bx-form-input-{$aInput['type']}";
|
|
|
|
|
+ if(isset($aInput['html']) && $aInput['html'] && $this->addHtmlEditor($aInput['html'], $aInput))
|
|
|
|
|
+ $sClassAdd .= ' bx-form-input-html';
|
|
|
|
|
+
|
|
|
|
|
+ $sValue = isset($aInput['value']) ? bx_process_output((isset($aInput['html']) && $aInput['html']) || (isset($aInput['code']) && $aInput['code']) ? $aInput['value'] : strip_tags($aInput['value']), BX_DATA_TEXT, array('no_process_macros')) : '';
|
|
|
|
|
+
|
|
|
|
|
+ return $this->oTemplate->parseHtmlByName('form_field_textarea.html', [
|
|
|
|
|
+ 'attrs' => bx_convert_array2attrs($aAttrs, $sClassAdd),
|
|
|
|
|
+ 'value' => $sValue
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected function _genInputTextareaAttrs(&$aInput)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = !empty($aInput['attrs']) ? $aInput['attrs'] : array();
|
|
|
|
|
|
|
|
$aAttrs['name'] = $aInput['name'];
|
|
$aAttrs['name'] = $aInput['name'];
|
|
|
|
|
|
|
|
// for inputs with labels generate id
|
|
// for inputs with labels generate id
|
|
|
if (isset($aInput['label']))
|
|
if (isset($aInput['label']))
|
|
|
$aAttrs['id'] = $this->getInputId($aInput);
|
|
$aAttrs['id'] = $this->getInputId($aInput);
|
|
|
-
|
|
|
|
|
- $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' : ''));
|
|
|
|
|
-
|
|
|
|
|
- $sValue = isset($aInput['value']) ? bx_process_output((isset($aInput['html']) && $aInput['html']) || (isset($aInput['code']) && $aInput['code']) ? $aInput['value'] : strip_tags($aInput['value']), BX_DATA_TEXT, array('no_process_macros')) : '';
|
|
|
|
|
-
|
|
|
|
|
- return "<textarea $sAttrs>$sValue</textarea>";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function isHtmlEditor($iViewMode, &$aInput)
|
|
function isHtmlEditor($iViewMode, &$aInput)
|
|
@@ -1436,53 +1463,53 @@ BLAH;
|
|
|
|
|
|
|
|
protected function genCustomInputUsernamesSuggestions ($aInput)
|
|
protected function genCustomInputUsernamesSuggestions ($aInput)
|
|
|
{
|
|
{
|
|
|
- $this->addCssJsUi();
|
|
|
|
|
|
|
+ $bDisabled = isset($aInput['attrs']['disabled']) && $aInput['attrs']['disabled'] == 'disabled';
|
|
|
|
|
+
|
|
|
|
|
+ $aAttrs = $this->_genCustomInputUsernamesSuggestionsAttrs($aInput, $bDisabled);
|
|
|
|
|
|
|
|
- $sVals = '';
|
|
|
|
|
|
|
+ $aTmplVarsVals = [];
|
|
|
if(!empty($aInput['value'])) {
|
|
if(!empty($aInput['value'])) {
|
|
|
if(is_array($aInput['value'])) {
|
|
if(is_array($aInput['value'])) {
|
|
|
foreach($aInput['value'] as $sVal) {
|
|
foreach($aInput['value'] as $sVal) {
|
|
|
if(!$sVal || !($oProfile = BxDolProfile::getInstance($sVal)))
|
|
if(!$sVal || !($oProfile = BxDolProfile::getInstance($sVal)))
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
- $sVals .= '<b class="val bx-def-color-bg-hl bx-def-round-corners">' . $oProfile->getUnit(0, array('template' => 'unit_wo_info')) . $oProfile->getDisplayName() . '<input type="hidden" name="' . $aInput['name'] . '[]" value="' . $sVal . '" /></b>';
|
|
|
|
|
|
|
+ $aTmplVarsVals[] = [
|
|
|
|
|
+ 'item_unit' => $oProfile->getUnit(0, array('template' => 'unit_wo_info')),
|
|
|
|
|
+ 'item_name' => $oProfile->getDisplayName(),
|
|
|
|
|
+ 'name' => $aInput['name'],
|
|
|
|
|
+ 'value' => $sVal
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
- $sVals = trim($sVals, ',');
|
|
|
|
|
}
|
|
}
|
|
|
else if(is_string($aInput['value']))
|
|
else if(is_string($aInput['value']))
|
|
|
- $sVals = $aInput['value'];
|
|
|
|
|
|
|
+ $aTmplVarsVals = $aInput['value'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $bDisabled = isset($aInput['attrs']['disabled']) && $aInput['attrs']['disabled'] == 'disabled';
|
|
|
|
|
|
|
+ $aTmplVarsInputText = [];
|
|
|
|
|
+ if(!$bDisabled) {
|
|
|
|
|
+ $aInputText = $aInput;
|
|
|
|
|
+ $aInputText['type'] = 'text';
|
|
|
|
|
+ $aInputText['value'] = '';
|
|
|
|
|
+ $aInputText['attrs'] = $this->_genCustomInputUsernamesSuggestionsTextAttrs($aInputText, $bDisabled);
|
|
|
|
|
|
|
|
- $sId = $aInput['name'] . time() . mt_rand(0, 100);
|
|
|
|
|
- $sClass = 'bx-form-input-autotoken bx-def-font-inputs bx-form-input-text';
|
|
|
|
|
- if($bDisabled)
|
|
|
|
|
- $sClass .= ' bx-form-input-disabled';
|
|
|
|
|
- if(!empty($aInput['attrs']['class'])) {
|
|
|
|
|
- $sClass .= ' ' . $aInput['attrs']['class'];
|
|
|
|
|
- unset($aInput['attrs']['class']);
|
|
|
|
|
|
|
+ $aTmplVarsInputText['input'] = $this->genInputStandard($aInputText);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $aAttrs = array('value' => '', 'autocomplete' => 'off', 'autocapitalize' => 'off', 'autocorrect' => 'off');
|
|
|
|
|
- if(isset($aInput['attrs']) && is_array($aInput['attrs']))
|
|
|
|
|
- $aAttrs = array_merge($aAttrs, $aInput['attrs']);
|
|
|
|
|
|
|
+ $this->addCssJsUi();
|
|
|
|
|
|
|
|
return $this->oTemplate->parseHtmlByName('form_field_custom_suggestions.html', array(
|
|
return $this->oTemplate->parseHtmlByName('form_field_custom_suggestions.html', array(
|
|
|
- 'id' => $sId,
|
|
|
|
|
'name' => $aInput['name'],
|
|
'name' => $aInput['name'],
|
|
|
- 'class' => $sClass,
|
|
|
|
|
- 'vals' => $sVals,
|
|
|
|
|
|
|
+ 'attrs' => bx_convert_array2attrs($aAttrs),
|
|
|
|
|
+ 'bx_repeat:vals' => $aTmplVarsVals,
|
|
|
'bx_if:input' => array(
|
|
'bx_if:input' => array(
|
|
|
'condition' => !$bDisabled,
|
|
'condition' => !$bDisabled,
|
|
|
- 'content' => array(
|
|
|
|
|
- 'attrs' => bx_convert_array2attrs($aAttrs),
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ 'content' => $aTmplVarsInputText
|
|
|
),
|
|
),
|
|
|
'bx_if:init' => array(
|
|
'bx_if:init' => array(
|
|
|
'condition' => !$bDisabled,
|
|
'condition' => !$bDisabled,
|
|
|
'content' => array(
|
|
'content' => array(
|
|
|
- 'id' => $sId,
|
|
|
|
|
|
|
+ 'id' => $aAttrs['id'],
|
|
|
'name' => $aInput['name'],
|
|
'name' => $aInput['name'],
|
|
|
'url_get_recipients' => $aInput['ajax_get_suggestions'],
|
|
'url_get_recipients' => $aInput['ajax_get_suggestions'],
|
|
|
'b_img' => isset($aInput['custom']['b_img']) ? (int)$aInput['custom']['b_img'] : 1,
|
|
'b_img' => isset($aInput['custom']['b_img']) ? (int)$aInput['custom']['b_img'] : 1,
|
|
@@ -1494,6 +1521,35 @@ BLAH;
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ protected function _genCustomInputUsernamesSuggestionsAttrs (&$aInput, $bDisabled = false)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = [
|
|
|
|
|
+ 'id' => $aInput['name'] . time() . mt_rand(0, 100),
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ $aAttrs['class'] = 'bx-form-input-autotoken bx-form-input-text bx-def-font-inputs';
|
|
|
|
|
+ if($bDisabled)
|
|
|
|
|
+ $aAttrs['class'] .= ' bx-form-input-disabled';
|
|
|
|
|
+ if(!empty($aInput['attrs']['class']))
|
|
|
|
|
+ $aAttrs['class'] .= ' ' . $aInput['attrs']['class'];
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected function _genCustomInputUsernamesSuggestionsTextAttrs (&$aInput, $bDisabled = false)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = ['value' => '', 'autocomplete' => 'off', 'autocapitalize' => 'off', 'autocorrect' => 'off'];
|
|
|
|
|
+
|
|
|
|
|
+ if(!empty($aInput['attrs']) && is_array($aInput['attrs'])) {
|
|
|
|
|
+ if(isset($aInput['attrs']['class']))
|
|
|
|
|
+ unset($aInput['attrs']['class']);
|
|
|
|
|
+
|
|
|
|
|
+ $aAttrs = array_merge($aAttrs, $aInput['attrs']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
protected function genCustomViewRowValueLabels ($aInput)
|
|
protected function genCustomViewRowValueLabels ($aInput)
|
|
|
{
|
|
{
|
|
|
if (empty($aInput['value']) || !($oMetatags = BxDolMetatags::getObjectInstance($aInput['meta_object'])) || !$oMetatags->keywordsIsEnabled())
|
|
if (empty($aInput['value']) || !($oMetatags = BxDolMetatags::getObjectInstance($aInput['meta_object'])) || !$oMetatags->keywordsIsEnabled())
|
|
@@ -1617,81 +1673,125 @@ BLAH;
|
|
|
|
|
|
|
|
function _genInputSelect(&$aInput, $isMultiple, $mixedCurrentVal, $sIsSelectedFunc)
|
|
function _genInputSelect(&$aInput, $isMultiple, $mixedCurrentVal, $sIsSelectedFunc)
|
|
|
{
|
|
{
|
|
|
- $aAttrs = empty($aInput['attrs']) ? array() : $aInput['attrs'];
|
|
|
|
|
-
|
|
|
|
|
- $aAttrs['name'] = $aInput['name'];
|
|
|
|
|
- if ($isMultiple) {
|
|
|
|
|
- $aAttrs['name'] .= '[]';
|
|
|
|
|
- $aAttrs['multiple'] = 'multiple';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // for inputs with labels generate id
|
|
|
|
|
- if (isset($aInput['label']))
|
|
|
|
|
- $aAttrs['id'] = $this->getInputId($aInput);
|
|
|
|
|
-
|
|
|
|
|
- $sAttrs = bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}");
|
|
|
|
|
|
|
+ $aOptions = [];
|
|
|
|
|
+ if(isset($aInput['values']) && is_array($aInput['values'])) {
|
|
|
|
|
+ foreach ($aInput['values'] as $sOptValue => $sOptTitle) {
|
|
|
|
|
+ $aOption = array(
|
|
|
|
|
+ 'bx_if:show_option_group_begin' => [
|
|
|
|
|
+ 'condition' => false,
|
|
|
|
|
+ 'content' => []
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'bx_if:show_option_group_end' => [
|
|
|
|
|
+ 'condition' => false,
|
|
|
|
|
+ 'content' => []
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'bx_if:show_option' => [
|
|
|
|
|
+ 'condition' => false,
|
|
|
|
|
+ 'content' => []
|
|
|
|
|
+ ]
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
- // generate options
|
|
|
|
|
- $sOptions = '';
|
|
|
|
|
- if (isset($aInput['values']) and is_array($aInput['values'])) {
|
|
|
|
|
- foreach ($aInput['values'] as $sValue => $sTitle) {
|
|
|
|
|
- $sAttrsOpt = "";
|
|
|
|
|
- if(is_array($sTitle)) {
|
|
|
|
|
- if(isset($sTitle['type'])) {
|
|
|
|
|
- switch($sTitle['type']) {
|
|
|
|
|
|
|
+ $sOptAttrs = "";
|
|
|
|
|
+ if(is_array($sOptTitle)) {
|
|
|
|
|
+ if(isset($sOptTitle['type'])) {
|
|
|
|
|
+ switch($sOptTitle['type']) {
|
|
|
case 'group_header':
|
|
case 'group_header':
|
|
|
- $sTitle = bx_process_output($sTitle['value']);
|
|
|
|
|
- $sOptions .= <<<BLAH
|
|
|
|
|
- <optgroup label="$sTitle">
|
|
|
|
|
-BLAH;
|
|
|
|
|
|
|
+ $aOption = array_merge($aOption, [
|
|
|
|
|
+ 'bx_if:show_option_group_begin' => [
|
|
|
|
|
+ 'condition' => true,
|
|
|
|
|
+ 'content' => [
|
|
|
|
|
+ 'opt_label' => bx_process_output($sOptTitle['value'])
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $aOptions[] = $aOption;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case 'group_end':
|
|
case 'group_end':
|
|
|
- $sOptions .= <<<BLAH
|
|
|
|
|
- </optgroup>
|
|
|
|
|
-BLAH;
|
|
|
|
|
|
|
+ $aOption = array_merge($aOption, [
|
|
|
|
|
+ 'bx_if:show_option_group_end' => [
|
|
|
|
|
+ 'condition' => true,
|
|
|
|
|
+ 'content' => []
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $aOptions[] = $aOption;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $aAttrsOpt = array();
|
|
|
|
|
- if(!empty($sTitle['attrs']) && is_array($sTitle['attrs']))
|
|
|
|
|
- $aAttrsOpt = $sTitle['attrs'];
|
|
|
|
|
|
|
+ $aOptAttrs = $this->_genInputSelectOptionAttrs($sOptTitle);
|
|
|
|
|
+ if(!empty($aOptAttrs))
|
|
|
|
|
+ $sOptAttrs = bx_convert_array2attrs($aOptAttrs);
|
|
|
|
|
|
|
|
- if(isset($sTitle['class']))
|
|
|
|
|
- $aAttrsOpt['class'] = !empty($aAttrsOpt['class']) ? $aAttrsOpt['class'] . ' ' . $sTitle['class'] : $sTitle['class'];
|
|
|
|
|
-
|
|
|
|
|
- if(isset($sTitle['style']))
|
|
|
|
|
- $aAttrsOpt['style'] = !empty($aAttrsOpt['style']) ? $aAttrsOpt['style'] . ' ' . $sTitle['style'] : $sTitle['style'];
|
|
|
|
|
|
|
+ $sOptValue = $sOptTitle['key'];
|
|
|
|
|
+ $sOptTitle = $sOptTitle['value'];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- $sAttrsOpt = !empty($aAttrsOpt) ? bx_convert_array2attrs($aAttrsOpt) : '';
|
|
|
|
|
|
|
+ $aOption = array_merge($aOption, [
|
|
|
|
|
+ 'bx_if:show_option' => [
|
|
|
|
|
+ 'condition' => true,
|
|
|
|
|
+ 'content' => [
|
|
|
|
|
+ 'opt_title' => bx_process_output($sOptTitle),
|
|
|
|
|
+ 'opt_value' => bx_html_attribute($sOptValue),
|
|
|
|
|
+ 'opt_attrs' => $sOptAttrs,
|
|
|
|
|
+ 'bx_if:show_selected' => [
|
|
|
|
|
+ 'condition' => $this->$sIsSelectedFunc($sOptValue, $mixedCurrentVal),
|
|
|
|
|
+ 'content' => []
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ $aOptions[] = $aOption;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- $sValue = $sTitle['key'];
|
|
|
|
|
- $sTitle = $sTitle['value'];
|
|
|
|
|
- }
|
|
|
|
|
- $sValueC = bx_html_attribute($sValue);
|
|
|
|
|
- $sTitleC = bx_process_output($sTitle);
|
|
|
|
|
|
|
+ $aAttrs = $this->_genInputSelectAttrs($aInput, $isMultiple);
|
|
|
|
|
|
|
|
- $sSelected = $this->$sIsSelectedFunc($sValue, $mixedCurrentVal) ? 'selected="selected"' : '';
|
|
|
|
|
|
|
+ return $this->_parseInputSelect('form_field_select.html', [
|
|
|
|
|
+ 'attrs' => bx_convert_array2attrs($aAttrs, "bx-def-font-inputs bx-form-input-{$aInput['type']}"),
|
|
|
|
|
+ 'bx_repeat:options' => $aOptions,
|
|
|
|
|
+ 'content' => !empty($aInput['content']) ? $aInput['content'] : ''
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- $sOptions .= <<<BLAH
|
|
|
|
|
- <option value="$sValueC" $sAttrsOpt $sSelected>$sTitleC</option>
|
|
|
|
|
-BLAH;
|
|
|
|
|
|
|
+ protected function _genInputSelectAttrs(&$aInput, $isMultiple)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = !empty($aInput['attrs']) ? $aInput['attrs'] : [];
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $aAttrs['name'] = $aInput['name'];
|
|
|
|
|
+ if ($isMultiple) {
|
|
|
|
|
+ $aAttrs['name'] .= '[]';
|
|
|
|
|
+ $aAttrs['multiple'] = 'multiple';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // generate element
|
|
|
|
|
- $sCode = <<<BLAH
|
|
|
|
|
- <select $sAttrs>
|
|
|
|
|
- $sOptions
|
|
|
|
|
- </select>
|
|
|
|
|
-BLAH;
|
|
|
|
|
|
|
+ // for inputs with labels generate id
|
|
|
|
|
+ if (isset($aInput['label']))
|
|
|
|
|
+ $aAttrs['id'] = $this->getInputId($aInput);
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if(!empty($aInput['content']))
|
|
|
|
|
- $sCode .= $aInput['content'];
|
|
|
|
|
|
|
+ protected function _genInputSelectOptionAttrs(&$aOption)
|
|
|
|
|
+ {
|
|
|
|
|
+ $aAttrs = [];
|
|
|
|
|
+ if(!empty($aOption['attrs']) && is_array($aOption['attrs']))
|
|
|
|
|
+ $aAttrs = $aOption['attrs'];
|
|
|
|
|
|
|
|
- return $sCode;
|
|
|
|
|
|
|
+ if(isset($aOption['class']))
|
|
|
|
|
+ $aAttrs['class'] = !empty($aAttrs['class']) ? $aAttrs['class'] . ' ' . $aOption['class'] : $aOption['class'];
|
|
|
|
|
+
|
|
|
|
|
+ if(isset($aOption['style']))
|
|
|
|
|
+ $aAttrs['style'] = !empty($aAttrs['style']) ? $aAttrs['style'] . ' ' . $aOption['style'] : $aOption['style'];
|
|
|
|
|
+
|
|
|
|
|
+ return $aAttrs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ protected function _parseInputSelect($sTmplName, $aTmplVars)
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->oTemplate->parseHtmlByName($sTmplName, $aTmplVars);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function _genInputsSet(&$aInput, $sType, $mixedCurrentVal, $sIsCheckedFunc, $sNameAppend = '')
|
|
function _genInputsSet(&$aInput, $sType, $mixedCurrentVal, $sIsCheckedFunc, $sNameAppend = '')
|