Exemplo n.º 1
0
 public function draw()
 {
     $inputName = $this->colName();
     $inputLabel = $this->colLabel();
     $inputOptions = ['value' => $this->value(), 'disabled' => $this->readOnly(), 'values' => \Ui\ActiveForm::getOptionsList($this->colParams, $this->activeFormParams, $this->activeForm->modelName, $inputName)];
     if (!empty($inputOptions['values'][$this->activeForm->model->{$this->colName}]) && is_array($inputOptions['values'][$this->activeForm->model->{$this->colName}]) && !empty($inputOptions['values'][$this->activeForm->model->{$this->colName}]['input'])) {
         $aditionalCol = $inputOptions['values'][$this->activeForm->model->{$this->colName}]['input']['name'];
         $inputOptions['aditionalValue'] = $this->activeForm->model->{$aditionalCol};
     }
     $preset = $this->preset();
     if ($preset !== null) {
         $inputOptions['disabled'] = true;
         $this->form->input('hidden', $inputName, '', $inputOptions);
         return true;
     }
     $this->form->input('select', $inputName, $inputLabel, $inputOptions);
     return true;
 }
Exemplo n.º 2
0
echo $showedInput !== false ? 'data-aditionalEnabled="1"' : '';
?>
 <?php 
echo !empty($options['disabled']) ? 'disabled="disabled"' : '';
?>
 onchange="inji.Ui.forms.checkAditionals(this);" class="form-control <?php 
echo !empty($options['class']) ? $options['class'] : '';
?>
" name = '<?php 
echo $name;
?>
'>
  <?php 
echo $optionsHtml;
?>
</select>
<?php 
foreach ($aditionalInputs as $key => $input) {
    $input['options']['noContainer'] = true;
    if ($key !== $showedInput) {
        $input['options']['disabled'] = true;
        $input['options']['class'] = !empty($input['options']['class']) ? $input['options']['class'] . ' hidden' : 'hidden';
    } else {
        $input['options']['value'] = empty($input['options']['value']) ? $aditionValue : $input['options']['value'];
    }
    if ($input['type'] == 'select') {
        $input['options']['values'] = \Ui\ActiveForm::getOptionsList($input);
    }
    $form->input($input['type'], empty($input['name']) ? $name . '[aditional]' : $input['name'], false, $input['options']);
}
echo empty($options['noContainer']) ? '</div>' : '';