-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·44 lines (44 loc) · 1.93 KB
/
index.php
File metadata and controls
executable file
·44 lines (44 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!Doctype html>
<html>
<head>
<title>Lectio til iCalendar</title>
<script type="text/javascript">
function lec(){
if (mkurl(document.getElementById('lectio').value))
{
x = mkurl(document.getElementById('lectio').value);
if(x.type=='laerer'){
window.location='webcal://emilba.ch/projects/lectio/lectio.php?laerer='+x.laererid+'&uger=2&type=laerer&skole='+x.school;
}else{
window.location='webcal://emilba.ch/projects/lectio/lectio.php?elev='+x.elevid+'&uger=2&skole='+x.school;
}
return true;
}
else
{
alert('Web-addressen kunne ikke forstås. Hvis fejlen forbliver, så send en mail til me@emilba.ch der er oplyst på kontakt siden.');
}
return false;
}
function mkurl(url){
var regex = /[?&]([^=#]+)=([^&#]*)/g,
params = {},
match;
while(match = regex.exec(url)) {
params[match[1]] = match[2];
}
path = url.split("/");
school = path[4];
params.school = school;
if((Math.floor(params.school) && Math.floor(params.elevid)) || (Math.floor(params.school) && Math.floor(params.laererid))) return params;
else return false;
}
</script>
</head>
<body>
<form action="javascript:void(0)">
<input type='text' id='lectio' placeholder='URL'/>
<input type='submit' onclick="lec()" value='Lav Kalender' />
</form>
</body>
</html>