_gallery_form.php 2.92 KB
<?php
    /**
     * @var Gallery $gallery
     * @var User $user
     */
    use common\components\Request;
    use common\models\Gallery;
    use common\models\User;
    use common\widgets\ImageUploader;
    use yii\helpers\Html;
    use yii\widgets\ActiveForm;

    $this->title = 'Галерея Фото';
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="login-left-column-title"><?= $this->title ?></div>

<?php
    $form = ActiveForm::begin();
?>
<div class="input-blocks-wrapper full-blocks data-block">Дата создания: <?= $gallery->date_add ?></div>
<div class="login-left-column-title-two admin-gallery-photo-edit style">Редактирование:</div>

<div class="input-blocks-wrapper">
    <div class="input-blocks">
        <?= $form->field($gallery, 'name')
            ->textInput (['class'=> 'custom-input-2']) ?>
    </div>
</div>

<div class="input-blocks-wrapper admin-avatar amin-team-foto">
    <?= ImageUploader::widget([
        'model'   => $gallery,
        'field'   => 'cover',
        'size' => [
            [
                'width'   => 210,
                'height'  => 150,
            ]
        ],

        'multi'   => false,
        'gallery' => $gallery->cover,
        'name'    => 'Загрузить главное фото',
    ]); ?>
</div>
<div class="admin-gallery-photos-load-wr style">
    <?= ImageUploader::widget([
        'model'   => $gallery,
        'field'   => 'photo',
        'size' => [
            [
                'width'   => 152,
                'height'  => 108,
            ]
        ],
        'multi'   => true,
        'gallery' => $gallery->photo,
        'name'    => 'Загрузить фото галереи',
    ]); ?>
</div>



<div class="input-blocks-wrapper">
    <div class="admin-save-btn skills-save-btn admin-add-remove-wr style">
        <?= Html::submitButton($gallery->isNewRecord?'Добавить':'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
        <div class="admin-remove-note">
            <?php
            if(!$gallery->isNewRecord) {
                echo Html::a('Удалить', [
                    'accounts/gallery-delete',
                    'id' => $gallery->gallery_id,
                ], [
                    'title'        => 'Удалить',
                    'aria-label'   => 'Удалить',
                    'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
                    'data-method'  => 'post',
                    'data-pjax'    => 0,
                ]);
            }
            ?>
        </div>

        <div class="admin-back-note">
            <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer)?\Yii::$app->request->referrer:['accounts/gallery' ]) ?>
        </div>
    </div>
</div>


<?php
    $form->end();
?>