diff options
author | Simon Rettberg | 2016-06-24 12:38:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-06-24 12:38:01 +0200 |
commit | d980aa867ae2480c56be97fa789f79246178e908 (patch) | |
tree | d77e88a0a6a227f8e6ebafd6f2483eb146207b54 /modules-available/exams | |
parent | [exams] Apply formatting (diff) | |
download | slx-admin-d980aa867ae2480c56be97fa789f79246178e908.tar.gz slx-admin-d980aa867ae2480c56be97fa789f79246178e908.tar.xz slx-admin-d980aa867ae2480c56be97fa789f79246178e908.zip |
[exams] Move to content group; fix timepicker; mark old exams
Diffstat (limited to 'modules-available/exams')
-rw-r--r-- | modules-available/exams/config.json | 2 | ||||
-rw-r--r-- | modules-available/exams/page.inc.php | 14 | ||||
-rw-r--r-- | modules-available/exams/templates/page-add-edit-exam.html | 58 | ||||
-rw-r--r-- | modules-available/exams/templates/page-exams.html | 4 |
4 files changed, 55 insertions, 23 deletions
diff --git a/modules-available/exams/config.json b/modules-available/exams/config.json index b39f0365..c0077970 100644 --- a/modules-available/exams/config.json +++ b/modules-available/exams/config.json @@ -1,5 +1,5 @@ { - "category":"main.status", + "category":"main.content", "dependencies": [ "locations", "visjs", "bootstrap_datepicker", "bootstrap_timepicker", "bootstrap_multiselect"], "permission": "0" } diff --git a/modules-available/exams/page.inc.php b/modules-available/exams/page.inc.php index 79276236..56ab50f7 100644 --- a/modules-available/exams/page.inc.php +++ b/modules-available/exams/page.inc.php @@ -108,11 +108,17 @@ class Page_Exams extends Page protected function makeExamsForTemplate() { $out = []; + $now = time(); foreach ($this->exams as $exam) { - $tmp = $exam; - $tmp['starttime'] = date('Y-m-d H:i', $tmp['starttime']); - $tmp['endtime'] = date('Y-m-d H:i', $tmp['endtime']); - $out[] = $tmp; + if ($exam['endtime'] < $now) { + $exam['rowClass'] = 'gray'; + $exam['btnClass'] = 'btn-success'; + } else { + $exam['btnClass'] = 'btn-default'; + } + $exam['starttime'] = date('Y-m-d H:i', $exam['starttime']); + $exam['endtime'] = date('Y-m-d H:i', $exam['endtime']); + $out[] = $exam; } return $out; } diff --git a/modules-available/exams/templates/page-add-edit-exam.html b/modules-available/exams/templates/page-add-edit-exam.html index 26cbf8bc..98683a54 100644 --- a/modules-available/exams/templates/page-add-edit-exam.html +++ b/modules-available/exams/templates/page-add-edit-exam.html @@ -15,30 +15,54 @@ </select> </div> - <div class="row"> - <div class="form-group col-xs-6"> + <div class="row form-group"> + <div class="col-xs-6"> <label for="starttime_date">{{lang_begin_date}}</label> - <input required class="form-control datepicker" name="starttime_date" id="starttime_date" value="{{exam.starttime_date}}"> + <div class="input-group"> + <span class="input-group-addon"> + <span class="glyphicon glyphicon-calendar"></span> + </span> + <input required class="form-control datepicker" name="starttime_date" id="starttime_date" + value="{{exam.starttime_date}}"> + </div> </div> - <div class="form-group col-xs-6"> + <div class="col-xs-6"> <label for="starttime_time">{{lang_begin_time}}</label> - <input required type="text" class="form-control timepicker" name="starttime_time" id="starttime_time" value="{{exam.starttime_time}}" - pattern="[0-9]{1,2}:[0-9]{2}"> + <div class="input-group bootstrap-timepicker timepicker"> + <span class="input-group-addon"> + <span class="glyphicon glyphicon-time"></span> + </span> + <input required type="text" class="form-control timepicker2" name="starttime_time" id="starttime_time" + value="{{exam.starttime_time}}" + pattern="[0-9]{1,2}:[0-9]{2}"> + </div> </div> </div> - <div class="row"> - <div class="form-group col-xs-6"> + <div class="row form-group"> + <div class="col-xs-6"> <label for="endtime_date">{{lang_end_date}}</label> - <input required class="form-control datepicker" name="endtime_date" id="endtime_date" value="{{exam.endtime_date}}"> + <div class="input-group"> + <span class="input-group-addon"> + <span class="glyphicon glyphicon-calendar"></span> + </span> + <input required class="form-control datepicker" name="endtime_date" id="endtime_date" + value="{{exam.endtime_date}}"> + </div> </div> - <div class="form-group col-xs-6"> + <div class="col-xs-6"> <label for="endtime_time">{{lang_end_time}}</label> - <input required type="texxt" class="form-control timepicker" name="endtime_time" id="endtime_time" value="{{exam.endtime_time}}" - pattern="[0-9]{1,2}:[0-9]{2}"> + <div class="input-group bootstrap-timepicker timepicker"> + <span class="input-group-addon"> + <span class="glyphicon glyphicon-time"></span> + </span> + <input required type="texxt" class="form-control timepicker2" name="endtime_time" id="endtime_time" + value="{{exam.endtime_time}}" + pattern="[0-9]{1,2}:[0-9]{2}"> + </div> </div> </div> - <div class="row"> + <div class="row form-group"> <div class="form-group col-xs-12"> <label for="description">{{lang_description}}</label> <textarea class="form-control" type="textarea" name="description" id="description">{{exam.description}}</textarea> @@ -48,7 +72,7 @@ <input type="hidden" name="action" value="save"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="examid" value="{{exam.examid}}"> - <button class="btn btn-success">{{lang_addExam}}</button> + <button class="btn btn-success">{{lang_save}}</button> </form> <script type="application/javascript"><!-- @@ -60,10 +84,12 @@ document.addEventListener("DOMContentLoaded", function () { }; var timeSettings = { showSeconds: false, - showMeridian: false + showMeridian: false, + minuteStep: 5, + appendWidgetTo: 'body' }; $('.datepicker').datepicker(dateSettings); - $('.timepicker').timepicker(timeSettings); + $('.timepicker2').timepicker(timeSettings); $('#locations').multiselect({numberDisplayed: 1}); }, false); diff --git a/modules-available/exams/templates/page-exams.html b/modules-available/exams/templates/page-exams.html index b2483d6e..d0be479d 100644 --- a/modules-available/exams/templates/page-exams.html +++ b/modules-available/exams/templates/page-exams.html @@ -11,7 +11,7 @@ <th>{{lang_actions}}</th> </tr> {{#exams}} - <tr> + <tr class="{{rowClass}}"> <td>{{examid}}</td> <td>{{locationnames}} </td> <td>{{starttime}}</td> @@ -21,7 +21,7 @@ <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 btn-default btn-sm">{{lang_delete}}</button> + <button class="btn {{btnClass}} btn-sm">{{lang_delete}}</button> </form> </td> </tr> |