コード例 #1
0
 /**
  * Finds the Speciality model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Speciality the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Speciality::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
ファイル: editor.php プロジェクト: petlyakss/test_timetable
use app\module\handbook\models\Teachers;
use app\module\handbook\models\Discipline;
use app\module\handbook\models\LessonsType;
use app\module\handbook\models\Housing;
use app\module\handbook\models\ClassRooms;
use yii\bootstrap\Modal;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\module\timetable\models\Lessons */
$semester_for_editor = $_GET['semester_for_editor'];
$course_get = $_GET['course_get'];
$faculty = $_GET['faculty_id'];
$speciality = $_GET['speciality_id'];
$group_id = $_GET['group_id'];
$inflow_year = date('Y') - $course_get;
$spec_name = Speciality::findOne(["speciality_id" => $speciality]);
$faculty_name = Faculty::findOne(["faculty_id" => $faculty]);
$week = ["", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"];
$groups_list = Groups::findAll(["id_speciality" => $speciality, "inflow_year" => $inflow_year, "group_id" => $group_id]);
$less_time = LessonTime::find()->all();
$gl = Groups::findAll(["parent_group" => $group_id]);
if (count($gl) > 0) {
    //Определяем есть ли у группы подгруппы
    $group_has_subgroup = true;
    $groups_list = $gl;
    $parent = $gl[0]['parent_group'];
} else {
    $group_has_subgroup = false;
    $parent = 0;
}
$this->title = 'Редагувати розклад:';