indenting
This commit is contained in:
parent
79a07df71d
commit
de7af4bd57
2 changed files with 411 additions and 416 deletions
|
@ -21,128 +21,127 @@ defined('MOODLE_INTERNAL') || die();
|
||||||
*/
|
*/
|
||||||
class lesson {
|
class lesson {
|
||||||
|
|
||||||
/** @var array the data of lesson */
|
/** @var array the data of lesson */
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param object $lesson Lesson
|
* @param object $lesson Lesson
|
||||||
*/
|
*/
|
||||||
public function __construct($lesson) {
|
public function __construct($lesson) {
|
||||||
$this->lessonid= $lesson->lessonid;
|
$this->lessonid= $lesson->lessonid;
|
||||||
$this->teacher = $lesson->teacher;
|
$this->teacher = $lesson->teacher;
|
||||||
$this->subject = $lesson->subject;
|
$this->subject = $lesson->subject;
|
||||||
$this->class = $lesson->class;
|
$this->class = $lesson->class;
|
||||||
$this->room = $lesson->room;
|
$this->room = $lesson->room;
|
||||||
$this->period = $lesson->period;
|
$this->period = $lesson->period;
|
||||||
$this->day = $lesson->day;
|
$this->day = $lesson->day;
|
||||||
$this->text = "";
|
$this->text = "";
|
||||||
$this->substitution = "";
|
$this->substitution = "";
|
||||||
$this->teachera = "";
|
$this->teachera = "";
|
||||||
$this->subjecta = "";
|
$this->subjecta = "";
|
||||||
$this->classa = "";
|
$this->classa = "";
|
||||||
$this->rooma = "";
|
$this->rooma = "";
|
||||||
//$this->teacherb = "";
|
//$this->teacherb = "";
|
||||||
//$this->subjectb = "";
|
//$this->subjectb = "";
|
||||||
//$this->classb = "";
|
//$this->classb = "";
|
||||||
//$this->roomb = "";
|
//$this->roomb = "";
|
||||||
$this->teacherchanged = false;
|
$this->teacherchanged = false;
|
||||||
$this->subjectchanged = false;
|
$this->subjectchanged = false;
|
||||||
$this->classchanged = false;
|
$this->classchanged = false;
|
||||||
$this->roomchanged = false;
|
$this->roomchanged = false;
|
||||||
$this->reason = "";
|
$this->reason = "";
|
||||||
$this->type = 0;
|
$this->type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param object $substitution Substitution
|
||||||
|
*/
|
||||||
|
public function process_substitution($substitution) {
|
||||||
|
if (//$this->lessonid == $substitution->lesson &&
|
||||||
|
$this->teacher == $substitution->teacherb &&
|
||||||
|
$this->subject == $substitution->subjectb &&
|
||||||
|
preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/", $substitution->classb) &&
|
||||||
|
preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/", $substitution->roomb) ) {
|
||||||
|
// Append change info
|
||||||
|
$this->teachera = $substitution->teachera;
|
||||||
|
$this->subjecta = $substitution->subjecta;
|
||||||
|
$this->classa = $substitution->classa;
|
||||||
|
$this->rooma = $substitution->rooma;
|
||||||
|
$this->teacherchanged = ($this->teacher != $this->teachera) ? true : false;
|
||||||
|
$this->subjectchanged = ($this->subject != $this->subjecta) ? true : false;
|
||||||
|
$this->classchanged = (!preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/" , $this->classa )) ? true : false;
|
||||||
|
$this->roomchanged = (!preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/" , $this->rooma )) ? true : false;
|
||||||
|
if ($substitution->text) $this->text .= $substitution->text;
|
||||||
|
$this->type = $substitution->type;
|
||||||
|
$this->substitution = "1";
|
||||||
|
return 1;
|
||||||
|
} elseif (//$this->lessonid == $substitution->lesson &&
|
||||||
|
$this->teacher == $substitution->teachera &&
|
||||||
|
$this->subject == $substitution->subjecta &&
|
||||||
|
preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/", $substitution->classa) &&
|
||||||
|
preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/", $substitution->rooma) ) {
|
||||||
|
// Append change info
|
||||||
|
$this->teacherb = $substitution->teacherb;
|
||||||
|
$this->subjectb = $substitution->subjectb;
|
||||||
|
$this->classb = $substitution->classb;
|
||||||
|
$this->roomb = $substitution->roomb;
|
||||||
|
$this->teacherchanged = ($this->teacher != $this->teacherb) ? true : false;
|
||||||
|
$this->subjectchanged = ($this->subject != $this->subjectb) ? true : false;
|
||||||
|
$this->classchanged = (!preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/" , $this->classb )) ? true : false;
|
||||||
|
$this->roomchanged = (!preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/" , $this->roomb )) ? true : false;
|
||||||
|
if ($substitution->text) $this->text .= $substitution->text;
|
||||||
|
// TODO Entfall, falls teacherb!=teacher bzw. class not in classb bzw. roomb!=room TODO
|
||||||
|
$this->type = $substitution->type;
|
||||||
|
$this->substitution = "1";
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param object $substitution Substitution
|
* @param object $absence Absence
|
||||||
*/
|
*/
|
||||||
public function process_substitution($substitution) {
|
public function process_absence($absence) {
|
||||||
if (//$this->lessonid == $substitution->lesson &&
|
// echo "Process_absence: $absence->endperiod";
|
||||||
$this->teacher == $substitution->teacherb &&
|
if ((($absence->type == 'L' && $absence->name == $this->teacher) ||
|
||||||
$this->subject == $substitution->subjectb &&
|
($absence->type == 'K' && $absence->name == $this->class) ||
|
||||||
preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/", $substitution->classb) &&
|
($absence->type == 'R' && $absence->name == $this->room)) &&
|
||||||
preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/", $substitution->roomb) ) {
|
$absence->startperiod <= $this->period &&
|
||||||
|
$absence->endperiod >= $this->period) {
|
||||||
// Append change info
|
$this->text .= $absence->text;
|
||||||
$this->teachera = $substitution->teachera;
|
$this->reason = $absence->reason;
|
||||||
$this->subjecta = $substitution->subjecta;
|
$this->startperiod = $absence->startperiod;
|
||||||
$this->classa = $substitution->classa;
|
$this->endperiod = $absence->endperiod;
|
||||||
$this->rooma = $substitution->rooma;
|
return 1;
|
||||||
$this->teacherchanged = ($this->teacher != $this->teachera) ? true : false;
|
} else {
|
||||||
$this->subjectchanged = ($this->subject != $this->subjecta) ? true : false;
|
return 0;
|
||||||
$this->classchanged = (!preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/" , $this->classa )) ? true : false;
|
|
||||||
$this->roomchanged = (!preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/" , $this->rooma )) ? true : false;
|
|
||||||
if ($substitution->text) $this->text .= $substitution->text;
|
|
||||||
$this->type = $substitution->type;
|
|
||||||
$this->substitution = "1";
|
|
||||||
return 1;
|
|
||||||
} elseif (//$this->lessonid == $substitution->lesson &&
|
|
||||||
$this->teacher == $substitution->teachera &&
|
|
||||||
$this->subject == $substitution->subjecta &&
|
|
||||||
preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/", $substitution->classa) &&
|
|
||||||
preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/", $substitution->rooma) ) {
|
|
||||||
// Append change info
|
|
||||||
$this->teacherb = $substitution->teacherb;
|
|
||||||
$this->subjectb = $substitution->subjectb;
|
|
||||||
$this->classb = $substitution->classb;
|
|
||||||
$this->roomb = $substitution->roomb;
|
|
||||||
$this->teacherchanged = ($this->teacher != $this->teacherb) ? true : false;
|
|
||||||
$this->subjectchanged = ($this->subject != $this->subjectb) ? true : false;
|
|
||||||
$this->classchanged = (!preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/" , $this->classb )) ? true : false;
|
|
||||||
$this->roomchanged = (!preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/" , $this->roomb )) ? true : false;
|
|
||||||
if ($substitution->text) $this->text .= $substitution->text;
|
|
||||||
// TODO Entfall, falls teacherb!=teacher bzw. class not in classb bzw. roomb!=room TODO
|
|
||||||
$this->type = $substitution->type;
|
|
||||||
$this->substitution = "1";
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public function integrate($lesson) {
|
||||||
*
|
if($this->lessonid == $lesson->lessonid &&
|
||||||
* @param object $absence Absence
|
//$this->teacher == $lesson->teacher &&
|
||||||
*/
|
$this->subject == $lesson->subject &&
|
||||||
public function process_absence($absence) {
|
$this->room == $lesson->room &&
|
||||||
// echo "Process_absence: $absence->endperiod";
|
$this->text == $lesson->text) {
|
||||||
if ((($absence->type == 'L' && $absence->name == $this->teacher) ||
|
if ($this->class != $lesson->class) {
|
||||||
($absence->type == 'K' && $absence->name == $this->class) ||
|
$class1parts = explode("/", $this->class);
|
||||||
($absence->type == 'R' && $absence->name == $this->room)) &&
|
$class2parts = explode("/", $lesson->class);
|
||||||
$absence->startperiod <= $this->period &&
|
if (count($class1parts)>1 && count($class2parts)==2) {
|
||||||
$absence->endperiod >= $this->period) {
|
$this->class .= "/".$class2parts[1];
|
||||||
$this->text .= $absence->text;
|
} else
|
||||||
$this->reason = $absence->reason;
|
$this->class .= $lesson->class;
|
||||||
$this->startperiod = $absence->startperiod;
|
}
|
||||||
$this->endperiod = $absence->endperiod;
|
if ($this->teacher != $lesson->teacher) {
|
||||||
return 1;
|
$this->teacher .= "/".$lesson->teacher;
|
||||||
} else {
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
} else
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
public function integrate($lesson) {
|
|
||||||
if($this->lessonid == $lesson->lessonid &&
|
|
||||||
//$this->teacher == $lesson->teacher &&
|
|
||||||
$this->subject == $lesson->subject &&
|
|
||||||
$this->room == $lesson->room &&
|
|
||||||
$this->text == $lesson->text) {
|
|
||||||
if ($this->class != $lesson->class) {
|
|
||||||
$class1parts = explode("/", $this->class);
|
|
||||||
$class2parts = explode("/", $lesson->class);
|
|
||||||
if (count($class1parts)>1 && count($class2parts)==2) {
|
|
||||||
$this->class .= "/".$class2parts[1];
|
|
||||||
} else
|
|
||||||
$this->class .= $lesson->class;
|
|
||||||
}
|
|
||||||
if ($this->teacher != $lesson->teacher) {
|
|
||||||
$this->teacher .= "/".$lesson->teacher;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,26 +24,26 @@ const FLAG_Teilverlegung = 0b0000000001000000;
|
||||||
const FLAG_Hinverlegung = 0b0000000010000000;
|
const FLAG_Hinverlegung = 0b0000000010000000;
|
||||||
|
|
||||||
function lesson_in_lessons($obj, $array) {
|
function lesson_in_lessons($obj, $array) {
|
||||||
for($n=0;$n<count($array);$n++) {
|
for($n=0;$n<count($array);$n++) {
|
||||||
if ($obj->lessonid== $array[$n]->lessonid &&
|
if ($obj->lessonid== $array[$n]->lessonid &&
|
||||||
$obj->teacher == $array[$n]->teacher &&
|
$obj->teacher == $array[$n]->teacher &&
|
||||||
$obj->subject == $array[$n]->subject &&
|
$obj->subject == $array[$n]->subject &&
|
||||||
$obj->class == $array[$n]->class &&
|
$obj->class == $array[$n]->class &&
|
||||||
$obj->room == $array[$n]->room) return true;
|
$obj->room == $array[$n]->room) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function collapse_lessons($array) {
|
function collapse_lessons($array) {
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($array as $lesson) {
|
foreach ($array as $lesson) {
|
||||||
$integrated = false;
|
$integrated = false;
|
||||||
foreach ($result as $rlesson) {
|
foreach ($result as $rlesson) {
|
||||||
if ($rlesson->integrate($lesson)) $integrated = true;
|
if ($rlesson->integrate($lesson)) $integrated = true;
|
||||||
}
|
}
|
||||||
if (!$integrated) $result[] = $lesson;
|
if (!$integrated) $result[] = $lesson;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,298 +55,294 @@ function collapse_lessons($array) {
|
||||||
*/
|
*/
|
||||||
class timetable {
|
class timetable {
|
||||||
|
|
||||||
/** @var array the data of timetable */
|
/** @var array the data of timetable */
|
||||||
public $data;
|
public $data;
|
||||||
//public $lessons;
|
//public $lessons;
|
||||||
//public $lessons_canceled;
|
//public $lessons_canceled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param string $type The type of the timetable [class, room, teacher]
|
* @param string $type The type of the timetable [class, room, teacher]
|
||||||
* @param string $name Name of class or room or teacher
|
* @param string $name Name of class or room or teacher
|
||||||
*/
|
*/
|
||||||
public function __construct($type, $name) {
|
public function __construct($type, $name) {
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->periodmax=0;
|
$this->periodmax=0;
|
||||||
$this->clear_data();
|
$this->clear_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clear_data() {
|
||||||
|
$this->data = array();
|
||||||
|
$this->lessons = array();
|
||||||
|
$this->lessons_canceled = array();
|
||||||
|
$this->lessons_event = array();
|
||||||
|
for ($i=1; $i<=6; $i++) {
|
||||||
|
$this->data[$i] = array();
|
||||||
|
$this->lessons[$i] = array();
|
||||||
|
$this->lessons_canceled[$i] = array();
|
||||||
|
$this->lessons_event[$i] = array();
|
||||||
|
for ($j=1; $j<=13; $j++) {
|
||||||
|
$this->lessons[$i][$j] = array();
|
||||||
|
$this->lessons_canceled[$i][$j] = array();
|
||||||
|
$this->lessons_event[$i][$j] = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param int $week The week of timetable
|
||||||
|
*/
|
||||||
|
public function read_db($week) {
|
||||||
|
global $USER, $DB, $CFG;
|
||||||
|
|
||||||
|
$this->clear_data();
|
||||||
|
$this->numdayweek = 5 + get_config('timetable', 'saturday');
|
||||||
|
$this->week = $week;
|
||||||
|
$this->monday = new \DateTime();
|
||||||
|
$this->monday->setISODate($this->monday->format("Y"), $week);
|
||||||
|
$dayofweek = $this->monday->format('w');
|
||||||
|
if ($dayofweek > $this->numdayweek) {
|
||||||
|
$this->monday->add(new \DateInterval("P".(8-$dayofweek)."D"));
|
||||||
|
} elseif ($dayofweek < 1) {
|
||||||
|
$this->monday->add(new \DateInterval("P1D"));
|
||||||
|
} else {
|
||||||
|
$this->monday->sub(new \DateInterval("P".($dayofweek-1)."D"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clear_data() {
|
$this->week = $this->monday->format("W");
|
||||||
$this->data = array();
|
$this->lastday = new \DateTime($this->monday->format('Y-m-d\TH:i:sP'));
|
||||||
$this->lessons = array();
|
$this->lastday->add(new \DateInterval("P".($this->numdayweek-1)."D"));
|
||||||
$this->lessons_canceled = array();
|
|
||||||
$this->lessons_event = array();
|
$sql = "$this->type = '$this->name' AND NOT lessonid=0 AND (mid(week, $this->week, 1) = '1')";
|
||||||
for ($i=1; $i<=6; $i++) {
|
$result = $DB->get_records_select('timetable_lesson',$sql);
|
||||||
$this->data[$i] = array();
|
foreach ($result as $lesson) {
|
||||||
$this->lessons[$i] = array();
|
if (!lesson_in_lessons($lesson, $this->lessons[$lesson->day][$lesson->period]))
|
||||||
$this->lessons_canceled[$i] = array();
|
$this->lessons[$lesson->day][$lesson->period][] = new lesson($lesson);
|
||||||
$this->lessons_event[$i] = array();
|
}
|
||||||
for ($j=1; $j<=13; $j++) {
|
$sql = "$this->type = '$this->name' AND lessonid=0 AND (mid(week, $this->week, 1) = '1')";
|
||||||
$this->lessons[$i][$j] = array();
|
$result = $DB->get_records_select('timetable_lesson',$sql);
|
||||||
$this->lessons_canceled[$i][$j] = array();
|
foreach ($result as $lesson) {
|
||||||
$this->lessons_event[$i][$j] = array();
|
if (!lesson_in_lessons($lesson, $this->lessons_event[$lesson->day][$lesson->period]))
|
||||||
}
|
$this->lessons_event[$lesson->day][$lesson->period][] = new lesson($lesson);
|
||||||
}
|
}
|
||||||
|
$sql = "$this->type = '$this->name' and (mid(week, $this->week, 1) = 'x')";
|
||||||
|
$result = $DB->get_records_select('timetable_lesson',$sql);
|
||||||
|
foreach ($result as $lesson) {
|
||||||
|
if (!lesson_in_lessons($lesson, $this->lessons_canceled[$lesson->day][$lesson->period]))
|
||||||
|
$this->lessons_canceled[$lesson->day][$lesson->period][] = new lesson($lesson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$day = new \DateTime($this->monday->format('Y-m-d\TH:i:sP'));
|
||||||
/**
|
for ($i=0; $i<$this->numdayweek; $i++) {
|
||||||
*
|
$sql = "date = '".$day->format('Ymd')."' AND ({$this->type}a RLIKE '(^|~){$this->name}($|~)' OR {$this->type}b RLIKE '(^|~){$this->name}($|~)')";
|
||||||
* @param int $week The week of timetable
|
$result = $DB->get_records_select('timetable_substitution',$sql);
|
||||||
*/
|
foreach ($result as $substitution) {
|
||||||
public function read_db($week) {
|
foreach ($this->lessons[$i+1][$substitution->period] as $lesson) {
|
||||||
global $USER, $DB, $CFG;
|
$lesson->process_substitution($substitution);
|
||||||
|
|
||||||
$this->clear_data();
|
|
||||||
$this->numdayweek = 5 + get_config('timetable', 'saturday');
|
|
||||||
$this->week = $week;
|
|
||||||
$this->monday = new \DateTime();
|
|
||||||
$this->monday->setISODate($this->monday->format("Y"), $week);
|
|
||||||
$dayofweek = $this->monday->format('w');
|
|
||||||
if ($dayofweek > $this->numdayweek) {
|
|
||||||
$this->monday->add(new \DateInterval("P".(8-$dayofweek)."D"));
|
|
||||||
} elseif ($dayofweek < 1) {
|
|
||||||
$this->monday->add(new \DateInterval("P1D"));
|
|
||||||
} else {
|
|
||||||
$this->monday->sub(new \DateInterval("P".($dayofweek-1)."D"));
|
|
||||||
}
|
}
|
||||||
|
foreach ($this->lessons_canceled[$i+1][$substitution->period] as $lesson) {
|
||||||
$this->week = $this->monday->format("W");
|
$lesson->process_substitution($substitution);
|
||||||
$this->lastday = new \DateTime($this->monday->format('Y-m-d\TH:i:sP'));
|
|
||||||
$this->lastday->add(new \DateInterval("P".($this->numdayweek-1)."D"));
|
|
||||||
|
|
||||||
$sql = "$this->type = '$this->name' AND NOT lessonid=0 AND (mid(week, $this->week, 1) = '1')";
|
|
||||||
$result = $DB->get_records_select('timetable_lesson',$sql);
|
|
||||||
foreach ($result as $lesson) {
|
|
||||||
if (!lesson_in_lessons($lesson, $this->lessons[$lesson->day][$lesson->period]))
|
|
||||||
$this->lessons[$lesson->day][$lesson->period][] = new lesson($lesson);
|
|
||||||
// Todo: if ($this->periodmax < $lesson->period) $this->periodmax = $lesson->period;
|
|
||||||
}
|
|
||||||
$sql = "$this->type = '$this->name' AND lessonid=0 AND (mid(week, $this->week, 1) = '1')";
|
|
||||||
$result = $DB->get_records_select('timetable_lesson',$sql);
|
|
||||||
foreach ($result as $lesson) {
|
|
||||||
if (!lesson_in_lessons($lesson, $this->lessons_event[$lesson->day][$lesson->period]))
|
|
||||||
$this->lessons_event[$lesson->day][$lesson->period][] = new lesson($lesson);
|
|
||||||
// Todo: if ($this->periodmax < $lesson->period) $this->periodmax = $lesson->period;
|
|
||||||
}
|
|
||||||
$sql = "$this->type = '$this->name' and (mid(week, $this->week, 1) = 'x')";
|
|
||||||
$result = $DB->get_records_select('timetable_lesson',$sql);
|
|
||||||
foreach ($result as $lesson) {
|
|
||||||
if (!lesson_in_lessons($lesson, $this->lessons_canceled[$lesson->day][$lesson->period]))
|
|
||||||
$this->lessons_canceled[$lesson->day][$lesson->period][] = new lesson($lesson);
|
|
||||||
// Todo: if ($this->periodmax < $lesson->period) $this->periodmax = $lesson->period;
|
|
||||||
}
|
|
||||||
|
|
||||||
$day = new \DateTime($this->monday->format('Y-m-d\TH:i:sP'));
|
|
||||||
for ($i=0; $i<$this->numdayweek; $i++) {
|
|
||||||
$sql = "date = '".$day->format('Ymd')."' AND ({$this->type}a RLIKE '(^|~){$this->name}($|~)' OR {$this->type}b RLIKE '(^|~){$this->name}($|~)')";
|
|
||||||
$result = $DB->get_records_select('timetable_substitution',$sql);
|
|
||||||
foreach ($result as $substitution) {
|
|
||||||
foreach ($this->lessons[$i+1][$substitution->period] as $lesson) {
|
|
||||||
$lesson->process_substitution($substitution);
|
|
||||||
}
|
|
||||||
foreach ($this->lessons_canceled[$i+1][$substitution->period] as $lesson) {
|
|
||||||
$lesson->process_substitution($substitution);
|
|
||||||
}
|
|
||||||
foreach ($this->lessons_event[$i+1][$substitution->period] as $lesson) {
|
|
||||||
$lesson->process_substitution($substitution);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Todo: if ($this->periodmax < $lesson->period) $this->periodmax = $lesson->period;
|
|
||||||
|
|
||||||
$types = array('teacher'=>'L', 'class'=>'K', 'room'=>'R');
|
|
||||||
$sql = "startdate <= '".$day->format('Ymd')."' AND enddate >= '".$day->format('Ymd')."' AND type = '{$types[$this->type]}' AND name = '{$this->name}'";
|
|
||||||
$result = $DB->get_records_select('timetable_absence',$sql);
|
|
||||||
foreach ($result as $absence) {
|
|
||||||
for ($j=$absence->startperiod; $j<=$absence->endperiod; $j++) {
|
|
||||||
foreach ($this->lessons_event[$i+1][$j] as $lesson) {
|
|
||||||
$lesson->process_absence($absence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$day->add(new \DateInterval("P1D"));
|
|
||||||
}
|
}
|
||||||
|
foreach ($this->lessons_event[$i+1][$substitution->period] as $lesson) {
|
||||||
for ($i=0; $i<$this->numdayweek; $i++) {
|
$lesson->process_substitution($substitution);
|
||||||
foreach($this->lessons[$i+1] as &$lessons) $lessons = collapse_lessons($lessons);
|
|
||||||
foreach($this->lessons_canceled[$i+1] as &$lessons) $lessons = collapse_lessons($lessons);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->type == 'teacher') {
|
$types = array('teacher'=>'L', 'class'=>'K', 'room'=>'R');
|
||||||
if ($result = $DB->get_record("timetable_$this->type",[$this->type => $this->name])) {
|
$sql = "startdate <= '".$day->format('Ymd')."' AND enddate >= '".$day->format('Ymd')."' AND type = '{$types[$this->type]}' AND name = '{$this->name}'";
|
||||||
$this->description = "$result->surname, $result->firstname";
|
$result = $DB->get_records_select('timetable_absence',$sql);
|
||||||
|
foreach ($result as $absence) {
|
||||||
|
for ($j=$absence->startperiod; $j<=$absence->endperiod; $j++) {
|
||||||
|
foreach ($this->lessons_event[$i+1][$j] as $lesson) {
|
||||||
|
$lesson->process_absence($absence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$day->add(new \DateInterval("P1D"));
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i=0; $i<$this->numdayweek; $i++) {
|
||||||
|
foreach($this->lessons[$i+1] as &$lessons) $lessons = collapse_lessons($lessons);
|
||||||
|
foreach($this->lessons_canceled[$i+1] as &$lessons) $lessons = collapse_lessons($lessons);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->type == 'teacher') {
|
||||||
|
if ($result = $DB->get_record("timetable_$this->type",[$this->type => $this->name])) {
|
||||||
|
$this->description = "$result->surname, $result->firstname";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($result = $DB->get_record("timetable_$this->type",[$this->type => $this->name])) {
|
||||||
|
$this->description = $result->description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "day = 1 ORDER BY period asc";
|
||||||
|
$this->times = $DB->get_records_select('timetable_time',$sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_periodmax() {
|
||||||
|
//$maxperiod = get_config('timetable', 'numperiod');
|
||||||
|
$maxperiod = 0;
|
||||||
|
for ($i=0; $i<$this->numdayweek; $i++) {
|
||||||
|
foreach($this->lessons[$i+1] as $period => $lessons)
|
||||||
|
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
||||||
|
foreach($this->lessons_canceled[$i+1] as $period => $lessons)
|
||||||
|
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
||||||
|
foreach($this->lessons_event[$i+1] as $period => $lessons)
|
||||||
|
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
||||||
|
}
|
||||||
|
return $maxperiod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepare_output() {
|
||||||
|
$resultdata = array();
|
||||||
|
|
||||||
|
$numperiod = max($this->get_periodmax(), get_config('timetable', 'numperiod'));
|
||||||
|
|
||||||
|
$numdayweek = 5 + get_config('timetable', 'saturday');
|
||||||
|
if ($numdayweek == 6) $resultdata['saturday'] = 1; else $resultdata['saturday'] = 0;
|
||||||
|
|
||||||
|
$resultdata['type'] = $this->type;
|
||||||
|
$resultdata['viewteacher'] = ($this->type == 'teacher') ? "1" : "";;
|
||||||
|
$resultdata['viewclass'] = ($this->type == 'class') ? "1" : "";;
|
||||||
|
$resultdata['viewroom'] = ($this->type == 'room') ? "1" : "";;
|
||||||
|
$resultdata['name'] = $this->name;
|
||||||
|
$resultdata['description'] = $this->description;
|
||||||
|
$resultdata['date'] = $this->monday->format('d.m') . " - " . $this->lastday->format('d.m');
|
||||||
|
$resultdata['week'] = $this->week;
|
||||||
|
$resultdata['prevweek'] = $this->week-1;
|
||||||
|
$resultdata['nextweek'] = $this->week+1;
|
||||||
|
$resultdata['id'] = \substr(\md5(\rand()), 0, 7);
|
||||||
|
$periods = array();
|
||||||
|
|
||||||
|
for ($period=0; $period<$numperiod; $period++) {
|
||||||
|
$days = array();
|
||||||
|
for ($day=0; $day<$numdayweek; $day++) {
|
||||||
|
$days[$day] = array();
|
||||||
|
$days[$day]['substitutionold'] = "";
|
||||||
|
$days[$day]['lessons'] = array();
|
||||||
|
foreach ($this->lessons_event[$day+1][$period+1] as $lesson) {
|
||||||
|
$mylesson = array();
|
||||||
|
$mylesson['class'] = $lesson->class;
|
||||||
|
$mylesson['teacher'] = $lesson->teacher;
|
||||||
|
$mylesson['room'] = $lesson->room;
|
||||||
|
$mylesson['subject'] = $lesson->subject;
|
||||||
|
$mylesson['classa'] = $lesson->classa;
|
||||||
|
$mylesson['teachera'] = $lesson->teachera;
|
||||||
|
$mylesson['rooma'] = $lesson->rooma;
|
||||||
|
$mylesson['subjecta'] = $lesson->subjecta;
|
||||||
|
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
||||||
|
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
||||||
|
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
||||||
|
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
||||||
|
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
||||||
|
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
||||||
|
$mylesson['classchanged'] = $lesson->classchanged;
|
||||||
|
$mylesson['roomchanged'] = $lesson->roomchanged;
|
||||||
|
$mylesson['substitution'] = $lesson->substitution;
|
||||||
|
$mylesson['cancel'] = "";
|
||||||
|
$mylesson['cancel4me'] = "";
|
||||||
|
$mylesson['event'] = $lesson->reason ? $lesson->reason : "Event";
|
||||||
|
$mylesson['status'] = "1";
|
||||||
|
$mylesson['flag'] = "1";
|
||||||
|
$mylesson['text'] = $lesson->text;
|
||||||
|
$mylesson['subtype'] = Array();
|
||||||
|
if ($lesson->type) {
|
||||||
|
for ($i=0; $i<32; $i++) {
|
||||||
|
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if ($result = $DB->get_record("timetable_$this->type",[$this->type => $this->name])) {
|
$days[$day]['substitutionold'] .= $lesson->text;
|
||||||
$this->description = $result->description;
|
$days[$day]['lessons'][] = $mylesson;
|
||||||
|
}
|
||||||
|
foreach ($this->lessons[$day+1][$period+1] as $lesson) {
|
||||||
|
$mylesson = array();
|
||||||
|
$mylesson['class'] = $lesson->class;
|
||||||
|
$mylesson['teacher'] = $lesson->teacher;
|
||||||
|
$mylesson['room'] = $lesson->room;
|
||||||
|
$mylesson['subject'] = $lesson->subject;
|
||||||
|
$mylesson['classa'] = $lesson->classa;
|
||||||
|
$mylesson['teachera'] = $lesson->teachera;
|
||||||
|
$mylesson['rooma'] = $lesson->rooma;
|
||||||
|
$mylesson['subjecta'] = $lesson->subjecta;
|
||||||
|
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
||||||
|
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
||||||
|
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
||||||
|
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
||||||
|
$mylesson['substitution'] = $lesson->substitution;
|
||||||
|
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
||||||
|
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
||||||
|
$mylesson['classchanged'] = $lesson->classchanged;
|
||||||
|
$mylesson['roomchanged'] = $lesson->roomchanged;
|
||||||
|
$mylesson['cancel'] = "";
|
||||||
|
$mylesson['cancel4me'] = "";
|
||||||
|
$mylesson['event'] = "";
|
||||||
|
$mylesson['status'] = "";
|
||||||
|
$mylesson['flag'] = "";
|
||||||
|
$mylesson['text'] = $lesson->text;
|
||||||
|
$mylesson['subtype'] = Array();
|
||||||
|
if ($lesson->type) {
|
||||||
|
for ($i=0; $i<32; $i++) {
|
||||||
|
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$days[$day]['substitutionold'] .= $lesson->text;
|
||||||
|
$days[$day]['lessons'][] = $mylesson;
|
||||||
}
|
}
|
||||||
|
foreach ($this->lessons_canceled[$day+1][$period+1] as $lesson) {
|
||||||
$sql = "day = 1 ORDER BY period asc";
|
$mylesson = array();
|
||||||
$this->times = $DB->get_records_select('timetable_time',$sql);
|
$mylesson['class'] = $lesson->class;
|
||||||
}
|
$mylesson['teacher'] = $lesson->teacher;
|
||||||
|
$mylesson['room'] = $lesson->room;
|
||||||
public function get_periodmax() {
|
$mylesson['subject'] = $lesson->subject;
|
||||||
//$maxperiod = get_config('timetable', 'numperiod');
|
$mylesson['classa'] = $lesson->classa;
|
||||||
$maxperiod = 0;
|
$mylesson['teachera'] = $lesson->teachera;
|
||||||
for ($i=0; $i<$this->numdayweek; $i++) {
|
$mylesson['rooma'] = $lesson->rooma;
|
||||||
foreach($this->lessons[$i+1] as $period => $lessons)
|
$mylesson['subjecta'] = $lesson->subjecta;
|
||||||
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
||||||
foreach($this->lessons_canceled[$i+1] as $period => $lessons)
|
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
||||||
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
||||||
foreach($this->lessons_event[$i+1] as $period => $lessons)
|
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
||||||
if ($period > $maxperiod && count($lessons)) $maxperiod = $period;
|
$mylesson['substitution'] = $lesson->substitution;
|
||||||
|
$mylesson['cancel'] = "1";
|
||||||
|
$mylesson['cancel4me'] = "";
|
||||||
|
if (($lesson->teacherchanged && $this->type == 'teacher') ||
|
||||||
|
($lesson->classchanged && $this->type == 'class') ||
|
||||||
|
($lesson->roomchanged && $this->type == 'room')) $mylesson['cancel4me'] = "cancel4me";
|
||||||
|
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
||||||
|
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
||||||
|
$mylesson['classchanged'] = $lesson->classchanged;
|
||||||
|
$mylesson['roomchanged'] = $lesson->roomchanged;
|
||||||
|
#if ((property_exists($lesson,'teacherb') && $this->type == 'teacher') ||
|
||||||
|
# (property_exists($lesson,'classb') && $this->type == 'class') ||
|
||||||
|
# (property_exists($lesson,'roomb') && $this->type == 'room')) $mylesson['cancel4me'] = "cancel4me";
|
||||||
|
$mylesson['event'] = "";
|
||||||
|
$mylesson['status'] = "1";
|
||||||
|
$mylesson['flag'] = "1"; // status und flag werden vertauscht (im Template bzw. extern-lib.php
|
||||||
|
$mylesson['text'] = $lesson->text;
|
||||||
|
$mylesson['subtype'] = Array();
|
||||||
|
if ($lesson->type) {
|
||||||
|
for ($i=0; $i<32; $i++) {
|
||||||
|
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$days[$day]['substitutionold'] .= $lesson->text;
|
||||||
|
$days[$day]['lessons'][] = $mylesson;
|
||||||
}
|
}
|
||||||
return $maxperiod;
|
}
|
||||||
}
|
$periods[$period] = array();
|
||||||
|
$periods[$period]['days'] = $days;
|
||||||
public function prepare_output() {
|
$periods[$period]['number'] = $period+1;
|
||||||
$resultdata = array();
|
$periods[$period]['starttime'] = substr_replace($this->times[$period+1]->starttime, ":",-2,0);
|
||||||
|
$periods[$period]['endtime'] = substr_replace($this->times[$period+1]->endtime, ":",-2,0);
|
||||||
$numperiod = max($this->get_periodmax(), get_config('timetable', 'numperiod'));
|
}
|
||||||
|
$resultdata['periods'] = $periods;
|
||||||
$numdayweek = 5 + get_config('timetable', 'saturday');
|
return $resultdata;
|
||||||
if ($numdayweek == 6) $resultdata['saturday'] = 1; else $resultdata['saturday'] = 0;
|
}
|
||||||
|
|
||||||
$resultdata['type'] = $this->type;
|
|
||||||
$resultdata['viewteacher'] = ($this->type == 'teacher') ? "1" : "";;
|
|
||||||
$resultdata['viewclass'] = ($this->type == 'class') ? "1" : "";;
|
|
||||||
$resultdata['viewroom'] = ($this->type == 'room') ? "1" : "";;
|
|
||||||
$resultdata['name'] = $this->name;
|
|
||||||
$resultdata['description'] = $this->description;
|
|
||||||
$resultdata['date'] = $this->monday->format('d.m') . " - " . $this->lastday->format('d.m');
|
|
||||||
$resultdata['week'] = $this->week;
|
|
||||||
$resultdata['prevweek'] = $this->week-1;
|
|
||||||
$resultdata['nextweek'] = $this->week+1;
|
|
||||||
$resultdata['id'] = \substr(\md5(\rand()), 0, 7);
|
|
||||||
$periods = array();
|
|
||||||
|
|
||||||
for ($period=0; $period<$numperiod; $period++) {
|
|
||||||
$days = array();
|
|
||||||
for ($day=0; $day<$numdayweek; $day++) {
|
|
||||||
$days[$day] = array();
|
|
||||||
$days[$day]['substitutionold'] = "";
|
|
||||||
$days[$day]['lessons'] = array();
|
|
||||||
foreach ($this->lessons_event[$day+1][$period+1] as $lesson) {
|
|
||||||
$mylesson = array();
|
|
||||||
$mylesson['class'] = $lesson->class;
|
|
||||||
$mylesson['teacher'] = $lesson->teacher;
|
|
||||||
$mylesson['room'] = $lesson->room;
|
|
||||||
$mylesson['subject'] = $lesson->subject;
|
|
||||||
$mylesson['classa'] = $lesson->classa;
|
|
||||||
$mylesson['teachera'] = $lesson->teachera;
|
|
||||||
$mylesson['rooma'] = $lesson->rooma;
|
|
||||||
$mylesson['subjecta'] = $lesson->subjecta;
|
|
||||||
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
|
||||||
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
|
||||||
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
|
||||||
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
|
||||||
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
|
||||||
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
|
||||||
$mylesson['classchanged'] = $lesson->classchanged;
|
|
||||||
$mylesson['roomchanged'] = $lesson->roomchanged;
|
|
||||||
$mylesson['substitution'] = $lesson->substitution;
|
|
||||||
$mylesson['cancel'] = "";
|
|
||||||
$mylesson['cancel4me'] = "";
|
|
||||||
$mylesson['event'] = $lesson->reason ? $lesson->reason : "Event";
|
|
||||||
$mylesson['status'] = "1";
|
|
||||||
$mylesson['flag'] = "1";
|
|
||||||
$mylesson['text'] = $lesson->text;
|
|
||||||
$mylesson['subtype'] = Array();
|
|
||||||
if ($lesson->type) {
|
|
||||||
for ($i=0; $i<32; $i++) {
|
|
||||||
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$days[$day]['substitutionold'] .= $lesson->text;
|
|
||||||
$days[$day]['lessons'][] = $mylesson;
|
|
||||||
}
|
|
||||||
foreach ($this->lessons[$day+1][$period+1] as $lesson) {
|
|
||||||
$mylesson = array();
|
|
||||||
$mylesson['class'] = $lesson->class;
|
|
||||||
$mylesson['teacher'] = $lesson->teacher;
|
|
||||||
$mylesson['room'] = $lesson->room;
|
|
||||||
$mylesson['subject'] = $lesson->subject;
|
|
||||||
$mylesson['classa'] = $lesson->classa;
|
|
||||||
$mylesson['teachera'] = $lesson->teachera;
|
|
||||||
$mylesson['rooma'] = $lesson->rooma;
|
|
||||||
$mylesson['subjecta'] = $lesson->subjecta;
|
|
||||||
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
|
||||||
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
|
||||||
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
|
||||||
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
|
||||||
$mylesson['substitution'] = $lesson->substitution;
|
|
||||||
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
|
||||||
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
|
||||||
$mylesson['classchanged'] = $lesson->classchanged;
|
|
||||||
$mylesson['roomchanged'] = $lesson->roomchanged;
|
|
||||||
$mylesson['cancel'] = "";
|
|
||||||
$mylesson['cancel4me'] = "";
|
|
||||||
$mylesson['event'] = "";
|
|
||||||
$mylesson['status'] = "";
|
|
||||||
$mylesson['flag'] = "";
|
|
||||||
$mylesson['text'] = $lesson->text;
|
|
||||||
$mylesson['subtype'] = Array();
|
|
||||||
if ($lesson->type) {
|
|
||||||
for ($i=0; $i<32; $i++) {
|
|
||||||
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$days[$day]['substitutionold'] .= $lesson->text;
|
|
||||||
$days[$day]['lessons'][] = $mylesson;
|
|
||||||
}
|
|
||||||
foreach ($this->lessons_canceled[$day+1][$period+1] as $lesson) {
|
|
||||||
$mylesson = array();
|
|
||||||
$mylesson['class'] = $lesson->class;
|
|
||||||
$mylesson['teacher'] = $lesson->teacher;
|
|
||||||
$mylesson['room'] = $lesson->room;
|
|
||||||
$mylesson['subject'] = $lesson->subject;
|
|
||||||
$mylesson['classa'] = $lesson->classa;
|
|
||||||
$mylesson['teachera'] = $lesson->teachera;
|
|
||||||
$mylesson['rooma'] = $lesson->rooma;
|
|
||||||
$mylesson['subjecta'] = $lesson->subjecta;
|
|
||||||
$mylesson['classb'] = property_exists($lesson,'classb') ? $lesson->classb : null;
|
|
||||||
$mylesson['teacherb'] = property_exists($lesson,'teacherb') ? $lesson->teacherb : null;
|
|
||||||
$mylesson['roomb'] = property_exists($lesson,'roomb') ? $lesson->roomb : null;
|
|
||||||
$mylesson['subjectb'] = property_exists($lesson,'subjectb') ? $lesson->subjectb : null;
|
|
||||||
$mylesson['substitution'] = $lesson->substitution;
|
|
||||||
$mylesson['cancel'] = "1";
|
|
||||||
$mylesson['cancel4me'] = "";
|
|
||||||
if (($lesson->teacherchanged && $this->type == 'teacher') ||
|
|
||||||
($lesson->classchanged && $this->type == 'class') ||
|
|
||||||
($lesson->roomchanged && $this->type == 'room')) $mylesson['cancel4me'] = "cancel4me";
|
|
||||||
$mylesson['subjectchanged'] = $lesson->subjectchanged;
|
|
||||||
$mylesson['teacherchanged'] = $lesson->teacherchanged;
|
|
||||||
$mylesson['classchanged'] = $lesson->classchanged;
|
|
||||||
$mylesson['roomchanged'] = $lesson->roomchanged;
|
|
||||||
#if ((property_exists($lesson,'teacherb') && $this->type == 'teacher') ||
|
|
||||||
# (property_exists($lesson,'classb') && $this->type == 'class') ||
|
|
||||||
# (property_exists($lesson,'roomb') && $this->type == 'room')) $mylesson['cancel4me'] = "cancel4me";
|
|
||||||
$mylesson['event'] = "";
|
|
||||||
$mylesson['status'] = "1";
|
|
||||||
$mylesson['flag'] = "1"; // status und flag werden vertauscht (im Template bzw. extern-lib.php
|
|
||||||
$mylesson['text'] = $lesson->text;
|
|
||||||
$mylesson['subtype'] = Array();
|
|
||||||
if ($lesson->type) {
|
|
||||||
for ($i=0; $i<32; $i++) {
|
|
||||||
if ($lesson->type & (1<<$i)) $mylesson['subtype'][] = $i+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$days[$day]['substitutionold'] .= $lesson->text;
|
|
||||||
$days[$day]['lessons'][] = $mylesson;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$periods[$period] = array();
|
|
||||||
$periods[$period]['days'] = $days;
|
|
||||||
$periods[$period]['number'] = $period+1;
|
|
||||||
$periods[$period]['starttime'] = substr_replace($this->times[$period+1]->starttime, ":",-2,0);
|
|
||||||
$periods[$period]['endtime'] = substr_replace($this->times[$period+1]->endtime, ":",-2,0);
|
|
||||||
}
|
|
||||||
$resultdata['periods'] = $periods;
|
|
||||||
return $resultdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue