/**
  * Finds the ClassRooms model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ClassRooms the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ClassRooms::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #2
0
/* @var $searchModel app\module\handbook\models\ClassroomsBusySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Забронювати аудиторію';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="classrooms-busy-index">

    <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 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'Аудиторія', 'attribute' => 'id_classroom', 'value' => function ($data) {
    $classes = ClassRooms::findOne(['classrooms_id' => $data->id_classroom]);
    $housing = Housing::findOne(['housing_id' => $classes['id_housing']]);
    return $classes['classrooms_number'] . ' - ' . $housing['name'];
}], ['attribute' => 'lesson', 'value' => 'lesson0.lesson_time_name'], ['attribute' => 'day', 'value' => 'day', 'filter' => DatePicker::Widget(['model' => $searchModel, 'attribute' => 'day', 'inline' => false, 'language' => 'ua', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'class' => 'ijjijj']])], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Beispiel #3
0
function classHous($val)
{
    $classes = ClassRooms::findOne(['classrooms_id' => $val]);
    $housing = Housing::findOne(['housing_id' => $classes['id_housing']]);
    return $classes['classrooms_number'] . ' - ' . $housing['name'];
}
Beispiel #4
0
function getClassromNumber($id_classroom)
{
    $classroom_array = ClassRooms::findOne(['classrooms_id' => $id_classroom]);
    return 'Аудиторія № ' . $classroom_array['classrooms_number'];
}