Repository navigation
Expand file tree
/
Copy pathfunc.php
More file actions
executable file
·114 lines (94 loc) · 3.2 KB
/
Copy pathfunc.php
File metadata and controls
executable file
·114 lines (94 loc) · 3.2 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
function myHeader(){
print("
<html>
<head>
<title>Belldandy - the Logos bell system!</title>
<link rel = \"stylesheet\" type=\"text/css\" href=\"styles.css\"/>
</head>
<body>");
}
function myFooter(){
print("</body>
</html>");
} //end footer()
function showBells(){
$schedules=simplexml_load_file('bells.xml');
$prepend = 0;
foreach($schedules as $schedule){
print("<h1 class=\"$schedule->active\">");
print($schedule->title);
print("<table>");
print("<tr class=\"h\"><td>Period</td><td>Start</td><td>End</td><td>DoW</td><td>Sound</td></tr>");
foreach($schedule->periods->period as $period){
print("<tr class=\"c$prepend\">");
print("<td>".$period->name."</td>");
print("<td>".$period->starttime."</td>");
print("<td>".$period->endtime."</td>");
print("<td>".$period->dow."</td>");
print("<td>".$period->sound."</td>");
print("</tr>");
$prepend++;
$prepend=$prepend%2;
}
print("</table>");
$prepend = 0;
}
}
function findSchedule($schedules,$key){
$selection = null;
foreach($schedules as $schedule){
if($schedule->sid==$key){
$selection = $schedule;
}
}
return $selection;
}
function findPeriod($schedule,$key){
$selection = null;
foreach($schedule as $periods){
foreach($periods as $period){
if($period->pid==$key){
$selection = $period;
}
}
}
return $selection;
}
function generateTimeSelect($name,$curtimeval){
print("<select name=\"".$name."hour\">");
$stime = explode(":",$curtimeval);
$shour = $stime[0];
$smin = $stime[1];
$selected="";
for($i=7;$i<24;$i++){
if($i<10)$i="0".$i;
if($i==$shour) $selected = "selected";
print("<option $selected>$i</option>");
$selected="";
}
for($i=0;$i<7;$i++) print("<option>0$i</option>");
print("</select>"); //end hour selection
print(":");
print("<select name=\"startmin\">");
for($i=0;$i<60;$i++){
if($i<10)$i="0".$i;
if($i==$smin) $selected = "selected";
print("<option $selected>$i</option>");
$selected="";
}
print("</select>"); //end min selection
}
function generateDOWSelect($name,$curdow,$id){
$possDOW=array("MON","TUE","WED","THU","FRI","SAT","SUN");
$curdow = explode(",",$curdow);
$checked="rgb(220,220,220);";
foreach($possDOW as $thisDOW){
foreach($curdow as $testdow){
if(strcmp($testdow,$thisDOW)==0) $checked="green";
}
print("<div style=\"float:left;color:$checked\" class=\"cbox\" id=\"$id.dow.$thisDOW\">".$thisDOW." </div>");
$checked="rgb(220,220,220);";
}
}
?>