Minor - format code

pull/3588/head
Julio Montoya 5 years ago
parent e848a02363
commit c3af73d6ee
  1. 7
      main/admin/user_information.php
  2. 132
      main/mySpace/myStudents.php

@ -40,13 +40,10 @@ if (!api_is_student_boss()) {
} }
} }
$interbreadcrumb[] = ["url" => 'index.php', 'name' => get_lang('PlatformAdmin')]; $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
$interbreadcrumb[] = ["url" => 'user_list.php', 'name' => get_lang('UserList')]; $interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
$userId = $user['user_id']; $userId = $user['user_id'];
$currentUrl = api_get_self().'?user_id='.$userId; $currentUrl = api_get_self().'?user_id='.$userId;
$tool_name = UserManager::formatUserFullName($userEntity); $tool_name = UserManager::formatUserFullName($userEntity);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);

@ -764,6 +764,7 @@ if (Skill::isAllowed($student_id, false)) {
api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $student_id]) api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $student_id])
); );
} }
// All Attendance // All Attendance
if (Skill::isAllowed($student_id, false)) { if (Skill::isAllowed($student_id, false)) {
echo Display::url( echo Display::url(
@ -777,11 +778,7 @@ if (Skill::isAllowed($student_id, false)) {
); );
} }
$permissions = StudentFollowUpPlugin::getPermissions( $permissions = StudentFollowUpPlugin::getPermissions($student_id, api_get_user_id());
$student_id,
api_get_user_id()
);
$isAllow = $permissions['is_allow']; $isAllow = $permissions['is_allow'];
if ($isAllow) { if ($isAllow) {
echo Display::url( echo Display::url(
@ -897,9 +894,7 @@ $csv_content[] = [
$coachs_name = ''; $coachs_name = '';
$session_name = ''; $session_name = '';
$userPicture = UserManager::getUserPicture($user_info['user_id'], USER_IMAGE_SIZE_BIG); $userPicture = UserManager::getUserPicture($user_info['user_id'], USER_IMAGE_SIZE_BIG);
$userGroupManager = new UserGroup(); $userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getNameListByUser( $userGroups = $userGroupManager->getNameListByUser(
$user_info['user_id'], $user_info['user_id'],
@ -1008,9 +1003,8 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
]; ];
} }
if (isset($_GET['action']) and $_GET['action'] == 'all_attendance') { if (isset($_GET['action']) && $_GET['action'] === 'all_attendance') {
/*Display all attendances */ // Variable for all attendance list
// Varible for all attendance list
$startDate = new DateTime(); $startDate = new DateTime();
$startDate = $startDate->modify('-1 week'); $startDate = $startDate->modify('-1 week');
if (isset($_GET['startDate'])) { if (isset($_GET['startDate'])) {
@ -1038,22 +1032,35 @@ if (isset($_GET['action']) and $_GET['action'] == 'all_attendance') {
/** Start date and end date*/ /** Start date and end date*/
$defaults['startDate'] = $startDateText; $defaults['startDate'] = $startDateText;
$defaults['endDate'] = $endDateText; $defaults['endDate'] = $endDateText;
$form = new FormValidator('all_attendance_list', 'GET', $form = new FormValidator(
'all_attendance_list',
'GET',
'myStudents.php?action=all_attendance&student='.$student_id.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq(), 'myStudents.php?action=all_attendance&student='.$student_id.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq(),
''); ''
);
$form->addElement('html', '<input type="hidden" name="student" value="'.$student_id.'" >'); $form->addElement('html', '<input type="hidden" name="student" value="'.$student_id.'" >');
$form->addElement('html', '<input type="hidden" name="action" value="all_attendance" >'); $form->addElement('html', '<input type="hidden" name="action" value="all_attendance" >');
$form->addDateTimePicker('startDate', [ $form->addDateTimePicker(
get_lang('ExeStartTime'), 'startDate',
], [ [
'form_name' => 'attendance_calendar_edit', get_lang('ExeStartTime'),
], 5); ],
$form->addDateTimePicker('endDate', [ [
get_lang('ExeEndTime'), 'form_name' => 'attendance_calendar_edit',
], [ ],
'form_name' => 'attendance_calendar_edit', 5
], 5); );
$form->addDateTimePicker(
'endDate',
[
get_lang('ExeEndTime'),
],
[
'form_name' => 'attendance_calendar_edit',
],
5
);
$form->addButtonSave(get_lang('Submit')); $form->addButtonSave(get_lang('Submit'));
$form->setDefaults($defaults); $form->setDefaults($defaults);
@ -1077,12 +1084,8 @@ if (isset($_GET['action']) and $_GET['action'] == 'all_attendance') {
</tr> </tr>
</thead> </thead>
<tbody>'; <tbody>';
// <th>'.get_lang('Professor').'</th>
foreach ($data as $attendanceData => $attendanceSheet) { foreach ($data as $attendanceData => $attendanceSheet) {
/* // $attendanceData can be in_category or not_category for courses
* $attendanceData can be in_category or not_category for courses
* */
$totalAttendance = count($attendanceSheet); $totalAttendance = count($attendanceSheet);
for ($i = 0; $i < $totalAttendance; $i++) { for ($i = 0; $i < $totalAttendance; $i++) {
$attendanceWork = $attendanceSheet[$i]; $attendanceWork = $attendanceSheet[$i];
@ -1094,26 +1097,22 @@ if (isset($_GET['action']) and $_GET['action'] == 'all_attendance') {
// get session name // get session name
$printSession = "(".$attendanceWork['sessionName'].")"; $printSession = "(".$attendanceWork['sessionName'].")";
} }
// $teacher = isset($attendanceWork['teacher'])?$attendanceWork['teacher']:'';
echo ' echo '
<tr> <tr>
<td>'.$date.'</td> <td>'.$date.'</td>
<td>' <td>'
.'<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH) .'<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH)
.'attendance/index.php?cidReq='.$attendanceWork['courseCode'].'&id_session='.$sId.'&student_id=' .'attendance/index.php?cidReq='.$attendanceWork['courseCode'].'&id_session='.$sId.'&student_id='
.$student_id.'">' .$student_id.'">'
.$attendanceWork['courseTitle']." $printSession ".'</a> .$attendanceWork['courseTitle']." $printSession ".'</a>
</td> </td>
<td>'.$attendanceWork['presence'].'</td> <td>'.$attendanceWork['presence'].'</td>
</tr>'; </tr>';
//<td>'.$teacher.'</td>
} }
} }
echo '</tbody> echo '</tbody>
</table></div>'; </table></div>';
/** Display dates */
/*Display all attendances */
Display::display_footer(); Display::display_footer();
exit(); exit();
} }
@ -1144,7 +1143,11 @@ if (!empty($courseInfo)) {
'chat_connection' => $chat_last_connection, 'chat_connection' => $chat_last_connection,
'documents' => $documents, 'documents' => $documents,
'upload_documents' => $uploaded_documents, 'upload_documents' => $uploaded_documents,
'course_first_access' => Tracking::get_first_connection_date_on_the_course($student_id, $courseInfo['real_id'], $sessionId), 'course_first_access' => Tracking::get_first_connection_date_on_the_course(
$student_id,
$courseInfo['real_id'],
$sessionId
),
'course_last_access' => Tracking::get_last_connection_date_on_the_course($student_id, $courseInfo, $sessionId), 'course_last_access' => Tracking::get_last_connection_date_on_the_course($student_id, $courseInfo, $sessionId),
'count_access_dates' => Tracking::getNumberOfCourseAccessDates($student_id, $courseInfo['real_id'], $sessionId), 'count_access_dates' => Tracking::getNumberOfCourseAccessDates($student_id, $courseInfo['real_id'], $sessionId),
]; ];
@ -1398,14 +1401,16 @@ if (empty($details)) {
$exportCourseList[$sId][] = $csvRow; $exportCourseList[$sId][] = $csvRow;
echo '<tr> echo '<tr>
<td><a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'. <td>
$courseInfoItem['title'].'</a></td> <a href="'.$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'.
$courseInfoItem['title'].'
</a>
</td>
<td>'.$time_spent_on_course.'</td> <td>'.$time_spent_on_course.'</td>
<td>'.$progress.'</td> <td>'.$progress.'</td>
<td>'.$score.'</td> <td>'.$score.'</td>
<td>'.$attendances_faults_avg.'</td> <td>'.$attendances_faults_avg.'</td>
<td>'.$scoretotal_display.'</td>'; <td>'.$scoretotal_display.'</td>';
if (!empty($coachId)) { if (!empty($coachId)) {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'] echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id']
.'&details=true&course='.$courseInfoItem['code'].'&id_coach='.$coachId.'&origin='.$origin .'&details=true&course='.$courseInfoItem['code'].'&id_coach='.$coachId.'&origin='.$origin
@ -1455,13 +1460,13 @@ if (empty($details)) {
$sessionAction = Display::url( $sessionAction = Display::url(
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM), Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
$currentUrl.'&' $currentUrl.'&'
.http_build_query( .http_build_query(
[ [
'action' => 'export_one_session_row', 'action' => 'export_one_session_row',
'export' => 'csv', 'export' => 'csv',
'session_to_export' => $sId, 'session_to_export' => $sId,
] ]
) )
); );
$sessionAction .= Display::url( $sessionAction .= Display::url(
Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM), Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM),
@ -1479,12 +1484,16 @@ if (empty($details)) {
$sessionAction .= Display::url( $sessionAction .= Display::url(
Display::return_icon('pdf.png', get_lang('ExportToPDF'), [], ICON_SIZE_MEDIUM), Display::return_icon('pdf.png', get_lang('ExportToPDF'), [], ICON_SIZE_MEDIUM),
$currentUrl.'&' $currentUrl.'&'
.http_build_query(['action' => 'export_to_pdf', 'type' => 'attendance', 'session_to_export' => $sId]) .http_build_query(
['action' => 'export_to_pdf', 'type' => 'attendance', 'session_to_export' => $sId]
)
); );
$sessionAction .= Display::url( $sessionAction .= Display::url(
Display::return_icon('pdf.png', get_lang('CertificateOfAchievement'), [], ICON_SIZE_MEDIUM), Display::return_icon('pdf.png', get_lang('CertificateOfAchievement'), [], ICON_SIZE_MEDIUM),
$currentUrl.'&' $currentUrl.'&'
.http_build_query(['action' => 'export_to_pdf', 'type' => 'achievement', 'session_to_export' => $sId]) .http_build_query(
['action' => 'export_to_pdf', 'type' => 'achievement', 'session_to_export' => $sId]
)
); );
} }
echo $sessionAction; echo $sessionAction;
@ -1553,7 +1562,6 @@ if (empty($details)) {
} }
$hookLpTracking = HookMyStudentsLpTracking::create(); $hookLpTracking = HookMyStudentsLpTracking::create();
if ($hookLpTracking) { if ($hookLpTracking) {
$hookHeaders = $hookLpTracking->notifyTrackingHeader(); $hookHeaders = $hookLpTracking->notifyTrackingHeader();
@ -1804,7 +1812,6 @@ if (empty($details)) {
} }
echo '</td>'; echo '</td>';
} }
echo '</tr>'; echo '</tr>';
} }
echo '</tbody></table></div>'; echo '</tbody></table></div>';
@ -1826,7 +1833,6 @@ if (empty($details)) {
echo '<th>'.get_lang('AllAttempts').'</th>'; echo '<th>'.get_lang('AllAttempts').'</th>';
$hookQuizTracking = HookMyStudentsQuizTracking::create(); $hookQuizTracking = HookMyStudentsQuizTracking::create();
if ($hookQuizTracking) { if ($hookQuizTracking) {
$hookHeaders = array_map( $hookHeaders = array_map(
function ($hookHeader) { function ($hookHeader) {
@ -1875,7 +1881,6 @@ if (empty($details)) {
active IN (0, 1) active IN (0, 1)
$sessionCondition $sessionCondition
ORDER BY quiz.title ASC "; ORDER BY quiz.title ASC ";
$result_exercices = Database::query($sql); $result_exercices = Database::query($sql);
$i = 0; $i = 0;
if (Database::num_rows($result_exercices) > 0) { if (Database::num_rows($result_exercices) > 0) {
@ -2015,7 +2020,6 @@ if (empty($details)) {
$csv_content[$csvContentIndex][] = strip_tags($hookContent['value']); $csv_content[$csvContentIndex][] = strip_tags($hookContent['value']);
} }
} }
$i++; $i++;
} }
} else { } else {
@ -2035,14 +2039,14 @@ if (empty($details)) {
$courseInfo['real_id'] $courseInfo['real_id']
); );
$survey_done = Display::return_icon( $survey_done = Display::return_icon(
"accept_na.png", 'accept_na.png',
get_lang('NoAnswer'), get_lang('NoAnswer'),
[], [],
ICON_SIZE_SMALL ICON_SIZE_SMALL
); );
if (in_array($student_id, $user_list)) { if (in_array($student_id, $user_list)) {
$survey_done = Display::return_icon( $survey_done = Display::return_icon(
"accept.png", 'accept.png',
get_lang('Answered'), get_lang('Answered'),
[], [],
ICON_SIZE_SMALL ICON_SIZE_SMALL
@ -2100,7 +2104,6 @@ if (empty($details)) {
$showOnce = true; $showOnce = true;
foreach ($work->user_results as $key => $results) { foreach ($work->user_results as $key => $results) {
$resultId = $results['id']; $resultId = $results['id'];
echo '<tr>'; echo '<tr>';
echo '<td>'.$work->title.'</td>'; echo '<td>'.$work->title.'</td>';
$documentNumber = $key + 1; $documentNumber = $key + 1;
@ -2111,7 +2114,6 @@ if (empty($details)) {
echo '<td class="text-center">'.$qualification.'</td>'; 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']); $assignment = get_work_assignment_by_id($work->id, $courseInfo['real_id']);
echo '<td class="text-center">'; echo '<td class="text-center">';
if (!empty($assignment['expires_on'])) { if (!empty($assignment['expires_on'])) {
echo api_convert_and_format_date($assignment['expires_on']); echo api_convert_and_format_date($assignment['expires_on']);
@ -2155,11 +2157,9 @@ if (empty($details)) {
'; ';
$csv_content[] = []; $csv_content[] = [];
$csv_content[] = [ $csv_content[] = [
get_lang('OtherTools'), get_lang('OtherTools'),
]; ];
$csv_content[] = [ $csv_content[] = [
get_lang('Student_publication'), get_lang('Student_publication'),
$nb_assignments, $nb_assignments,

Loading…
Cancel
Save