-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
100 lines (94 loc) · 4.37 KB
/
settings.php
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
<?php include 'setup.php';?>
<?php require $root.'../../database.php'; ?>
<?php $permission = loginCheck($session); ?>
<?php include 'head.php'; head('Film Night Settings');?>
<body>
<?php include 'top-nav.php' ?>
<div id="container">
<?php if($permission != FALSE): ?>
<script>window.onload = function() { closeClapper(); setTimeout(shrinkHeader, 500); };</script>
<?php
$details = getUserDetails($_SESSION['ID']);
if($details != "Error"){
$rollCall = $details['Attending'];
$attending = $details['Reminder_Attending'];
$voting = $details['Reminder_Voting'];
$results = $details['Reminder_Results'];
$email = $details['Email'];
$voting30 = $details['Reminder_Voting30'];
$voting60 = $details['Reminder_Voting60'];
$attendingNotification = $details['Notification_Attending'];
$votingNotification = $details['Notification_Voting'];
$resultsNotification = $details['Notification_Results'];
$voting30Notification = $details['Notification_Voting30'];
$voting60Notification = $details['Notification_Voting60'];
}else{
$SESSION['ERROR'] = "settings.php failed to retreive user details for user ".$_SESSION['ID'];
echo "<script>window.location.replace('error.php')</script>";
}
echo '<div id="background" style="width:94%;background:#d5d5d5;padding:3%;height:100%;">';
echo "<form action='admin/settingshandler.php' method='POST' class='card'>";
if(status()=="rollCall"){
echo 'Will you be attending this weeks film night?<br>
<select name="rollCall">
<option value="yes" ';
if ($rollCall == "1"){echo 'selected="selected"';}
echo '>Yes, I will be attending</option>
<option value="no"';
if ($rollCall !== "1"){echo 'selected="selected"';}
echo '>No, I won\'t be attending. Please veto my films</option>
</select><br>';
}?>
<p>If you wish to update your settings then please fill in the form below. Make sure you click the Submit button or your changes will not be saved</p>
<table>
<tr>
<td>Event</td><td>Email<br>Notification</td><td>Broswer<br>Notification</td>
</tr>
<tr>
<td>At the start of a roll call</td>
<td><input type="checkbox" name="attending" value="attending" <?php if($attending=="1"){echo "checked=true";}?>></td>
<td><input type="checkbox" name="attendingNotification" value="attendingNotification" <?php if($attendingNotification=="1"){echo "checked=true";}?>></td>
</tr>
<tr>
<td>When voting begins</td>
<td><input type="checkbox" name="voting" value="voting" <?php if($voting=="1"){echo "checked=true";}?>></td>
<td><input type="checkbox" name="votingNotification" value="votingNotification" <?php if($votingNotification=="1"){echo "checked=true";}?>></td>
</tr>
<tr>
<td>An hour before voting closes, if you have not yet voted</td>
<td><input type="checkbox" name="voting60" value="voting60" <?php if($voting60=="1"){echo "checked=true";}?>></td>
<td><input type="checkbox" name="voting60Notification" value="voting60Notification" <?php if($voting60Notification=="1"){echo "checked=true";}?>></td>
</tr>
<tr>
<td>Half an hour before voting closes, if you have not yet voted</td>
<td><input type="checkbox" name="voting30" value="voting30" <?php if($voting30=="1"){echo "checked=true";}?>></td>
<td><input type="checkbox" name="voting30Notification" value="voting30Notification" <?php if($voting30Notification=="1"){echo "checked=true";}?>></td>
</tr>
<tr>
<td>When results are made available</td>
<td><input type="checkbox" name="results" value="results" <?php if($results=="1"){echo "checked=true";}?>></td>
<td><input type="checkbox" name="resultsNotification" value="resultsNotification" <?php if($resultsNotification=="1"){echo "checked=true";}?>></td>
</tr>
</table>
<br>
Which email address would you like to receive these email to?<br>
<input type="text" name="email" value=<?php echo '"'.$email.'"' ?>><br>
<input type="submit" value="Submit">
</address>
</form>
<div class='card' id='#registerCard'>
<p>Name this device and click subscribe to recieve push notifications to your browser</p>
<input type="text" id="#registerName" value="Device Name"></input>
<button id="#registerWorker" type="button">Subscribe!</button>
</div>
<table id='#endpointTable' class='card'>
<tr>
<th colspan=2>Notification Recipients:</th>
</tr>
</table>
<script src="js/settings.js"></script>
</div>
<?php endif; ?>
</div>
</body>
</html>