/**
  * Deletes an existing ClassRooms model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     ClassType::deleteAll('classroom_id = ' . $id);
     $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }
Example #2
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\module\handbook\models\ClassType;
use app\module\handbook\models\Specclasses;
/* @var $this yii\web\View */
/* @var $model app\module\handbook\models\ClassRooms */
$this->title = 'Аудиторія №' . $model->classrooms_number;
$this->params['breadcrumbs'][] = ['label' => 'Аудиторії', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$optionsId = ClassType::findAll(['classroom_id' => $model->classrooms_id]);
for ($i = 0; $i < count($optionsId); $i++) {
    $optionName[] = Specclasses::findAll(['spec_class_id' => $optionsId[$i]['spec_class_id']]);
    $optionsArray[] = $optionName[$i][0]['spec_class_name'] . " ";
}
$optionsString = implode($optionsArray);
function translater($val)
{
    if ($val == 0) {
        return "Ні";
    } else {
        return "Так";
    }
}
?>
<div class="classrooms-view">

    <h1><?php 
echo Html::encode($this->title);
?>
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClassTypes()
 {
     return $this->hasMany(ClassType::className(), ['classroom_id' => 'classrooms_id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClassTypes()
 {
     return $this->hasMany(ClassType::className(), ['spec_class_id' => 'spec_class_id']);
 }