5/6 day week (saturday)
block on dashboard too automatic detection wheater class or teacher plan automatic next week detection (rd)
This commit is contained in:
parent
cd4a4c19a3
commit
60c4b8e1f8
5 changed files with 57 additions and 25 deletions
|
|
@ -35,7 +35,7 @@ class timetable {
|
|||
$this->name = $name;
|
||||
$this->periodmax=0;
|
||||
$this->data = array();
|
||||
for ($i=1; $i<6; $i++) $this->data[$i] = array();
|
||||
for ($i=1; $i<=6; $i++) $this->data[$i] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +46,8 @@ class timetable {
|
|||
global $USER, $DB, $CFG;
|
||||
|
||||
$this->week = $week;
|
||||
$sql = "$this->type = '$this->name' and not (mid(week, $this->week, 1) = '0')";
|
||||
//$sql = "$this->type = '$this->name' and not (mid(week, $this->week, 1) = '0')";
|
||||
$sql = "$this->type = '$this->name' and (mid(week, $this->week, 1) = '1')";
|
||||
if ($result = $DB->get_records_select('timetable_lesson',$sql)) {
|
||||
foreach ($result as $lesson) {
|
||||
$this->data[$lesson->day][$lesson->period][] = $lesson;
|
||||
|
|
@ -63,31 +64,35 @@ class timetable {
|
|||
public function print_table($view) {
|
||||
global $DB;
|
||||
//var_dump($this->data[1]);
|
||||
$numperiod = $period_max = get_config('timetable', 'numperiod');
|
||||
$numperiod = get_config('timetable', 'numperiod');
|
||||
$numdayweek = 5 + get_config('timetable', 'saturday');
|
||||
if ($this->periodmax>$numperiod) $numperiod = $this->periodmax;
|
||||
$table = new \html_table();
|
||||
$table->attributes['class'] = 'minicalendar calendartable generaltable';
|
||||
$table->head = array('','Mo','Di', 'Mi' , 'Do', 'Fr');
|
||||
if ($numdayweek == 6) $table->head[] = 'Sa';
|
||||
for ($i = 1; $i<=$numperiod; $i++) {
|
||||
$tablerow = new \html_table_row();
|
||||
$cell = new \html_table_cell($i);
|
||||
$cell->style = 'font-weight: bold;';
|
||||
// $cell->attributes['class'] = 'header';
|
||||
$tablerow->cells[] = $cell;
|
||||
for ($k = 1; $k <= 5; $k++) {
|
||||
for ($k = 1; $k <= $numdayweek; $k++) {
|
||||
$flag = 0;
|
||||
if (array_key_exists($i,$this->data[$k])) {
|
||||
$content = "";
|
||||
foreach ($this->data[$k][$i] as $lesson) {
|
||||
if ($content) $content .= "<br>";
|
||||
if ($lesson->flag) $content .= "<span style='color:red;'>";
|
||||
$content .= $lesson->{$view};
|
||||
if ($lesson->flag) $content .= "</span>";
|
||||
$flag += $lesson->flag;
|
||||
}
|
||||
} else {
|
||||
$content = "-";
|
||||
}
|
||||
$cell = new \html_table_cell($content);
|
||||
if ($flag) $cell->style = 'color: red;';
|
||||
// if ($flag) $cell->style = 'color: red;';
|
||||
$tablerow->cells[] = $cell;
|
||||
}
|
||||
$table->data[] = $tablerow;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue