-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprofileCourses.php
More file actions
123 lines (81 loc) · 4 KB
/
profileCourses.php
File metadata and controls
123 lines (81 loc) · 4 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
114
115
116
117
118
119
120
121
122
123
<!doctype html>
<html lang="en">
<head>
<?php include("resources/includes/head.inc.php"); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<?php include("resources/includes/header.inc.php"); ?>
<?php include_once("resources/includes/check.php"); ?>
<main>
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 col-12 py-2 py-lg-3 pb-lg-4 bg-light" id="sidenav">
<nav class="nav nav-pills flex-column flex-sm-row flex-lg-column">
<a class="h5 mb-1 text-blue font-weight-bold flex-fill text-lg-right text-center nav-link" href="profileAccount.php">Account</a>
<a class="h5 mb-1 text-blue font-weight-bold flex-fill text-lg-right text-center nav-link" href="profileNotifications.php">Notifications</a>
<a class="h5 mb-1 text-blue font-weight-bold flex-fill text-lg-right text-center nav-link" href="profileCourses.php">Courses</a>
<a class="h5 mb-1 text-blue font-weight-bold flex-fill text-lg-right text-center nav-link" href="profileListings.php">Listings</a>
</nav>
</div>
<div class="col-12 col-lg-10 pt-4 pb-4">
<h4><strong>Courses</strong></h4>
<br>
<h5>You can update your notifications for your registered course by selecting the notifications tab on the left.</h5>
<br>
<?php
include_once("resources/functions/dbconnection.function.php");
$user = $_SESSION['user']['email'];
$result = dbconnection("spSelectUserRegisteredClasses('$user')");
$a = 0;
if(isset($_POST['crn'])){
$rmclass = $_POST['crn'];
dbconnection("spDeleteUserRegisteredClass('$user', '$rmclass')");
}
foreach($result as $row){
echo '<h4 id="' . $a . '" class="' . $a . '"><a href="courseDetails.php?id=' . $row['courseID'] . '"><strong>' . $row['title'] . '</strong></a></h4>';
echo '<div id="' . $a . '" class="' . $a . ' container-fluid row">';
echo '<div class="col-2" style="padding-left: 0;">';
echo '<p>CRN: ' . $row['crn'] . '</p>';
echo '<p>Campus: ' . $row['campus'] . '</p>';
echo '<p>Credits: ' . $row['credits'] . '</p>';
echo '<button onclick=" removeclass(' . $a . ', \'' . $row['crn'] . '\') " class="btn btn-lg bg-orange w-160p"><strong>Remove</strong></button>';
//echo '<form action="#">';
//echo '<button type="submit" class="btn btn-lg bg-orange w-160p"><strong>Book Info</strong></button>';
//echo '</form>';
echo '<br></br></div>';
echo '<div class="col-10">';
echo '<p>Start Date: ' . $row['startDate'] . ' End Date: ' . $row['endDate'] . '</p>';
echo '<p>Meeting Days: ' . $row['meetDays'] . ' | Meeting Times: ' . $row['startTime'] . '-' . $row['endTime'] . '</p>';
echo '<p>Instructor: ' . $row['instructor'] . '</p>';
//echo '<button onclick=" removeclass(' . $a . ', \'' . $row['crn'] . '\') " class="btn btn-lg bg-orange w-160p"><strong>Remove</strong></button>';
echo '</div><br>';
echo '</div>';
$a++;
}
?>
<script>
function removeclass(str, num) {
$.ajax({
url:"profileCourses.php",
type: "POST",
data:{
id: str,
crn: num
},
success:function(data) {
$('.' + str).fadeOut();
},
error:function(data){
alert("Whoops, something went wrong! Please try again.");
}
});
}
</script>
</div>
</div>
</div>
</main>
<?php include("resources/includes/footer.inc.php"); ?>
</body>
</html>