<?php } else { ?> <h2>Hello, <?php echo Yii::$app->user->identity->username; ?> </h2> <p class="lead">You can manage your bookshelf.</p> <p><a class="btn btn-lg btn-success" href="/books/index">Manage the Bookshelf</a></p> <?php } ?> </div> <div class="col-lg-6"> <h2>Presentation</h2> <p>There are <?php echo app\models\Authors::find()->count(); ?> authors</p> <p>There are <?php echo app\models\Books::find()->count(); ?> books</p> </div> </div> </div> </div>
background: grey; padding: 10px; display: none; } </style> <div class="books-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_search', ['model' => $searchModel]); ?> <?php $label = new \app\models\Books(); ?> <?php echo !empty($count) ? '<h3>' . $label->getAttributeLabel('count_books_author') . ': ' . $count . '</h3>' : ''; ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => $label->getAttributeLabel('name'), 'format' => 'raw', 'value' => function ($data) { return $data->name; }, 'filter' => null], 'views']]); ?> </div>
/* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Книги'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="books-index"> <h1><?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>';
<h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Новая запись', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php $label = new \app\models\Books(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => '', 'columns' => ['id', 'name', ['label' => $label->getAttributeLabel('preview'), 'attribute' => 'preview', 'format' => 'raw', 'value' => function ($data) { $img_src = '/images/nophoto_100_100.jpg'; if (!empty($data->preview) && file_exists('../web/' . $data->preview)) { $img_src = $data->preview; } return ' <a class="single_image" href="#"><img src="' . $img_src . '" style="width:100px;" alt=""/></a>'; }, 'filter' => ''], ['label' => $label->getAttributeLabel('author_id'), 'attribute' => 'author_id', 'format' => 'raw', 'value' => function ($data) { return \app\models\Authors::getAuthorsName($data->author_id); }, 'filter' => ''], ['label' => $label->getAttributeLabel('date'), 'attribute' => 'date', 'format' => 'raw', 'value' => function ($data) { return \app\models\Books::returnDate($data->date); }, 'filter' => ''], ['label' => $label->getAttributeLabel('date_create'), 'format' => 'raw', 'attribute' => 'date_create', 'value' => function ($data) {
<?php use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model app\models\Books */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Книги', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="books-view"> <?php $label = new \app\models\Books(); ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['name', ['label' => $label->getAttributeLabel('authors'), 'format' => 'html', 'value' => \app\models\BooksAuthors::getAuthorsName($model->authors, true)], 'year', ['label' => $label->getAttributeLabel('annotation'), 'format' => 'html', 'value' => $model->annotation]]]); ?> </div> <div class="form-group"> <a href="/books" class="btn btn-primary">Вернуться к списку</a> </div>