-
Notifications
You must be signed in to change notification settings - Fork 0
/
LessonsForSubgroups.php
executable file
·49 lines (41 loc) · 1.35 KB
/
LessonsForSubgroups.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require_once("AbstractLesson.php");
require_once("Lesson.php");
class LessonsForSubgroups extends AbstractLesson
{
private $lessons = null;
public function __construct($lessons)
{
$this->lessons = $lessons;
}
public function show()
{
foreach($this->lessons as $lesson)
{
echo
"Название пары: ".$lesson->getSubject()."; ".
"Преподаватель: ".$lesson->getTeacher()."; ".
"Помещение: ".$lesson->getRoom()."; ".
"По чётным: ".(false !== $lesson->getOnEvenWeek())."; ".
"По нечётным: ".(false !== $lesson->getOnOddWeek())." ###";
}
}
public function insertToDb($group, $lessonNumber, $subgroupNumber, $dayNumber, $campusId, $course, $week_id, $instituteId)
{
$subgroupsCounter = 0;
foreach($this->lessons as $lesson)
{
$lesson->insertToDb($group, $lessonNumber, $subgroupsCounter, $dayNumber, $campusId, $course, $week_id, 1, $instituteId);
$subgroupsCounter++;
}
$this->updateGroupAsWithSubgroups($group);
}
private function updateGroupAsWithSubgroups($group)
{
$updateGroupQuery = "UPDATE groups SET has_subgroups=1 WHERE name='".trim($group)."';";
mysql_query($updateGroupQuery);
$GLOBALS['db']->exec($updateGroupQuery);
//sql_query("UPDATE groups SET has_subgroups=1 WHERE name='".trim($group)."';");
}
}
?>