diff options
author | Simon Rettberg | 2016-07-07 11:32:19 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-07 11:32:19 +0200 |
commit | e28f9df206cbf59bb7a22a0d19439d650ae2cbdf (patch) | |
tree | 5c41918e55f0aae77491551b3e4f681017001b4a /modules-available/exams | |
parent | Change menu overriding mechanism; simpler, now also supports changing the cat... (diff) | |
download | slx-admin-e28f9df206cbf59bb7a22a0d19439d650ae2cbdf.tar.gz slx-admin-e28f9df206cbf59bb7a22a0d19439d650ae2cbdf.tar.xz slx-admin-e28f9df206cbf59bb7a22a0d19439d650ae2cbdf.zip |
[exams] Hide 'show' button for past exams; show axis caption on top and bottom if we have more than 5 locations
Diffstat (limited to 'modules-available/exams')
-rw-r--r-- | modules-available/exams/page.inc.php | 5 | ||||
-rw-r--r-- | modules-available/exams/templates/page-exams.html | 17 |
2 files changed, 13 insertions, 9 deletions
diff --git a/modules-available/exams/page.inc.php b/modules-available/exams/page.inc.php index 33117c2e..d0d2255f 100644 --- a/modules-available/exams/page.inc.php +++ b/modules-available/exams/page.inc.php @@ -138,9 +138,9 @@ class Page_Exams extends Page if ($exam['endtime'] < $now) { $exam['rowClass'] = 'gray'; $exam['btnClass'] = 'btn-success'; + $exam['liesInPast'] = true; } else { $exam['btnClass'] = 'btn-default'; - $exam['confirmDelete'] = true; } $exam['starttime_s'] = date('Y-m-d H:i', $exam['starttime']); $exam['endtime_s'] = date('Y-m-d H:i', $exam['endtime']); @@ -296,7 +296,8 @@ class Page_Exams extends Page 'vis_begin' => strtotime('-5 minute') * 1000, 'vis_end' => strtotime('+2 day') * 1000, 'vis_min_date' => $this->rangeMin * 1000, - 'vis_max_date' => $this->rangeMax * 1000 + 'vis_max_date' => $this->rangeMax * 1000, + 'axis_label' => (count($this->locations) > 5 ? 'both' : 'bottom') ]); } elseif ($this->action === "add") { Render::setTitle(Dictionary::translate('title_add-exam')); diff --git a/modules-available/exams/templates/page-exams.html b/modules-available/exams/templates/page-exams.html index c30289d6..5fa4c0c5 100644 --- a/modules-available/exams/templates/page-exams.html +++ b/modules-available/exams/templates/page-exams.html @@ -20,9 +20,11 @@ <td class="slx-nowrap">{{starttime_s}}</td> <td class="slx-nowrap">{{endtime_s}}</td> <td class="slx-nowrap"> - <form method="POST" action="?do=exams&action=delete" {{#confirmDelete}}onsubmit="return confirm('{{lang_deleteConfirmation}}');"{{/confirmDelete}} > - <span onclick="slxShow({{starttime}}, {{endtime}})" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-eye-open"></span></span> - <a href="?do=exams&action=edit&examid={{examid}}" class="btn btn-default btn-sm" >{{lang_edit}}</a> + <form method="POST" action="?do=exams&action=delete" {{^liesInPast}}onsubmit="return confirm('{{lang_deleteConfirmation}}');"{{/liesInPast}} > + {{^liesInPast}} + <span onclick="slxShow({{starttime}}, {{endtime}})" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-eye-open"></span></span> + {{/liesInPast}} + <a href="?do=exams&action=edit&examid={{examid}}" class="btn btn-default btn-sm" >{{lang_edit}}</a> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="examid" value="{{examid}}"> <button class="btn {{btnClass}} btn-sm">{{lang_delete}}</button> @@ -70,17 +72,18 @@ document.addEventListener("DOMContentLoaded", function () { var options = { 'start' : {{vis_begin}}, - 'end' : {{vis_end}}, + 'end' : {{vis_end}}, 'stack' : false, - 'editable' : false, + 'editable': false, 'min' : {{vis_min_date}}, 'max' : {{vis_max_date}}, 'zoomMin': 6 * 3600 * 1000, 'zoomMax': 2 * 86400 * 1000, 'order' : itemOrderFun, - 'groupOrder' : groupOrderFun, + 'groupOrder': groupOrderFun, 'locale' : language, - 'moment' : function(date) { return vis.moment(date).utc(); } + 'moment' : function(date) { return vis.moment(date).utc(); }, + 'orientation': { 'axis': '{{axis_label}}' } }; slxTimeline = new vis.Timeline(container, items, groups, options); |