diff --git a/README.md b/README.md index ccca141..c82f45f 100755 --- a/README.md +++ b/README.md @@ -5,10 +5,5 @@ This Module provides a timetable block for moodle based on untis export-files: l ## Screenshot: -Students view: - ![image](doc/timetable_screenshot1.png) -Teachers view: - -![image](doc/timetable_screenshot2.png) diff --git a/block_timetable.php b/block_timetable.php index 144da43..9424e52 100755 --- a/block_timetable.php +++ b/block_timetable.php @@ -73,7 +73,7 @@ class block_timetable extends block_base { $class = $this->page->course->shortname; $this->content->text .= "Stundenplan der Klasse $class
"; $ttable = new timetable('class',$class); - } elseif ($USER->department == "Lehrer" || $USER->department == "Lehrer_fvs") { + } elseif ($USER->department == "Lehrer") { $teacher = $USER->username; $teacher = str_replace("l_", "", $teacher); $teacher = str_replace("-fvs", "", $teacher); diff --git a/classes/timetable.php b/classes/timetable.php index 48e3eda..c46ffc9 100755 --- a/classes/timetable.php +++ b/classes/timetable.php @@ -87,8 +87,14 @@ class timetable { } } $day = new \DateTime($this->monday->format('Y-m-d\TH:i:sP')); + // TODO CHANGE DATABASE: table substitution: classesa -> classa, classesb -> classb !!! for ($i=0; $i<$this->numdayweek; $i++) { - $sql = "date = '".$day->format('Ymd')."' AND ({$this->type}a LIKE '%{$this->name}%' OR {$this->type}b LIKE '%{$this->name}%')"; + if ($this->type == 'class') { + $sql = "date = '".$day->format('Ymd')."' AND ({$this->type}esa LIKE '%{$this->name}%' OR {$this->type}esb LIKE '%{$this->name}%')"; + } else { + $sql = "date = '".$day->format('Ymd')."' AND ({$this->type}a LIKE '%{$this->name}%' OR {$this->type}b LIKE '%{$this->name}%')"; + + } if ($result = $DB->get_records_select('timetable_substitution',$sql)) { foreach ($result as $substitution) { diff --git a/doc/.gitkeep b/doc/.gitkeep old mode 100755 new mode 100644 diff --git a/doc/timetable_screenshot1.png b/doc/timetable_screenshot1.png old mode 100755 new mode 100644 index a859cd8..291f6b7 Binary files a/doc/timetable_screenshot1.png and b/doc/timetable_screenshot1.png differ diff --git a/doc/timetable_screenshot2.png b/doc/timetable_screenshot2.png deleted file mode 100755 index 3610f4e..0000000 Binary files a/doc/timetable_screenshot2.png and /dev/null differ diff --git a/module.js b/module.js old mode 100755 new mode 100644 diff --git a/styles.css b/styles.css old mode 100755 new mode 100644