Exemplo n.º 1
0
 protected function set_input_type($type, $name, $value)
 {
     if (isset($type) && isset($name) && isset($value)) {
         $input = NULL;
         $input_name = $name . '[value]';
         switch ($type) {
             case 'string':
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'integer':
                 $input = Html::input('number', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'text':
                 $input = Html::textarea($input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'boolean':
                 $input = Switchery::widget(['name' => $input_name, 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery', 'disabled' => FALSE, 'disabledOpacity' => 0.5, 'speed' => '0.1s', 'size' => 'default'], 'options' => array_merge(['value' => '1'], $this->has_checked($value))]);
                 break;
             default:
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
         }
         return $input;
     }
     return FALSE;
 }
Exemplo n.º 2
0
    </div>

    <div class="col-md-12">
    <?= $form->field($model, 'image[]')->widget(BootstrapFileInput::className(), [
            'options' => ['accept' => 'image/*', 'multiple' => true],
            'clientOptions' => [
                'previewFileType' => 'text',
                'browseClass' => 'btn btn-success',
                'uploadClass' => 'btn btn-info',
                'removeClass' => 'btn btn-danger',
                'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> '
            ]
        ]);?>


    <?=$form->field($model, 'status')->widget(Switchery::classname(), [
        'clientOptions' => [
            'color'              => '#64bd63',
            'secondaryColor'     => '#dfdfdf',
            'jackColor'          => '#fff',
            'jackSecondaryColor' => null,
            'className'          => 'switchery js-switch',
            'disabled'           => false,
            'disabledOpacity'    => 0.5,
            'speed'              => '0.3s',
            'size'               => 'default',

        ],

    ])->label(false);?>
Exemplo n.º 3
0

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
//= $form->field($model, 'slug')->textInput(['maxlength' => true])
?>

    <?php 
echo $form->field($model, 'prev_img')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->widget(Switchery::classname(), ['name' => 'status', 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery js-switch', 'disabled' => false, 'disabledOpacity' => 0.5, 'speed' => '0.3s', 'size' => 'default']])->label(false);
?>



    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemplo n.º 4
0
echo $form->field($model, 'value')->textarea(['rows' => 6]);
?>
                </div>

            </div>
            <!-- /.box -->
        </div>
    </div>


   <!-- --><?php 
/*= $form->field($model, 'active')->textInput() */
?>

    <?php 
echo $form->field($model, 'active')->widget(Switchery::classname(), ['name' => 'active', 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery js-switch', 'disabled' => false, 'disabledOpacity' => 0.5, 'speed' => '0.3s', 'size' => 'default'], 'clientChangeEvent' => new JsExpression('function() {
        alert("checked: " + this.checked);
    }')])->label(false);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>