forked from GibbonEdu/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_notification_ajax_alarm_tickUpdate.php
executable file
·75 lines (65 loc) · 3.18 KB
/
index_notification_ajax_alarm_tickUpdate.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
<?php
/*
Gibbon, Flexible & Open School System
Copyright (C) 2010, Ross Parker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//Gibbon system-wide includes
include './functions.php';
include './config.php';
//New PDO DB connection
$pdo = new Gibbon\sqlConnection();
$connection2 = $pdo->getConnection();
@session_start();
$gibbonAlarmID = $_POST['gibbonAlarmID'];
$gibbonPersonID = $_POST['gibbonPersonID'];
//Proceed!
if ($gibbonAlarmID == '' or $gibbonPersonID == '') { echo "<div class='error'>";
echo __($guid, 'An error has occurred.');
echo '</div>';
} else {
//Check confirmation of alarm
try {
$dataConfirm = array('gibbonAlarmID' => $gibbonAlarmID, 'gibbonAlarmID2' => $gibbonAlarmID, 'gibbonPersonID' => $gibbonPersonID);
$sqlConfirm = 'SELECT surname, preferredName, gibbonAlarmConfirmID, gibbonPerson.gibbonPersonID AS confirmer, gibbonAlarm.gibbonPersonID as sounder FROM gibbonPerson JOIN gibbonAlarm ON (gibbonAlarm.gibbonAlarmID=:gibbonAlarmID) LEFT JOIN gibbonAlarmConfirm ON (gibbonAlarmConfirm.gibbonPersonID=gibbonPerson.gibbonPersonID AND gibbonAlarmConfirm.gibbonAlarmID=:gibbonAlarmID2) WHERE gibbonPerson.gibbonPersonID=:gibbonPersonID';
$resultConfirm = $connection2->prepare($sqlConfirm);
$resultConfirm->execute($dataConfirm);
} catch (PDOException $e) {
echo $e->getMessage();
}
if ($resultConfirm->rowCount() != 1) {
echo "<div class='error'>";
echo __($guid, 'An error has occurred.');
echo '</div>';
} else {
$rowConfirm = $resultConfirm->fetch();
echo "<td style='color: #fff'>";
echo formatName('', $rowConfirm['preferredName'], $rowConfirm['surname'], 'Staff', true, true).'<br/>';
echo '</td>';
echo "<td style='color: #fff'>";
if ($rowConfirm['sounder'] == $rowConfirm['confirmer']) {
echo __($guid, 'NA');
} else {
if ($rowConfirm['gibbonAlarmConfirmID'] != '') {
echo "<img src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/iconTick.png'/> ";
}
}
echo '</td>';
echo "<td style='color: #fff'>";
if ($rowConfirm['sounder'] != $rowConfirm['confirmer']) {
if ($rowConfirm['gibbonAlarmConfirmID'] == '') {
echo "<a target='_parent' href='".$_SESSION[$guid]['absoluteURL'].'/index_notification_ajax_alarmConfirmProcess.php?gibbonPersonID='.$rowConfirm['confirmer']."&gibbonAlarmID=$gibbonAlarmID'><img title='".__($guid, 'Confirm')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/iconTick_light.png'/></a> ";
}
}
echo '</td>';
}
}