CSS and logic updates

This commit is contained in:
L_DA 2020-11-21 16:57:50 +00:00
parent 52f3f359af
commit c000c8f7b7
5 changed files with 297 additions and 78 deletions

View file

@ -43,6 +43,16 @@ class lesson {
$this->subjecta = "";
$this->classa = "";
$this->rooma = "";
//$this->teacherb = "";
//$this->subjectb = "";
//$this->classb = "";
//$this->roomb = "";
$this->teacherchanged = false;
$this->subjectchanged = false;
$this->classchanged = false;
$this->roomchanged = false;
$this->reason = "";
$this->type = 0;
}
/**
@ -50,39 +60,43 @@ class lesson {
* @param object $substitution Substitution
*/
public function process_substitution($substitution) {
// echo "Entering substitution! $this->teacher, $this->subject, $this->class, $this->room \n\t $substitution->teacherb, $substitution->subjectb, $substitution->classb, $substitution->roomb\n";
if (//$this->lessonid == $substitution->lesson &&
$this->teacher == $substitution->teacherb &&
$this->subject == $substitution->subjectb &&
$this->class == $substitution->classb &&
$this->room == $substitution->roomb) {
//preg_match("(^|~)$this->teacher($|~)", $substitution->teacherb) &&
//preg_match("(^|~)$this->subject($|~)", $substitution->subjectb) &&
//preg_match("(^|~)$this->class($|~)", $substitution->classb) &&
//preg_match("(^|~)$this->room($|~)", $substitution->roomb)) {
preg_match("/(^|~)".preg_quote($this->class,"/")."($|~)/", $substitution->classb) &&
preg_match("/(^|~)".preg_quote($this->room,"/")."($|~)/", $substitution->roomb) ) {
// Append change info
// if (!preg_match("(^|~)$this->teacher($|~)", $substitution->teachera)) $this->teachera = $substitution->teachera;
// if (!preg_match("(^|~)$this->subject($|~)", $substitution->subjecta)) $this->subjecta = $substitution->subjecta;
// if (!preg_match("(^|~)$this->class($|~)" , $substitution->classa )) $this->classa = $substitution->classa;
// if (!preg_match("(^|~)$this->room($|~)" , $substitution->rooma )) $this->rooma = $substitution->rooma;
if ($this->teacher != $substitution->teachera) $this->teachera = $substitution->teachera;
if ($this->subject != $substitution->subjecta) $this->subjecta = $substitution->subjecta;
if ($this->class != $substitution->classa ) $this->classa = $substitution->classa;
if ($this->room != $substitution->rooma ) $this->rooma = $substitution->rooma;
$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;
// echo "In substitution! $this->teachera, $this->subjecta, $this->classa, $this->rooma\n";
$this->type = $substitution->type;
$this->substitution = "1";
return 1;
} elseif (//$this->lessonid == $substitution->lesson &&
$this->teacher == $substitution->teachera &&
$this->subject == $substitution->subjecta &&
$this->class == $substitution->classa &&
$this->room == $substitution->rooma) {
$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;
$this->type .= $substitution->type;
// echo "In substitution! $this->teachera, $this->subjecta, $this->classa, $this->rooma\n";
#$this->substitution = "1";
// 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;