parent
660d728e19
commit
0af873f23d
@ -0,0 +1,65 @@ |
||||
<?php |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
$cidReset = true; |
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
if (!api_get_configuration_value('show_missing_signatures_page') || !api_get_configuration_value('enable_sign_attendance_sheet')) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
api_block_anonymous_users(); |
||||
|
||||
$htmlHeadXtra[] = api_get_asset('signature_pad/signature_pad.umd.js'); |
||||
$htmlHeadXtra[] = '<style> |
||||
#search-user { |
||||
background-image: url("/main/img/icons/22/sn-search.png"); |
||||
background-position: 10px 12px; |
||||
background-repeat: no-repeat; |
||||
width: 100%; |
||||
font-size: 16px; |
||||
padding: 12px 20px 12px 40px; |
||||
border: 1px solid #ddd; |
||||
margin: 12px 0px; |
||||
} |
||||
</style>'; |
||||
|
||||
$userId = api_get_user_id(); |
||||
//$courses = CourseManager::get_courses_list_by_user_id($userId, true); |
||||
|
||||
$tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
||||
$tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
||||
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
||||
|
||||
//$sql = "select * from c_attendance_sheet where user_id = ". $userId . " and presence = 1 and signature IS NULL order by c_id"; |
||||
$sql = "SELECT cal.c_id as courseId, course.title as courseTitle, cal.date_time as date_time, cal.iid as calendarId |
||||
FROM $tbl_attendance_sheet att |
||||
INNER JOIN $tbl_attendance_calendar cal |
||||
ON cal.id = att.attendance_calendar_id |
||||
INNER JOIN $tbl_course course |
||||
ON cal.c_id = course.id |
||||
WHERE |
||||
att.presence = 1 AND |
||||
att.signature IS NULL AND |
||||
att.user_id = '$userId' |
||||
ORDER BY cal.c_id"; |
||||
|
||||
$result = Database::query($sql); |
||||
$calendars = Database::store_result($result); |
||||
$presences = []; |
||||
foreach ($calendars as $calendar) { |
||||
$presences[$calendar['courseId']]['title'] = $calendar['courseTitle']; |
||||
$presences[$calendar['courseId']]['calendars'][$calendar['calendarId']]['buttonToSign'] = "<span class=\"list-data\"><a id=\"sign-".$userId."-".$calendar['calendarId']."-".$calendar['courseId']."\" class=\"btn btn-primary attendance-sign\" href=\"javascript:void(0)\"><em class=\"fa fa-pencil\"></em>".get_lang('Sign')."</a></span>"; |
||||
$presences[$calendar['courseId']]['calendars'][$calendar['calendarId']]['date_time'] = api_convert_and_format_date($calendar['date_time'], null, date_default_timezone_get()); |
||||
} |
||||
|
||||
|
||||
$template = new Template(get_lang('MyMissingSignatures')); |
||||
$template->assign('presences', $presences); |
||||
$content = $template->fetch($template->get_template('/attendance/my_missing_signatures.tpl')); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
|
||||
include_once 'attendance_signature.inc.php'; |
@ -0,0 +1,11 @@ |
||||
<h3> |
||||
{{ 'MyMissingSignatures' | get_lang }} |
||||
</h3> |
||||
{% for presence in presences %} |
||||
<h4>{{ presence.title }}</h4> |
||||
<ul> |
||||
{% for calendar in presence.calendars %} |
||||
<li>{{ calendar.date_time }} {{ calendar.buttonToSign }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% endfor %} |
Loading…
Reference in new issue