$tool_content .= "<td class='text-center option-btn-cell'>" . action_button(array(array('title' => $langDelete, 'icon' => 'fa-times', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&delete={$announce->id}", 'confirm' => $langConfirmDelete, 'class' => 'delete'), array('title' => $langAttendanceBook, 'icon' => 'fa-plus', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&ins={$announce->id}"), array('title' => $langModify, 'icon' => 'fa-edit', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&modify={$announce->id}"))) . "</td></tr>"; } // end of while $tool_content .= "</table></div></div></div>"; } else { $tool_content .= "<div class='alert alert-warning'>{$langAttendanceNoActMessage1} <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&addActivity=1'>{$langHere}</a> {$langAttendanceNoActMessage3}</div>"; } } } else { //============Student View================== $pageName = $langAttendance; $userID = $uid; $result = Database::get()->queryArray("SELECT * FROM attendance_activities WHERE attendance_id = ?d ORDER BY `DATE` DESC", $attendance_id); $announcementNumber = count($result); if ($announcementNumber > 0) { $tool_content .= "<div class='alert alert-info'>" . userAttendTotal($attendance_id, $userID) . " " . $langAttendanceAbsencesFrom . " " . q($attendance_limit) . " " . $langAttendanceAbsencesFrom2 . " </div>"; $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n <div class='row'><div class='col-sm-12'><div class='table-responsive'>\n <table class='table-default sortable' id='t2'>"; $tool_content .= "<tr><th >{$langTitle}</th><th>{$langAttendanceActivityDate2}</th><th>{$langDescription}</th><th>{$langAttendanceAbsencesYes}</th></tr>"; foreach ($result as $announce) { $content = standard_text_escape($announce->description); $d = strtotime($announce->date); $tool_content .= "<tr><td><b>"; if (empty($announce->title)) { $tool_content .= $langAnnouncementNoTille; } else { $tool_content .= q($announce->title); } $tool_content .= "</b>"; $tool_content .= "</td>" . "<td><div class='smaller'><span class='day'>" . ucfirst(claro_format_locale_date($dateFormatLong, $d)) . "</span> ({$langHour}: " . ucfirst(date('H:i', $d)) . ")</div></td>" . "<td>" . $content . "</td>"; $tool_content .= "<td class='center'>"; //check if the user has attend for this activity
/** * @brief display user presences (student view) * @global type $tool_content * @global type $uid * @global type $langAttendanceStudentFailure * @global type $langGradebookTotalGrade * @global type $langTitle * @global type $langAttendanceActivityDate2 * @global type $langDescription * @global type $langAttendanceAbsencesYes * @global type $langAttendanceAbsencesNo * @global type $langBack * @global type $course_code * @param type $attendance_id */ function student_view_attendance($attendance_id) { global $tool_content, $uid, $langAttendanceAbsencesNo, $langAttendanceAbsencesFrom, $langAttendanceAbsencesFrom2, $langAttendanceStudentFailure, $langTitle, $langAttendanceActivityDate2, $langDescription, $langAttendanceAbsencesYes, $langBack, $course_code; $attendance_limit = get_attendance_limit($attendance_id); //check if there are attendance records for the user, otherwise alert message that there is no input $checkForRecords = Database::get()->querySingle("SELECT COUNT(attendance_book.id) AS count FROM attendance_book, attendance_activities WHERE attendance_book.attendance_activity_id = attendance_activities.id AND uid = ?d AND attendance_activities.attendance_id = ?d", $uid, $attendance_id)->count; $tool_content .= action_bar(array( array( 'title' => $langBack, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label'), )); if (!$checkForRecords) { $tool_content .="<div class='alert alert-warning'>$langAttendanceStudentFailure</div>"; } $result = Database::get()->queryArray("SELECT * FROM attendance_activities WHERE attendance_id = ?d ORDER BY `DATE` DESC", $attendance_id); $results = count($result); if ($results > 0) { if ($checkForRecords) { $range = Database::get()->querySingle("SELECT `limit` FROM attendance WHERE id = ?d", $attendance_id)->limit; $tool_content .= "<div class='alert alert-info'>" . userAttendTotal($attendance_id, $uid) ." ". $langAttendanceAbsencesFrom . " ". q($attendance_limit) . " " . $langAttendanceAbsencesFrom2. " </div>"; } $tool_content .= "<table class='table-default' >"; $tool_content .= "<tr><th>$langTitle</th> <th>$langAttendanceActivityDate2</th> <th>$langDescription</th> <th>$langAttendanceAbsencesYes</th> </tr>"; } if ($result) { foreach ($result as $details) { $content = standard_text_escape($details->description); $tool_content .= "<tr><td><b>"; if (!empty($details->title)) { $tool_content .= q($details->title); } $tool_content .= "</b>"; $tool_content .= "</td>" . "<td><div class='smaller'>" . nice_format($details->date, true, true) . "</div></td>" . "<td>" . $content . "</td>"; $tool_content .= "<td width='70' class='text-center'>"; //check user grade for this activity $sql = Database::get()->querySingle("SELECT attend FROM attendance_book WHERE attendance_activity_id = ?d AND uid = ?d", $details->id, $uid); if ($sql) { $attend = $sql->attend; if ($attend) { $tool_content .= icon('fa-check-circle', $langAttendanceAbsencesYes); } else { $auto_activity = Database::get()->querySingle("SELECT auto FROM attendance_activities WHERE id = ?d", $details->id)->auto; if (!$auto_activity and ($details->date > date("Y-m-d"))) { $tool_content .= icon('fa-question-circle', $langAttendanceStudentFailure); } else { $tool_content .= icon('fa-times-circle', $langAttendanceAbsencesNo); } } } else { $tool_content .= icon('fa-question-circle', $langAttendanceStudentFailure); } $tool_content .= "</td></tr>"; } // end of while } $tool_content .= "</table>"; }