summaryrefslogtreecommitdiffstats
path: root/modules-available/exams
diff options
context:
space:
mode:
authorSimon Rettberg2017-03-30 12:14:07 +0200
committerSimon Rettberg2017-03-30 12:14:07 +0200
commit4fa03f0b32fde4bada013f60bc65ed3f4664075c (patch)
treed99c1ee32850f9377111e85228f0923f91d39b23 /modules-available/exams
parent[webinterface] Try to redirect back to HTTP when HTTPS gets disabled (diff)
downloadslx-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')
-rw-r--r--modules-available/exams/page.inc.php9
-rw-r--r--modules-available/exams/templates/page-upcoming-lectures.html11
2 files changed, 17 insertions, 3 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
diff --git a/modules-available/exams/templates/page-upcoming-lectures.html b/modules-available/exams/templates/page-upcoming-lectures.html
index 4a62bc29..a1867444 100644
--- a/modules-available/exams/templates/page-upcoming-lectures.html
+++ b/modules-available/exams/templates/page-upcoming-lectures.html
@@ -8,7 +8,7 @@
<th>{{lang_actions}}</th>
</tr>
{{#pending_lectures}}
- <tr>
+ <tr class="{{class}}">
<td>
{{displayname}}
<div class="small">
@@ -30,5 +30,14 @@
</td>
</tr>
{{/pending_lectures}}
+ {{#decollapse}}
+ <tr class="slx-decollapse">
+ <td colspan="3">
+ <span class="btn-group btn-group-justified">
+ <span class="btn btn-default btn-sm"><span class="glyphicon glyphicon-menu-down"></span></span>
+ </span>
+ </td>
+ </tr>
+ {{/decollapse}}
</table>
</div> \ No newline at end of file