diff options
author | Simon Rettberg | 2017-03-30 12:14:07 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-03-30 12:14:07 +0200 |
commit | 4fa03f0b32fde4bada013f60bc65ed3f4664075c (patch) | |
tree | d99c1ee32850f9377111e85228f0923f91d39b23 /modules-available/exams/page.inc.php | |
parent | [webinterface] Try to redirect back to HTTP when HTTPS gets disabled (diff) | |
download | slx-admin-4fa03f0b32fde4bada013f60bc65ed3f4664075c.tar.gz slx-admin-4fa03f0b32fde4bada013f60bc65ed3f4664075c.tar.xz slx-admin-4fa03f0b32fde4bada013f60bc65ed3f4664075c.zip |
[exams] Extend "upcoming lectures" from 5 to 30 days; collapse list if > 5
Closes #3099
Diffstat (limited to 'modules-available/exams/page.inc.php')
-rw-r--r-- | modules-available/exams/page.inc.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules-available/exams/page.inc.php b/modules-available/exams/page.inc.php index 49b48bb6..930ba62c 100644 --- a/modules-available/exams/page.inc.php +++ b/modules-available/exams/page.inc.php @@ -165,7 +165,8 @@ class Page_Exams extends Page { $out = []; $now = time(); - $cutoff = strtotime('+ 5 day'); + $cutoff = strtotime('+30 day'); + $theCount = 0; foreach ($this->lectures as $lecture) { if ($lecture['endtime'] < $now || $lecture['starttime'] > $cutoff) continue; @@ -179,6 +180,9 @@ class Page_Exams extends Page if ($duration < 86400) { $entry['duration_s'] = gmdate('H:i', $duration); } + if (++$theCount > 5) { + $entry['class'] = 'collapse'; + } $out[] = $entry; } return $out; @@ -356,7 +360,8 @@ class Page_Exams extends Page Message::addInfo('no-upcoming-lecture-exams'); } else { Render::addTemplate('page-upcoming-lectures', [ - 'pending_lectures' => $upcoming + 'pending_lectures' => $upcoming, + 'decollapse' => array_key_exists('class', end($upcoming)) ]); } // Vis.js timeline |