-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdashboard.php
200 lines (181 loc) · 6.21 KB
/
dashboard.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
require 'student.php';
# Note that Student.php already contains session_start().
# ALso its constructor contains the 'empty' check to redirect to login if no studentID
# We only need to instantiate it and present its data here in dashboard.
$student = new Student($_SESSION['varStudentID']);
#If we had not redirected at this point, it means student is valid. Let's retireve his info, so w can display it in the HTML.
$student->getGrades();
$student->getAppraisals();
$student->getPayments();
$warningcaption = '<caption class="alert alert-warning"><i>No data yet.</caption>';
?>
<?php
#begin HTML client-side code
include '_head.php';
?>
<div class="well">
<h1 class="pull-left"><span class="glyphicon glyphicon-user"></span> </h1>
<h1> Student ID: <b><?php echo $student->studentID ?></b></h1>
<p><b><?php echo "$student->fullname"; ?></b>
<small><a href="logout.php">(Not you?)</a></small>
</p>
</div>
<div class="container">
<div class="row">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#grade">Grades</a></li>
<li><a data-toggle="tab" href="#appraisal">Appraisal</a></li>
<li><a data-toggle="tab" href="#payment">Payment</a></li>
</ul>
<div class="tab-content">
<div id="grade" class="tab-pane fade in active">
<table class="table table-responsive table-hover table-striped table-bordered">
<thead>
<tr>
<th>School Year</th>
<th>Semester</th>
<th>Subject Name</th>
<th>Subject Title</th>
<th>Subject Grade</th>
<th>Subject Completion</th>
<th>Credits Earned</th>
</tr>
</thead>
<tbody>
<?php
// $pdo = Database::connect();
// $sql = "SELECT o.syear AS vSchoolYear, o.semno AS vSemester,
// c.subjname AS vSubjectName, c.subjtitle AS vSubjectTitle,
// s.subjfgrade as vSubjectGrade, s.subjcomp AS vSubjectCompletion, s.creditearned AS vSubjectEarned
// FROM studidsubjid s, subjcodtbl c, subjectsoffered o
// WHERE studid = '$studID' AND s.subjid = o.subjectid AND o.subjectcode = c.subjcod
// ORDER BY o.syear, o.semno";
// foreach ($pdo->query($sql) as $row) {
// echo '<tr>';
// echo '<td>' . $row['vSchoolYear'];
// echo '<td>' . $row['vSemester'];
// echo '<td>' . $row['vSubjectName'];
// echo '<td>' . $row['vSubjectTitle'];
// echo '<td>' . $row['vSubjectGrade'];
// echo '<td>' . $row['vSubjectCompletion'];
// echo '<td>' . $row['vSubjectEarned'];
// echo '<tr>';
// }
// Database::disconnect();
if(count($student->grades)){
foreach ($student->getGrades() as $row) {
echo "<tr>";
echo "<td>" . $row['vSchoolYear'] . "</td>";
echo "<td>" . $row['vSemester'] . "</td>";
echo "<td>" . $row['vSubjectName'] . "</td>";
echo "<td>" . $row['vSubjectTitle'] . "</td>";
echo "<td>" . $row['vSubjectGrade'] . "</td>";
echo "<td>" . $row['vSubjectCompletion'] . "</td>";
echo "<td>" . $row['vSubjectEarned'] . "</td>";
echo "<tr>";
}
}
else {
echo $warningcaption;
}
?>
</tbody>
</table>
</div>
<div id="appraisal" class="tab-pane fade">
<table class="table table-responsive table-hover table-striped table-bordered">
<thead>
<tr>
<th>School Year</th>
<th>Semester</th>
<th>Fund</th>
<th>Account</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<?php
// $pdo = Database::connect();
// $sql2 = "SELECT studid AS vStudentID, sy AS vSchoolYear, term AS vSemester, fund AS vFund, account AS vAccount, round(amount,2) AS vAmount FROM tblstudappraisal WHERE studid = '$studID' ORDER BY sy, term, fund, account";
// foreach ($pdo->query($sql2) as $row) {
// echo '<tr>';
// echo '<td>' . $row['vSchoolYear'];
// echo '<td>' . $row['vSemester'];
// echo '<td>' . $row['vFund'];
// echo '<td>' . $row['vAccount'];
// echo '<td>' . $row['vAmount'];
// echo '<tr>';
// }
// Database::disconnect();
if(count($student->appraisals)){
foreach ($student->getAppraisals() as $row) {
echo "<tr>";
echo "<td>" . $row['vSchoolYear'] . "</td>";
echo "<td>" . $row['vSemester'] . "</td>";
echo "<td>" . $row['vFund'] . "</td>";
echo "<td>" . $row['vAccount'] . "</td>";
echo "<td>" . $row['vAmount'] . "</td>";
echo "</tr>";
}
}
else {
echo $warningcaption;
}
?>
</tbody>
</table>
</div>
<div id="payment" class="tab-pane fade">
<table class="table table-responsive table-hover table-striped table-bordered">
<thead>
<tr>
<th>School Year</th>
<th>Semester</th>
<th>O.R. Number</th>
<th>Fund</th>
<th>Account</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<?php
// $pdo = Database::connect();
// $sql3 = "Select studid AS vStudentID, sy AS vSchoolYear, term AS vSemester, orno AS vORno, fund AS vFund, account AS vAccount, round(amount,2) as vAmount
// from tblstudpayment where studid = '$studID'
// order by sy, term, fund, account";
// foreach ($pdo->query($sql3) as $row) {
// echo '<tr>';
// echo '<td>' . $row['vSchoolYear'];
// echo '<td>' . $row['vSemester'];
// echo '<td>' . $row['vORno'];
// echo '<td>' . $row['vFund'];
// echo '<td>' . $row['vAccount'];
// echo '<td>' . $row['vAmount'];
// echo '<tr>';
// }
// Database::disconnect();
if(count($student->payments)){
foreach ($student->getPayments() as $row) {
echo "<tr>";
echo "<td>" . $row['vSchoolYear'] . "</td>";
echo "<td>" . $row['vSemester'] . "</td>";
echo "<td>" . $row['vORno'] . "</td>";
echo "<td>" . $row['vFund'] . "</td>";
echo "<td>" . $row['vAccount'] . "</td>";
echo "<td>" . $row['vAmount'] . "</td>";
echo "</tr>";
}
}
else {
echo $warningcaption;
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
require '_footer.php';
?>