Ejemplo n.º 1
0
<div class="review-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'id' => 'review-form']]);
?>

    <hr>
    <?php 
echo $form->field($review, 'title')->textInput(['maxlength' => true]);
?>
    <?php 
echo $form->field($review, 'text')->textarea(['rows' => 5]);
?>

    <?php 
echo $form->field($review, 'rating')->widget(StarRating::classname(), ['pluginOptions' => ['stars' => 5, 'min' => 0, 'max' => 5, 'step' => 1, 'showCaption' => false, 'showClear' => false, 'size' => 'xs']]);
?>

    <?php 
echo $form->field($review, 'image')->widget(FileInput::className(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['language' => 'ru', 'initialPreview' => isset($imagePreview) ? $imagePreview['initialPreview'] : [], 'initialPreviewConfig' => isset($imagePreview) ? $imagePreview['initialPreviewConfig'] : [], 'showUpload' => false, 'showRemove' => false, 'showCaption' => true]]);
?>

    <?php 
echo $form->field($review, 'ids_city')->widget(Select2::className(), ['data' => $cities, 'size' => Select2::MEDIUM, 'language' => 'ru', 'options' => ['multiple' => true], 'pluginOptions' => ['allowClear' => true], 'addon' => ['append' => ['content' => Html::button('Добавить', ['class' => 'btn btn-success toggle-add-city-form']), 'asButton' => true]], 'id' => 'ids-city']);
?>

    <hr>
    <div class="form-group">
        <?php 
echo Html::submitButton($review->isNewRecord ? 'Создать' : 'Редактировать', ['class' => $review->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
Ejemplo n.º 2
0
/* @var $form yii\widgets\ActiveForm */
?>

<div class="row">
    <div class="col-lg-12 col-md-12 col-sm-12 col xs-12">
        <?php 
if ($ratemodel->last_ip != Yii::$app->request->getUserIP()) {
    ?>
            <?php 
    Pjax::begin(['id' => 'post-rating', 'enablePushState' => false]);
    ?>
            <?php 
    $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'name' => 'UpdPostrate', 'data-pjax' => true, 'method' => 'post']]);
    ?>
            <?php 
    echo $form->field($ratemodel, 'temprate')->widget(StarRating::classname(), ['pluginOptions' => ['defaultCaption' => 'test', 'min' => 0, 'max' => 5, 'step' => 1, 'size' => 'xs']]);
    ?>


            <div class="form-group">
                <?php 
    echo Html::submitButton('<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Rate this Post', ['class' => 'btn btn-sm btn-success']);
    ?>
            </div>

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