<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
$book= isset($book) ? $book : null;

/* @var $this yii\web\View */
/* @var $model backend\models\Chapter */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Chapters', 'url' => ['index', 'bookid'=> $_GET["bookid"], 'ChapterSearch[bookId]'=> $_GET["bookid"]]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="chapter-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
		<?php if(isset($_GET['bookid'])) { ?>
			<?= Html::a('Update', ['update', 'id' => $model->id,'bookid'=> $_GET["bookid"], 'ChapterSearch[bookId]'=> $_GET["bookid"]], ['class' => 'btn btn-primary']) ?>
		<?php } else { ?>
			<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
		<?php } ?>        

        <?= Html::a('Delete', ['delete', 'id' => $model->id,'bookid'=> $_GET["bookid"], 'ChapterSearch[bookId]'=> $_GET["bookid"]], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>

        <a onclick="js:history.go(-1);returnFalse;" class="btn btn-danger">Back</a>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
           // 'bookId',
            [
                'attribute' => 'bookId',
                'format' => 'html',
                'value' => $book->title
            ],
            'title',
            'bookMarkIndex',
			'attachment'
        ],
    ]) ?>

</div>
