Beispiel #1
0
        <div style="width: 30%; float: left">
            <?php 
echo $form->field($searchModel, 'dateFrom')->widget(DatePicker::classname(), ['language' => 'ru'])->label(false)->textInput(['placeholder' => 'Дата выхода c']);
?>
        </div>
        <div style="width: 30%; float: left">
            <?php 
echo $form->field($searchModel, 'dateTo')->widget(DatePicker::classname(), ['language' => 'ru'])->label(false)->textInput(['placeholder' => 'Дата выхода по']);
?>
        </div>
        <div style="clear: both"></div>
    </div>
</div>
<?php 
echo Button::widget(['label' => 'search', 'options' => ['class' => 'btn-lg btn-primary']]);
ActiveForm::end();
?>


<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', 'name', ['attribute' => 'preview', 'format' => 'html', 'value' => function ($data) {
    return Html::img(Yii::getAlias('@web') . '/images/' . $data['preview'], ['width' => '30px', 'class' => 'scalable']);
}], 'fullName', 'date:date', 'date_create:date', 'actions' => ['format' => 'raw', 'value' => function ($data) {
    return ButtonGroup::widget(['encodeLabels' => false, 'options' => ['data-id' => $data['id']], 'buttons' => [['options' => ['class' => 'a-edit btn-primary'], 'label' => '<span class="glyphicon glyphicon-pencil"></span>'], ['options' => ['class' => 'a-view btn-primary', 'data-toggle' => 'modal', 'data-target' => '#modal-window'], 'label' => '<span class="glyphicon glyphicon-eye-open"></span>'], ['options' => ['class' => 'a-remove btn-primary'], 'label' => '<span class="glyphicon glyphicon-remove"></span>']]]);
}]]]);
yii\bootstrap\Modal::begin(['header' => '<h2>DetailView</h2>', 'options' => ['id' => 'modal-window']]);
?>
<div id="modal-content"></div>
<?php 
yii\bootstrap\Modal::end();
Beispiel #2
0
$this->title = 'Books';
echo newerton\fancybox\FancyBox::widget(['target' => 'a[rel=fancybox]', 'config' => ['maxWidth' => '90%', 'maxHeight' => '90%', 'playSpeed' => 7000, 'width' => '70%', 'height' => '70%', 'autoSize' => false, 'closeClick' => true, 'openEffect' => 'elastic', 'closeEffect' => 'elastic', 'closeBtn' => true]]);
?>

<div class="books-index">

    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-striped table-bordered table-vcenter'], 'summary' => false, 'columns' => ['id', 'name', ['attribute' => 'preview', 'label' => 'Превью', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(Html::img($data->preview, ['alt' => $data->name, 'style' => 'width:100px;']), $data->preview, ['rel' => 'fancybox']);
}], ['attribute' => 'author_id', 'label' => 'Автор', 'format' => 'text', 'content' => function ($data) {
    return $data->getAuthorFullName();
}], ['attribute' => 'date', 'value' => function ($data) {
    return Yii::$app->formatter->asDate($data->date);
}], ['attribute' => 'date_create', 'value' => function ($data) {
    return Yii::$app->formatter->asRelativeTime($data->date_create);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '[{update}] [{view}] [{delete}]', 'header' => 'Кнопки действий', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('редактирование', $url);
}, 'view' => function ($url, $model) {
    return yii\bootstrap\Modal::widget(['id' => 'view-modal' . $model->id, 'header' => $model->name, 'closeButton' => [], 'size' => yii\bootstrap\Modal::SIZE_LARGE, 'toggleButton' => ['label' => 'просмотр', 'tag' => 'a', 'href' => $url . '?ajax=1', 'data-target' => '#view-modal' . $model->id], 'clientOptions' => false]);
}, 'delete' => function ($url, $model) {
    return Html::a('удаление', $url);
}]]]]);
?>

</div>