/* @var $model app\models\Books */ /* @var $form yii\widgets\ActiveForm */ ?> <style> .select2-container { min-width:100%; } </style> <div class="books-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'book_category_id')->dropDownList(Books::getCategorys()); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'authors')->listBox(Books::getAuthors(), ['class' => 'multi-select2', 'multiple' => true]); ?> <?php echo $form->field($model, 'annotation')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 120, 'plugins' => ['clips', 'fullscreen']]]); ?> <?php
echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php $label = new \app\models\Books(); ?> <p> <?php echo Html::a('Новая запись', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['label' => $label->getAttributeLabel('book_category_id'), 'attribute' => 'book_category_id', 'format' => 'raw', 'value' => function ($data) { return \app\models\Books::getCategorys($data->book_category_id); }, 'filter' => \app\models\Books::getCategorys()], 'name', ['label' => $label->getAttributeLabel('authors'), 'attribute' => 'authors', 'format' => 'raw', 'value' => function ($data) { $author = ''; foreach (\app\models\BooksAuthors::getAuthorsName($data->authors) as $key => $val) { $author .= $val . '<BR>'; } return $author; }, 'filter' => \app\models\BooksAuthors::getAuthorsName()], 'year', 'views', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Кнопки действий', 'template' => '{view} {update} {delete}']]]); ?> </div>