function print_user_attendaces($user, $cm, $course = 0, $printing = null) { global $CFG, $COURSE, $DB, $OUTPUT, $mode; echo '<table class="userinfobox">'; if (!$printing) { echo '<tr>'; echo '<td colspan="2" class="generalboxcontent"><div align="right">'; echo $OUTPUT->help_icon('studentview', 'attforblock', get_string('attendancereport', 'attforblock')); //helpbutton(, , , true, false, '', true). //"<a href=\"view.php?id={$cm->id}&student={$user->id}&mode=$mode&printing=yes\" target=\"_blank\">[".get_string('versionforprinting','attforblock').']</a></div></td>'; echo '</tr>'; } // echo '<tr>'; // echo '<th colspan="2"><h2 class="main help"><center>'.get_string('attendancereport','attforblock').helpbutton('studentview', get_string('attendancereport','attforblock'), 'attforblock', true, false, '', true).'</center></h1></th>'; // echo '</tr>'; echo '<tr>'; echo '<td class="left side">'; echo $OUTPUT->user_picture($user, array($COURSE->id)); echo '</td>'; echo '<td class="generalboxcontent">'; echo '<font size="+1"><b>' . fullname($user) . '</b></font>'; if ($course) { echo '<hr />'; $complete = get_attendance($user->id, $course); if ($complete) { print_attendance_table($user, $course); } else { echo get_string('attendancenotstarted', 'attforblock'); } } else { $stqry = "SELECT ats.courseid \n\t\t\t\t\tFROM {attendance_log} al \n\t\t\t\t\tJOIN {attendance_sessions} ats \n\t\t\t\t\t ON al.sessionid = ats.id\n\t\t\t\t WHERE al.studentid = ?\n\t\t\t\tGROUP BY ats.courseid\n\t\t\t\tORDER BY ats.courseid asc"; $recs = $DB->get_records_sql_menu($stqry, array($user->id)); foreach ($recs as $courseid => $value) { echo '<hr />'; echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="list1">'; $nextcourse = $DB->get_record('course', array('id' => $courseid)); echo '<tr><td valign="top"><strong>' . $nextcourse->fullname . '</strong></td>'; echo '<td align="right">'; $complete = get_attendance($user->id, $nextcourse); if ($complete) { print_attendance_table($user, $nextcourse); } else { echo get_string('attendancenotstarted', 'attforblock'); } echo '</td></tr>'; echo '</table>'; } } if ($course) { $stqry = "SELECT ats.sessdate,ats.description,al.statusid,al.remarks \n\t\t\t\t\tFROM {attendance_log} al \n\t\t\t\t\tJOIN {attendance_sessions} ats \n\t\t\t\t\t ON al.sessionid = ats.id\n\t\t\t\t WHERE ats.courseid = ? AND al.studentid = ? \n\t\t\t\tORDER BY ats.sessdate asc"; if ($sessions = $DB->get_records_sql($stqry, array($course->id, $user->id))) { $statuses = get_statuses($course->id); ?> <div id="mod-assignment-submissions"> <table align="left" cellpadding="3" cellspacing="0" class="submissions"> <tr> <th>#</th> <th align="center"><?php print_string('date'); ?> </th> <th align="center"><?php print_string('time'); ?> </th> <th align="center"><?php print_string('description', 'attforblock'); ?> </th> <th align="center"><?php print_string('status', 'attforblock'); ?> </th> <th align="center"><?php print_string('remarks', 'attforblock'); ?> </th> </tr> <?php $i = 1; foreach ($sessions as $key => $session) { ?> <tr> <td align="center"><?php echo $i++; ?> </td> <td><?php echo userdate($session->sessdate, get_string('str_ftimedmyw', 'attforblock')); //userdate($students->sessdate,'%d.%m.%y (%a)', 99, false); ?> </td> <td><?php echo userdate($session->sessdate, get_string('str_ftimehm', 'attforblock')); ?> </td> <td><?php echo empty($session->description) ? get_string('nodescription', 'attforblock') : $session->description; ?> </td> <td><?php echo $statuses[$session->statusid]->description; ?> </td> <td><?php echo $session->remarks; ?> </td> </tr> <?php } echo '</table>'; } else { echo $OUTPUT->heading(get_string('noattforuser', 'attforblock')); } } echo '</td></tr><tr><td> </td></tr></table></div>'; }
function print_cleared_items($user, $cm, $course = 0, $printing = null) { global $CFG, $COURSE, $mode; echo '<table class="userinfobox">'; if (!$printing) { echo '<tr>'; echo '<td colspan="2">' . helpbutton('studentview', get_string('attendancereport', 'attforblock'), 'attforblock', true, false, '', true) . "<a href=\"view.php?id={$cm->id}&student={$user->id}&mode={$mode}&printing=yes\" >[" . get_string('versionforprinting', 'attforblock') . ']</a></td>'; echo '</tr>'; } echo '<tr>'; echo '<td class="left side">'; print_user_picture($user->id, $COURSE->id, $user->picture, true); echo '</td>'; echo '<td class="generalboxcontent">'; echo '<h1><b>' . fullname($user) . '</b></h1>'; if ($course) { echo '<hr />'; $complete = get_attendance($user->id, $course); if ($complete) { print_attendance_table($user, $course); } else { echo get_string('nocleareditems', 'attforblock'); } } else { $stqry = "\n SELECT ats.id,ats.courseid\n FROM {$CFG->prefix}attendance_log al\n JOIN {$CFG->prefix}attendance_sessions ats\n ON al.sessionid = ats.id\n WHERE al.studentid = {$user->id}\n GROUP BY ats.courseid\n ORDER BY ats.courseid asc"; $recs = get_records_sql_menu($stqry); foreach ($recs as $id => $courseid) { echo '<hr />'; echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="list1">'; $nextcourse = get_record('course', 'id', $courseid); echo '<tr><td valign="top"><strong>' . $nextcourse->fullname . '</strong></td>'; echo '<td align="right">'; $complete = get_attendance($user->id, $nextcourse); if ($complete) { print_attendance_table($user, $nextcourse); } else { echo get_string('nocleareditems', 'attforblock'); } echo '</td></tr>'; echo '</table>'; } } if ($course) { $stqry = "\n SELECT ats.sessdate,ats.sessiontitle,ats.subject,ats.teacher,ats.description,al.statusid,al.remarks,al.makeupnotes,al.sicknote\n FROM {$CFG->prefix}attendance_log al\n JOIN {$CFG->prefix}attendance_sessions ats\n ON al.sessionid = ats.id\n WHERE al.studentid = {$user->id} AND al.makeupnotes = 'cleared' AND (al.sicknote = 'cleared' OR al.sicknote = 'notrequired')\n ORDER BY ats.sessdate asc"; if ($sessions = get_records_sql($stqry)) { $statuses = get_statuses($course->id); ?> <div id="mod-assignment-submissions"> <table align="left" cellpadding="3" cellspacing="0" class="submissions" > <tr> <th>#</th> <th align="center"><?php print_string('date'); ?> </th> <th align="center"><?php print_string('time'); ?> </th> <th align="center"><?php print_string('status', 'attforblock'); ?> </th> <th align="center"><?php print_string('sessiontitle', 'attforblock'); ?> </th> <th align="center"><?php print_string('subject', 'attforblock'); ?> </th> <th align="center"><?php print_string('teacher', 'attforblock'); ?> </th> <th align="center"><?php print_string('description', 'attforblock'); ?> </th> <th align="center"><?php print_string('makeupnotes', 'attforblock'); ?> </th> <th align="center"><?php print_string('sicknote', 'attforblock'); ?> </th> <th align="center"><?php print_string('remarks', 'attforblock'); ?> </th> </tr> <?php $i = 1; foreach ($sessions as $key => $session) { ?> <tr> <td align="center"><?php echo $i++; ?> </td> <td><?php echo userdate($session->sessdate, get_string('strftimedmyw', 'attforblock')); //userdate($students->sessdate,'%d.%m.%y (%a)', 99, false); ?> </td> <td><?php echo userdate($session->sessdate, get_string('strftimehm', 'attforblock')); ?> </td> <td><?php echo $statuses($session->statusid)->description; ?> </td> <td><?php echo empty($session->sessiontitle) ? get_string('notitle', 'attforblock') : $session->sessiontitle; ?> </td> <td><?php echo empty($session->subject) ? get_string('nosubject', 'attforblock') : $session->subject; ?> </td> <td><?php echo empty($session->teacher) ? get_string('noteacher', 'attforblock') : $session->teacher; ?> </td> <td><?php echo empty($session->description) ? get_string('nodescription', 'attforblock') : $session->description; ?> </td> <td><?php echo get_string($session->makeupnotes, 'attforblock'); ?> </td> <td><?php echo get_string($session->sicknote, 'attforblock'); ?> </td> <td><?php echo $session->remarks; ?> </td> </tr> <?php } echo '</table>'; } else { print_heading(get_string('nocleareditems', 'attforblock')); } } echo '</td></tr><tr><td> </td></tr></table></div>'; }