Beispiel #1
0
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\SessionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Sessions';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="session-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Hall', 'format' => 'raw', 'value' => function ($row) {
    return \common\models\Hall::findOne(['id' => $row->hall_id])->hall_name;
}], ['label' => 'Movie', 'format' => 'raw', 'value' => function ($row) {
    return \common\models\Movie::findOne(['id' => $row->movie_id])->name;
}], 'start_time', ['class' => 'yii\\grid\\ActionColumn', 'template' => ' {link}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-screenshot"></span>', $url);
}, 'link' => function ($url, $model, $key) {
    return Html::a('Order tikcet', ['order', 'id' => $model->id, 'hallid' => $model->hall_id]);
}]]]]);
?>

</div>
Beispiel #2
0
use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\Hall;
/* @var $this yii\web\View */
/* @var $model common\models\Session */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Sessions', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="session-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['label' => 'Hall', 'value' => common\models\Hall::findOne(['id' => $model->hall_id])->hall_name], ['label' => 'Movie', 'value' => common\models\Movie::findOne(['id' => $model->movie_id])->name], 'start_time']]);
?>

</div>
Beispiel #3
0
 /**
  * Finds the Hall model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Hall the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = Hall::findOne($id);
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }