initial commit (da)
This commit is contained in:
commit
634dceef57
26 changed files with 2592 additions and 0 deletions
7
templates/searchform.mustache
Normal file
7
templates/searchform.mustache
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<div class="search-box">
|
||||
Suche Stundenplan: <input type="text" name="searchstring" autocomplete="off" placeholder="Suchtext..." class="searchstring"/>
|
||||
<div class="searchresult"></div>
|
||||
<div style="display: flex; flex-wrap: wrap;">
|
||||
<div class="timetable"></div>
|
||||
</div>
|
||||
</div>
|
||||
50
templates/searchresult.mustache
Normal file
50
templates/searchresult.mustache
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<div class="searchresult">
|
||||
<ul>
|
||||
{{#searchresults}}
|
||||
<li><a href="javascript:;" class="searchresults" data-type="{{type}}" data-name="{{name}}" data-add="0">{{description}}</a> <a href="javascript:;" class="searchresults" data-type="{{type}}" data-name="{{name}}" data-add="1">+</a></li>
|
||||
{{/searchresults}}
|
||||
</ul>
|
||||
{{^searchresults}}Keine Treffer{{/searchresults}}
|
||||
</div>
|
||||
{{# js }}
|
||||
require([
|
||||
'jquery','core/ajax','core/templates', 'core/notification'
|
||||
] , function($, ajax, templates, notification) {
|
||||
|
||||
|
||||
function load_timetable(type, name, add) {
|
||||
//alert(searchstring);
|
||||
var promises = ajax.call([
|
||||
{ methodname: 'mod_timetable_get', args: { type: type, name: name, week: 0 } },
|
||||
]);
|
||||
|
||||
if (add=='1') {
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/get is' + response);
|
||||
templates.render('mod_timetable/timetable',response).done(function(html, js) {
|
||||
$('.timetable').last().after(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
} else {
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/get is' + response);
|
||||
templates.render('mod_timetable/timetable',response).done(function(html, js) {
|
||||
$('.timetable').first().replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(".searchresults").click(function() {
|
||||
load_timetable($(event.target).data('type'),$(event.target).data('name'),$(event.target).data('add'));
|
||||
});
|
||||
});
|
||||
{{/ js }}
|
||||
86
templates/timetable.mustache
Normal file
86
templates/timetable.mustache
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<div class="timetable" style="border-width:1px; border-style: solid; border-spacing:5px;" id="{{id}}">
|
||||
<div class="timetable_head" style="padding-left:5px; padding-right:5px">
|
||||
<span class="description" style="display:block; float: left; width:95%; text-align: center; font-weight: bold;">{{description}}</span>
|
||||
<span id='close' onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode); return false;' style="display:block; float:right"><a href="javascript:;" title="Stundenplan schließen">x</a></span>
|
||||
</div>
|
||||
<div class="generaltable" style="font-size:8pt; padding-top:0rem; padding-bottom:0rem">
|
||||
<table style="xxwidth:100%; text-align:center; spacing:0rem; padding-top:0rem; padding-bottom:0rem; border: 1px dotted">
|
||||
<caption style="padding-top:0pt; padding-bottom:0pt">
|
||||
<div style="display: block; font-size: 10pt">
|
||||
<span style="display: block; float: left; width:10%; text-align: left;"><a href="javascript:;" class="prevweek" data-type='{{type}}' data-id='{{id}}' data-name='{{name}}' data-week='{{prevweek}}' title="vorherige Woche">◄</a></span>
|
||||
<span class="date" style="display: block; float: left; width:80%; text-align: center;">{{date}}</span>
|
||||
<span style="display:block; float:right; width:10%; text-align: right"><a href="javascript:;" class="nextweek" data-type='{{type}}' data-id='{{id}}' data-name='{{name}}' data-week='{{nextweek}}' title="nächste Woche">►</a></span>
|
||||
</div>
|
||||
</caption>
|
||||
<tr style="text-align:center">
|
||||
<th></th>
|
||||
<th style="width:4rem">Mo</th>
|
||||
<th style="width:4rem">Di</th>
|
||||
<th style="width:4rem">Mi</th>
|
||||
<th style="width:4rem">Do</th>
|
||||
<th style="width:4rem">Fr</th>
|
||||
{{#saturday}}
|
||||
<th style="width:4rem">Samstag</th>
|
||||
{{/saturday}}
|
||||
</tr>
|
||||
{{#periods}}
|
||||
<tr style="border:1px black; padding-top:0rem; padding-bottom:0rem">
|
||||
<th>{{number}}</th>
|
||||
{{#days}}
|
||||
<td style="padding-top:0rem; padding-bottom:0rem; vertical-alig:middle; border-left:1px black;" {{#substitution}}bgcolor="pink" data-toggle='tooltip' title='{{substitution}}'{{/substitution}}>
|
||||
{{#lessons}}
|
||||
{{#status}}
|
||||
<div class="lesson" style="padding:2pt; {{#flag}}background-color:red;{{/flag}}">
|
||||
<div class="omission">---</div>
|
||||
</div>
|
||||
{{/status}}
|
||||
{{^status}}
|
||||
<div class="lesson" style="padding:2pt; {{#flag}}background-color:red;{{/flag}}">
|
||||
<div class="subject">{{subject}}</div>
|
||||
<div class="class">{{class}}</div>
|
||||
<div class="teacher">{{teacher}}</div>
|
||||
<div class="room">{{room}}</div>
|
||||
</div>
|
||||
{{/status}}
|
||||
{{/lessons}}
|
||||
</td>
|
||||
{{/days}}
|
||||
</tr>
|
||||
{{/periods}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{# js }}
|
||||
require([
|
||||
'jquery','core/ajax','core/templates', 'core/notification'
|
||||
] , function($, ajax, templates, notification) {
|
||||
|
||||
|
||||
function load_timetable(type, name, week, id) {
|
||||
//alert($("#"+id));
|
||||
//alert("type: "+type);
|
||||
//alert("Week: "+week);
|
||||
var promises = ajax.call([
|
||||
{ methodname: 'mod_timetable_get', args: { type: type, name: name, week: week } },
|
||||
]);
|
||||
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/get is' + response);
|
||||
templates.render('mod_timetable/timetable',response).done(function(html, js) {
|
||||
$("#"+id).replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
}
|
||||
|
||||
//alert("Hi, this is a test");
|
||||
$(".nextweek").click(function() {
|
||||
load_timetable($(event.target).data('type'), $(event.target).data('name'), $(event.target).data('week'), $(event.target).data('id')); //.parentNode.parentNode.parentNode.parentNode);
|
||||
});
|
||||
$(".prevweek").click(function() {
|
||||
load_timetable($(event.target).data('type'), $(event.target).data('name'), $(event.target).data('week'), $(event.target).data('id')); //.parentNode.parentNode.parentNode);
|
||||
});
|
||||
});
|
||||
{{/ js }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue