<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\DetailView;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\BookMarkSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Book Marks';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="book-mark-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('Create Book Mark', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
           // 'bookId',
            [
                'attribute' => 'bookId',
                'format' => 'html',
                'value' => function($data) {
                        $book= \backend\models\Book::find()->where('id ='.$data->bookId)->one();
                        return $book->title;
                    },
            ],
            'chapterIndex',
           // 'chapterId',
            [
                'attribute' => 'chapterId',
                'format' => 'html',
                'value' => function($data) {
                        $chapter= \backend\models\Chapter::find()->where('id ='.$data->chapterId)->one();
                        return $chapter->title;
                    },
            ],
            'quotePosition',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
