<?php
if (!isset($_SESSION['uid'])) {
echo '<meta http-equiv="refresh"' . 'content="0;URL=crc_login.php">';
}
?>
<table width="500">
<tr>
<td valign="top" width="80">
<!--
This is the menu
-->
<br><br>
<?php
include "../common/crc_menu.html";
?>
</td>
<td valign="top" align="left" width="420">
<!--
This is the content
-->
<br><br>
<table class="tbl">
<tr><td valign="top">
<?php
$len = strlen($_SESSION['msg']);
if ($len > 0) {
print('<tr><td class="RED"><br>' . $_SESSION['msg'] . '<br></td></tr>');
}
$data = $_SESSION['teacherattendancegetdata'];
print $_SESSION['name'] . ',';
print '<p>';
if (count($data) > 0) {
print '<p>This page has the attendance for student <b>' . $data[0][1] . ' ' . $data[0][2] . '</b> for the course <a href="crc_handler.php?method=teacher&func=getstudents&scheduleid=' . $data[0][9] . '"><b>' . $data[0][0] . '</b></a>.';
print '</p><p>';
$totalclasses = count($data);
$totalpresent = 0;
$totalabsent = 0;
for ($i = 0; $i < $totalclasses; $i++) {
if ($data[$i][6] == "P") {
$totalpresent = $totalpresent + 1;
} else {
$totalabsent = $totalabsent + 1;
}
}
print '<table>';
print '<tr><td>Total number of classes: </td><td align="right">' . $totalclasses . '</td></tr>';
print '<tr><td>Total number of classes present: </td><td>' . $totalpresent . '</td></tr>';
print '<tr><td>Total number of classes absent: </td><td>' . $totalabsent . '</td></tr>';
print '</table>';
print '<p>';
print '<table width="400" border=0 class="popcal">';
//print '<table border=1>';
print '<tr>';
print ' <th>Date</th>';
print ' <th>Attendance</th>';
if ($_SESSION['roleid'] <= 2) {
if ($data[0][10] == "In Progress") {
print ' <th>Action</th>';
}
}
print '</tr>';
for ($i=0; $i < count($data); $i++) {
print '<tr>';
print '<td>' . $data[$i][3] . '-';
print $data[$i][4] . '-';
print $data[$i][5] . '</td>';
if ($data[$i][6] == "P") {
print '<td align="center" class="message"> Present </td>';
} else {
print '<td align="center" class="error"> Absent </td>';
}
if ($_SESSION['roleid'] <= 2) {
if ($data[0][10] == "In Progress") {
if ($data[$i][6] == "A") {
print '<td><input type="button" value="Mark Present" onclick="javascript:window.location=\'crc_handler.php?method=teacher&func=setattendance&action=p&id=' . $data[$i][7] . '&profileid=' . $data[$i][8] . '&scheduleid=' . $data[$i][9] . '\';" class="button"></td>';
} else {
print '<td><input type="button" value="Mark Absent" onclick="javascript:window.location=\'crc_handler.php?method=teacher&func=setattendance&action=a&id=' . $data[$i][7] . '&profileid=' . $data[$i][8] . '&scheduleid=' . $data[$i][9] . '\';" class="button"></td>';
}
}
}
print '</tr>';
}
print '</table>';
} else {
print '<table class="green"><tr><td>Sorry there are no dates assigned for this student scheduled for this courses offering at this time.</td></tr></table>';
}
print '<p>';
print ' FreeSMS Team';
print ' </p>';
print '</td></tr>';
?>
</table>
</td>
</tr>
<table>