protected function toHtmlInput($helppop, $isDisabled, $err, $value) { $spacer = ' '; $checked = ' checked="checked"'; $input = '<div class="input-group">'; $input .= '<span class="input-group-addon">' . $helppop . '</span>' . "\n"; // need this even empty, for alignment if (is_array($value) && $this->_inputType != 'checkbox') { if ($this->_multiInd == 1) { $glue = ', '; } else { $glue = "\n"; } $value = implode($glue, $value); } $name = $this->_key; $inputAttr = $this->_inputAttr; if ($isDisabled) { $inputAttr .= ' disabled="disabled"'; } $style = 'form-control'; if ($this->_inputType == 'text') { $input .= '<input class="' . $style . '" type="text" name="' . $name . '" ' . $inputAttr . ' value="' . htmlspecialchars($value, ENT_QUOTES) . '">'; } elseif ($this->_inputType == 'password') { $input .= '<input class="' . $style . '" type="password" name="' . $name . '" ' . $inputAttr . ' value="' . $value . '">'; } elseif ($this->_inputType == 'textarea' || $this->_inputType == 'textarea1') { $input .= '<textarea name="' . $name . '" class="' . $style . '" ' . $inputAttr . '>' . htmlspecialchars($value, ENT_QUOTES) . '</textarea>'; } elseif ($this->_inputType == 'radio' && $this->_type == 'bool') { $input .= '<div class="form-control"><div class="lst-radio-group"><label class="radio radio-inline"> <input type="radio" name="' . $name . '" ' . $inputAttr . ' value="1"'; if ($value == '1') { $input .= $checked; } $input .= '> ' . ATTR_VAL_BOOL_YES . '</label><label class="radio radio-inline">' . '<input type="radio" name="' . $name . '" ' . $inputAttr . ' value="0"'; if ($value == '0') { $input .= $checked; } $input .= '> ' . ATTR_VAL_BOOL_NO . '</label>'; if (!$this->IsFlagOn(self::BM_NOTNULL)) { $input .= '<label class="radio radio-inline"> <input type="radio" name="' . $name . '" ' . $inputAttr . ' value=""'; if ($value != '0' && $value != '1') { $input .= $checked; } $input .= '> ' . ATTR_VAL_NOT_SET . '</label>'; } $input .= '</div></div>'; } elseif ($this->_inputType == 'checkboxgroup') { $input .= '<div class="form-control">'; if ($this->_minVal !== NULL && ($value === '' || $value === NULL)) { // has default value, for "Not set", set default val $value = $this->_minVal; } $js0 = $js1 = ''; if (array_key_exists('0', $this->_maxVal)) { $chval = array_keys($this->_maxVal); foreach ($chval as $chv) { if ($chv == '0') { $js1 = "document.confform.{$name}{$chv}.checked=false;"; } else { $js0 .= "document.confform.{$name}{$chv}.checked=false;"; } } $js1 = " onclick=\"{$js1}\""; $js0 = " onclick=\"{$js0}\""; } foreach ($this->_maxVal as $val => $disp) { $id = $name . $val; $input .= "<input type=\"checkbox\" id=\"{$id}\" name=\"{$id}\" value=\"{$val}\""; if ($value & $val || $value === $val || $value === '0' && $val === 0) { $input .= $checked; } $input .= $val == '0' ? $js0 : $js1; $input .= "> <label for=\"{$id}\"> {$disp} </label> {$spacer}"; } $input .= '</div>'; } elseif ($this->_inputType == 'select') { $input .= '<select class="form-control" name="' . $name . '" ' . $inputAttr . '>'; $input .= UIBase::genOptions($this->_maxVal, $value); $input .= '</select>'; } $input .= "</div>\n"; if ($err != '') { $input .= '<span class="help-block"><i class="fa fa-warning"></i> '; $type3 = substr($this->_type, 0, 3); $input .= $type3 == 'fil' || $type3 == 'pat' ? $err : htmlspecialchars($err, ENT_QUOTES); $input .= '</span>'; } $note = $this->getNote(); if ($note) { $input .= '<p class="note">' . htmlspecialchars($note, ENT_QUOTES) . '</p>'; } return $input; }
</a> </li> </ul> <div class="widget-toolbar" role="menu"> <span><?php DMsg::EchoUIStr('service_retrieve'); ?> </span> <select id="vh_topn" name="vh_topn" class="font-sm"> <?php echo UIBase::genOptions($topOptions, 10); ?> </select> <select name="vh_sort" id="vh_sort" class="font-sm"> <?php echo UIBase::genOptions($vhSortOptions, RealTimeStats::FLD_VH_REQ_PER_SEC); ?> </select> </div> <div class="widget-toolbar" role="menu"> <span><?php DMsg::EchoUIStr('service_filterbyvn'); ?> : </span><input class="input-xs" type="text" name="vh_filter" id="vh_filter" placeholder="<?php DMsg::EchoUIStr('service_nameallowexp'); ?> " value=""> </div> </header>
private function input_select($name, $options, $val = '') { $buf = '<select class="form-control" name="' . $name . '" id="' . $name . '">' . UIBase::genOptions($options, $val, true) . '</select>'; return $buf; }