-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
75 lines (67 loc) · 2.7 KB
/
home.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
session_start();
if(isset($_SESSION['uid'])) {
$title="Home"; include("template/base_header.php");
if ($_REQUEST['paid'] === 1) {
echo "<script>M.toast({html: 'Your payment was processed successfully! The credits have been added to your account.'})</script>";
}
else if ($_REQUEST['paid'] === 0) {
echo "<script>M.toast({html: 'Your payment was unable to be processed.'})</script>";
}
?>
<div class="container" id="index-banner">
<?php if(!$_SESSION['isAdmin']) {?>
<div class="row right">
<a class="btn-floating april-blue center" href="purchaseCredits.php">¤<?php require_once('api.php'); $api = new AprilInstituteScheduler_API(); $api -> connect(); echo $api -> getUserFromUID($_SESSION['uid'])['credits'];?></a>
</div>
<?php }?>
<div class="section col">
<div class="row center">
<h1 class="header center april-orange-text header-font">Welcome, <?php echo $_SESSION['first_name'];?></h1>
</div>
<div class="row center">
<?php
if($_SESSION['isAdmin']) include("getEventsTable_admin.php");
else include("getEventsTable.php"); ?>
</div>
<div class="row center">
<a class="btn-floating btn-large waves-effect waves-light april-orange" href="schedule.php"><i class="material-icons">add</i></a>
</div>
</div>
</div>
<script>
var elem = document.querySelector('.collapsible.expandable');
var instance = M.Collapsible.init(elem, {
accordion: false
});
$(document).ready(function(){
$('#confirm_modal').modal();
});
function setIds(event_id, uid) {
document.getElementById('event_id').value = event_id;
document.getElementById('uid').value = uid;
}
// function changeVirtual() {
<?php /*
$api -> connect();
$api -> updateEvent($row2['id'], null, null, null, $row2['is_virtual'] * -1);
$api -> disconnect();?> */
//} ?>
</script>
<?php
if(isset($_POST['confirm_delete'])) {
$api -> connect();
$api->deleteEvent(htmlentities($_REQUEST['event_id']));
$api -> addCredits(htmlentities($_REQUEST['uid']), 1);
$api -> disconnect();
echo "<script>M.toast({html: 'Successfully deleted event, re-enter page to view'});</script>";
}
else if(isset($_POST['cancel_delete'])){
echo "<script>M.toast({html: 'Successfully cancelled event deletion'});</script>";
}
include("template/base_footer.php");
}
else{
header("Location: index.php");
}
?>