|
|
|
@ -16,7 +16,7 @@ require_once '../work/work.lib.php'; |
|
|
|
|
|
|
|
|
|
api_block_anonymous_users(); |
|
|
|
|
|
|
|
|
|
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery.easy-pie-chart/dist/jquery.easypiechart.js"></script>'; |
|
|
|
|
//$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery.easy-pie-chart/dist/jquery.easypiechart.js"></script>'; |
|
|
|
|
|
|
|
|
|
$export = isset($_GET['export']) ? $_GET['export'] : false; |
|
|
|
|
$sessionId = isset($_GET['sid']) ? (int) $_GET['sid'] : 0; |
|
|
|
@ -28,11 +28,6 @@ if ($courseInfo) { |
|
|
|
|
$courseCode = $courseInfo['code']; |
|
|
|
|
} |
|
|
|
|
$studentId = isset($_GET['student']) ? (int) $_GET['student'] : 0; |
|
|
|
|
|
|
|
|
|
if (empty($studentId)) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$coachId = isset($_GET['id_coach']) ? (int) $_GET['id_coach'] : 0; |
|
|
|
|
$details = isset($_GET['details']) ? Security::remove_XSS($_GET['details']) : ''; |
|
|
|
|
$currentUrl = api_get_self().'?student='.$studentId.'&course='.$courseCode.'&id_session='.$sessionId |
|
|
|
@ -41,53 +36,46 @@ $allowMessages = api_get_configuration_value('private_messages_about_user'); |
|
|
|
|
$workingTime = api_get_configuration_value('considered_working_time'); |
|
|
|
|
$workingTimeEdit = api_get_configuration_value('allow_working_time_edition'); |
|
|
|
|
|
|
|
|
|
// user info |
|
|
|
|
$userInfo = api_get_user_info($studentId); |
|
|
|
|
|
|
|
|
|
if (empty($userInfo)) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$allowToQualify = api_is_allowed_to_edit(null, true) || |
|
|
|
|
api_is_course_tutor() || |
|
|
|
|
api_is_session_admin() || |
|
|
|
|
api_is_drh() || |
|
|
|
|
api_is_student_boss(); |
|
|
|
|
|
|
|
|
|
$allowedToTrackUser = true; |
|
|
|
|
if (!api_is_session_admin() && |
|
|
|
|
!api_is_drh() && |
|
|
|
|
!api_is_student_boss() && |
|
|
|
|
!api_is_platform_admin() |
|
|
|
|
) { |
|
|
|
|
$allowedToTrackUser = |
|
|
|
|
api_is_platform_admin(true, true) || |
|
|
|
|
api_is_allowed_to_edit(null, true) || |
|
|
|
|
api_is_session_admin() || |
|
|
|
|
api_is_drh() || |
|
|
|
|
api_is_student_boss() || |
|
|
|
|
api_is_course_admin() || |
|
|
|
|
api_is_teacher(); |
|
|
|
|
|
|
|
|
|
if (false === $allowedToTrackUser && !empty($courseInfo)) { |
|
|
|
|
if (empty($sessionId)) { |
|
|
|
|
$isTeacher = false; |
|
|
|
|
// Check if is current teacher if set |
|
|
|
|
if (!empty($courseInfo)) { |
|
|
|
|
$isTeacher = CourseManager::isCourseTeacher( |
|
|
|
|
api_get_user_id(), |
|
|
|
|
$courseInfo['real_id'] |
|
|
|
|
$courseInfo['code'] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!api_is_course_admin() && false == $isTeacher) { |
|
|
|
|
if (!empty($courseInfo)) { |
|
|
|
|
if ($isTeacher) { |
|
|
|
|
$allowedToTrackUser = true; |
|
|
|
|
} else { |
|
|
|
|
// Check if the user is tutor of the course |
|
|
|
|
$userCourseStatus = CourseManager::get_tutor_in_course_status( |
|
|
|
|
api_get_user_id(), |
|
|
|
|
$courseInfo['real_id'] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (1 != $userCourseStatus) { |
|
|
|
|
$allowedToTrackUser = false; |
|
|
|
|
} |
|
|
|
|
if ($userCourseStatus == 1) { |
|
|
|
|
$allowedToTrackUser = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$coach = api_is_coach($sessionId, $courseInfo['real_id']); |
|
|
|
|
|
|
|
|
|
if (!$coach) { |
|
|
|
|
$allowedToTrackUser = false; |
|
|
|
|
if ($coach) { |
|
|
|
|
$allowedToTrackUser = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -95,8 +83,13 @@ if (!api_is_session_admin() && |
|
|
|
|
if (!$allowedToTrackUser) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
} |
|
|
|
|
if (empty($studentId)) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$user_info = api_get_user_info($studentId); |
|
|
|
|
|
|
|
|
|
if (api_is_student()) { |
|
|
|
|
if (empty($user_info)) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -396,10 +389,13 @@ switch ($action) { |
|
|
|
|
$tpl->assign('session_title', $sessionInfo['name']); |
|
|
|
|
$tpl->assign('student', $userInfo['complete_name']); |
|
|
|
|
$tpl->assign('table_progress', $table->toHtml()); |
|
|
|
|
$tpl->assign('subtitle', sprintf( |
|
|
|
|
$tpl->assign( |
|
|
|
|
'subtitle', |
|
|
|
|
sprintf( |
|
|
|
|
get_lang('In session %s, you had the following results'), |
|
|
|
|
$sessionInfo['name'] |
|
|
|
|
)); |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
$tpl->assign('table_course', $courseTable); |
|
|
|
|
$content = $tpl->fetch($tpl->get_template('my_space/pdf_export_student.tpl')); |
|
|
|
|
|
|
|
|
@ -524,7 +520,9 @@ switch ($action) { |
|
|
|
|
if ($isBoss || api_is_platform_admin()) { |
|
|
|
|
$subject = get_lang('Legal conditions'); |
|
|
|
|
$content = sprintf( |
|
|
|
|
get_lang('Hello,<br />Your tutor sent you your terms and conditions. You can sign it following this URL: %s'), |
|
|
|
|
get_lang( |
|
|
|
|
'Hello,<br />Your tutor sent you your terms and conditions. You can sign it following this URL: %s' |
|
|
|
|
), |
|
|
|
|
api_get_path(WEB_PATH) |
|
|
|
|
); |
|
|
|
|
MessageManager::send_message_simple($studentId, $subject, $content); |
|
|
|
@ -1000,22 +998,36 @@ if (isset($_GET['action']) and 'all_attendance' == $_GET['action']) { |
|
|
|
|
/** Start date and end date*/ |
|
|
|
|
$defaults['startDate'] = $startDateText; |
|
|
|
|
$defaults['endDate'] = $endDateText; |
|
|
|
|
$form = new FormValidator('all_attendance_list', 'GET', |
|
|
|
|
'myStudents.php?action=all_attendance&student='.$studentId.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq(), |
|
|
|
|
''); |
|
|
|
|
$form = new FormValidator( |
|
|
|
|
'all_attendance_list', |
|
|
|
|
'GET', |
|
|
|
|
'myStudents.php?action=all_attendance&student='.$studentId.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq( |
|
|
|
|
), |
|
|
|
|
'' |
|
|
|
|
); |
|
|
|
|
$form->addElement('html', '<input type="hidden" name="student" value="'.$studentId.'" >'); |
|
|
|
|
$form->addElement('html', '<input type="hidden" name="action" value="all_attendance" >'); |
|
|
|
|
|
|
|
|
|
$form->addDateTimePicker('startDate', [ |
|
|
|
|
$form->addDateTimePicker( |
|
|
|
|
'startDate', |
|
|
|
|
[ |
|
|
|
|
get_lang('ExeStartTime'), |
|
|
|
|
], [ |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
'form_name' => 'attendance_calendar_edit', |
|
|
|
|
], 5); |
|
|
|
|
$form->addDateTimePicker('endDate', [ |
|
|
|
|
], |
|
|
|
|
5 |
|
|
|
|
); |
|
|
|
|
$form->addDateTimePicker( |
|
|
|
|
'endDate', |
|
|
|
|
[ |
|
|
|
|
get_lang('ExeEndTime'), |
|
|
|
|
], [ |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
'form_name' => 'attendance_calendar_edit', |
|
|
|
|
], 5); |
|
|
|
|
], |
|
|
|
|
5 |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form->addButtonSave(get_lang('Submit')); |
|
|
|
|
$form->setDefaults($defaults); |
|
|
|
@ -1039,12 +1051,8 @@ if (isset($_GET['action']) and 'all_attendance' == $_GET['action']) { |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody>'; |
|
|
|
|
// <th>'.get_lang('Professor').'</th> |
|
|
|
|
foreach ($data as $attendanceData => $attendanceSheet) { |
|
|
|
|
/* |
|
|
|
|
* $attendanceData can be in_category or not_category for courses |
|
|
|
|
* */ |
|
|
|
|
|
|
|
|
|
foreach ($data as $attendanceData => $attendanceSheet) { |
|
|
|
|
$totalAttendance = count($attendanceSheet); |
|
|
|
|
for ($i = 0; $i < $totalAttendance; $i++) { |
|
|
|
|
$attendanceWork = $attendanceSheet[$i]; |
|
|
|
@ -1106,7 +1114,11 @@ if (!empty($courseInfo)) { |
|
|
|
|
'chat_connection' => $chat_last_connection, |
|
|
|
|
'documents' => $documents, |
|
|
|
|
'upload_documents' => $uploaded_documents, |
|
|
|
|
'course_first_access' => Tracking::get_first_connection_date_on_the_course($studentId, $courseInfo['real_id'], $sessionId), |
|
|
|
|
'course_first_access' => Tracking::get_first_connection_date_on_the_course( |
|
|
|
|
$studentId, |
|
|
|
|
$courseInfo['real_id'], |
|
|
|
|
$sessionId |
|
|
|
|
), |
|
|
|
|
'course_last_access' => Tracking::get_last_connection_date_on_the_course($studentId, $courseInfo, $sessionId), |
|
|
|
|
'count_access_dates' => Tracking::getNumberOfCourseAccessDates($studentId, $courseInfo['real_id'], $sessionId), |
|
|
|
|
]; |
|
|
|
@ -1276,11 +1288,14 @@ if (empty($details)) { |
|
|
|
|
$attendances_faults_avg = '0/0 (0%)'; |
|
|
|
|
if (!empty($results_faults_avg['total'])) { |
|
|
|
|
if (api_is_drh()) { |
|
|
|
|
$attendances_faults_avg = '<a title="'.get_lang('Go to attendances').'" href="'.api_get_path(WEB_CODE_PATH) |
|
|
|
|
$attendances_faults_avg = Display::url( |
|
|
|
|
$results_faults_avg['faults'].'/'.$results_faults_avg['total'] |
|
|
|
|
.' ('.$results_faults_avg['porcent'].'%)', |
|
|
|
|
api_get_path(WEB_CODE_PATH) |
|
|
|
|
.'attendance/index.php?cidReq='.$courseCodeItem.'&id_session='.$sId.'&student_id=' |
|
|
|
|
.$studentId.'">' |
|
|
|
|
.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' (' |
|
|
|
|
.$results_faults_avg['percent'].'%)</a>'; |
|
|
|
|
.$studentId, |
|
|
|
|
['title' => get_lang('GoAttendance')] |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$attendances_faults_avg = $results_faults_avg['faults'].'/' |
|
|
|
|
.$results_faults_avg['total'] |
|
|
|
@ -1357,8 +1372,11 @@ if (empty($details)) { |
|
|
|
|
$exportCourseList[$sId][] = $csvRow; |
|
|
|
|
|
|
|
|
|
echo '<tr> |
|
|
|
|
<td ><a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'. |
|
|
|
|
$courseInfoItem['title'].'</a></td> |
|
|
|
|
<td> |
|
|
|
|
<a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'. |
|
|
|
|
$courseInfoItem['title'].' |
|
|
|
|
</a> |
|
|
|
|
</td> |
|
|
|
|
<td >'.$time_spent_on_course.'</td> |
|
|
|
|
<td >'.$progress.'</td> |
|
|
|
|
<td >'.$score.'</td> |
|
|
|
@ -1411,29 +1429,51 @@ if (empty($details)) { |
|
|
|
|
$csv_content[] = $csvRow; |
|
|
|
|
$exportCourseList[$sId][] = $csvRow; |
|
|
|
|
$sessionAction = Display::url( |
|
|
|
|
Display::return_icon('export_csv.png', get_lang('CSV export'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
$currentUrl |
|
|
|
|
.'&' |
|
|
|
|
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
$currentUrl.'&' |
|
|
|
|
.http_build_query( |
|
|
|
|
['action' => 'export_one_session_row', 'export' => 'csv', 'session_to_export' => $sId] |
|
|
|
|
[ |
|
|
|
|
'action' => 'export_one_session_row', |
|
|
|
|
'export' => 'csv', |
|
|
|
|
'session_to_export' => $sId, |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
$sessionAction .= Display::url( |
|
|
|
|
Display::return_icon('export_excel.png', get_lang('Excel export'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
$currentUrl |
|
|
|
|
.'&' |
|
|
|
|
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
$currentUrl.'&' |
|
|
|
|
.http_build_query( |
|
|
|
|
['action' => 'export_one_session_row', 'export' => 'xls', 'session_to_export' => $sId] |
|
|
|
|
[ |
|
|
|
|
'action' => 'export_one_session_row', |
|
|
|
|
'export' => 'xls', |
|
|
|
|
'session_to_export' => $sId, |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($sId)) { |
|
|
|
|
$sessionAction .= Display::url( |
|
|
|
|
Display::return_icon('pdf.png', get_lang('Export to PDF'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
$currentUrl |
|
|
|
|
.'&' |
|
|
|
|
Display::return_icon('pdf.png', get_lang('ExportToPDF'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
api_get_path(WEB_CODE_PATH).'mySpace/session.php?' |
|
|
|
|
.http_build_query( |
|
|
|
|
['action' => 'export_to_pdf', 'session_to_export' => $sId] |
|
|
|
|
[ |
|
|
|
|
'student' => $studentId, |
|
|
|
|
'action' => 'export_to_pdf', |
|
|
|
|
'type' => 'attendance', |
|
|
|
|
'session_to_export' => $sId, |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
$sessionAction .= Display::url( |
|
|
|
|
Display::return_icon('pdf.png', get_lang('CertificateOfAchievement'), [], ICON_SIZE_MEDIUM), |
|
|
|
|
api_get_path(WEB_CODE_PATH).'mySpace/session.php?' |
|
|
|
|
.http_build_query( |
|
|
|
|
[ |
|
|
|
|
'student' => $studentId, |
|
|
|
|
'action' => 'export_to_pdf', |
|
|
|
|
'type' => 'achievement', |
|
|
|
|
'session_to_export' => $sId, |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1507,10 +1547,12 @@ if (empty($details)) { |
|
|
|
|
$hookHeaders = $hookLpTracking->notifyTrackingHeader(); |
|
|
|
|
|
|
|
|
|
foreach ($hookHeaders as $hookHeader) { |
|
|
|
|
if (isset($hookHeader['value'])) { |
|
|
|
|
$columnHeadersToExport[] = $hookHeader['value']; |
|
|
|
|
|
|
|
|
|
$headers .= Display::tag('th', $hookHeader['value'], $hookHeader['attrs']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
$csv_content[] = $columnHeadersToExport; |
|
|
|
@ -1518,7 +1560,8 @@ if (empty($details)) { |
|
|
|
|
$categoriesTempList = learnpath::getCategories($courseInfo['real_id']); |
|
|
|
|
$categoryTest = new CLpCategory(); |
|
|
|
|
//$categoryTest->setId(0); |
|
|
|
|
$categoryTest->setName(get_lang('Without category')); |
|
|
|
|
$categoryTest->setId(0); |
|
|
|
|
$categoryTest->setName(get_lang('WithOutCategory')); |
|
|
|
|
$categoryTest->setPosition(0); |
|
|
|
|
$categories = [ |
|
|
|
|
$categoryTest, |
|
|
|
@ -1712,11 +1755,13 @@ if (empty($details)) { |
|
|
|
|
$hookContents = $hookLpTracking->notifyTrackingContent($lp_id, $studentId); |
|
|
|
|
|
|
|
|
|
foreach ($hookContents as $hookContent) { |
|
|
|
|
if (isset($hookContent['value'])) { |
|
|
|
|
$contentToExport[] = strip_tags($hookContent['value']); |
|
|
|
|
|
|
|
|
|
echo Display::tag('td', $hookContent['value'], $hookContent['attrs']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$csv_content[] = $contentToExport; |
|
|
|
|
|
|
|
|
@ -1781,7 +1826,9 @@ if (empty($details)) { |
|
|
|
|
if ($hookQuizTracking) { |
|
|
|
|
$hookHeaders = array_map( |
|
|
|
|
function ($hookHeader) { |
|
|
|
|
if (isset($hookHeader['value'])) { |
|
|
|
|
return Display::tag('th', $hookHeader['value'], $hookHeader['attrs']); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
$hookQuizTracking->notifyTrackingHeader() |
|
|
|
|
); |
|
|
|
@ -1802,7 +1849,9 @@ if (empty($details)) { |
|
|
|
|
/*if ($hookQuizTracking) { |
|
|
|
|
$hookHeaders = array_map( |
|
|
|
|
function ($hookHeader) { |
|
|
|
|
if (isset($hookHeader['value'])) { |
|
|
|
|
return strip_tags($hookHeader['value']); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
$hookQuizTracking->notifyTrackingHeader() |
|
|
|
|
); |
|
|
|
@ -1885,7 +1934,9 @@ if (empty($details)) { |
|
|
|
|
$css_class = 'row_odd'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo '<tr class="'.$css_class.'"><td>'.Exercise::get_formated_title_variable($exercices['title']).'</td>'; |
|
|
|
|
echo '<tr class="'.$css_class.'"><td>'.Exercise::get_formated_title_variable( |
|
|
|
|
$exercices['title'] |
|
|
|
|
).'</td>'; |
|
|
|
|
echo '<td>'; |
|
|
|
|
|
|
|
|
|
if (!empty($lp_name)) { |
|
|
|
@ -1954,9 +2005,11 @@ if (empty($details)) { |
|
|
|
|
|
|
|
|
|
if (!empty($hookContents)) { |
|
|
|
|
foreach ($hookContents as $hookContent) { |
|
|
|
|
if (isset($hookContent['value'])) { |
|
|
|
|
echo Display::tag('td', $hookContent['value'], $hookContent['attrs']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo '</tr>'; |
|
|
|
|
$data_exercices[$i][] = $exercices['title']; |
|
|
|
@ -1974,9 +2027,11 @@ if (empty($details)) { |
|
|
|
|
$csvContentIndex = count($csv_content) - 1; |
|
|
|
|
|
|
|
|
|
foreach ($hookContents as $hookContent) { |
|
|
|
|
if (isset($hookContent['value'])) { |
|
|
|
|
$csv_content[$csvContentIndex][] = strip_tags($hookContent['value']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$i++; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -2070,7 +2125,9 @@ if (empty($details)) { |
|
|
|
|
echo '<td class="text-center"><a href="'.$url.'">('.$documentNumber.')</a></td>'; |
|
|
|
|
$qualification = !empty($results['qualification']) ? $results['qualification'] : '-'; |
|
|
|
|
echo '<td class="text-center">'.$qualification.'</td>'; |
|
|
|
|
echo '<td class="text-center">'.api_convert_and_format_date($results['sent_date_from_db']).' '.$results['expiry_note'].'</td>'; |
|
|
|
|
echo '<td class="text-center">'.api_convert_and_format_date( |
|
|
|
|
$results['sent_date_from_db'] |
|
|
|
|
).' '.$results['expiry_note'].'</td>'; |
|
|
|
|
$assignment = get_work_assignment_by_id($work->id, $courseInfo['real_id']); |
|
|
|
|
|
|
|
|
|
echo '<td class="text-center">'; |
|
|
|
|