|
|
@ -8566,8 +8566,10 @@ class Exercise |
|
|
|
$session_img = null; |
|
|
|
$session_img = null; |
|
|
|
//$session_img = api_get_session_image($row['session_id'], $userInfo['status']); |
|
|
|
//$session_img = api_get_session_image($row['session_id'], $userInfo['status']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$startTime = $exerciseEntity->getStartTime(); |
|
|
|
|
|
|
|
$endTime = $exerciseEntity->getEndTime(); |
|
|
|
$time_limits = false; |
|
|
|
$time_limits = false; |
|
|
|
if (!empty($row['start_time']) || !empty($row['end_time'])) { |
|
|
|
if (!empty($startTime) || !empty($endTime)) { |
|
|
|
$time_limits = true; |
|
|
|
$time_limits = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -8575,15 +8577,14 @@ class Exercise |
|
|
|
if ($time_limits) { |
|
|
|
if ($time_limits) { |
|
|
|
// check if start time |
|
|
|
// check if start time |
|
|
|
$start_time = false; |
|
|
|
$start_time = false; |
|
|
|
if (!empty($row['start_time'])) { |
|
|
|
if (!empty($startTime)) { |
|
|
|
$start_time = api_strtotime($row['start_time'], 'UTC'); |
|
|
|
$start_time = api_strtotime($startTime->format('Y-m-d H:i:s'), 'UTC'); |
|
|
|
} |
|
|
|
} |
|
|
|
$end_time = false; |
|
|
|
$end_time = false; |
|
|
|
if (!empty($row['end_time'])) { |
|
|
|
if (!empty($endTime)) { |
|
|
|
$end_time = api_strtotime($row['end_time'], 'UTC'); |
|
|
|
$end_time = api_strtotime($endTime->format('Y-m-d H:i:s'), 'UTC'); |
|
|
|
} |
|
|
|
} |
|
|
|
$now = time(); |
|
|
|
$now = time(); |
|
|
|
|
|
|
|
|
|
|
|
//If both "clocks" are enable |
|
|
|
//If both "clocks" are enable |
|
|
|
if ($start_time && $end_time) { |
|
|
|
if ($start_time && $end_time) { |
|
|
|
if ($now > $start_time && $end_time > $now) { |
|
|
|
if ($now > $start_time && $end_time > $now) { |
|
|
@ -8609,7 +8610,7 @@ class Exercise |
|
|
|
if (isset($_custom['exercises_hidden_when_no_start_date']) && |
|
|
|
if (isset($_custom['exercises_hidden_when_no_start_date']) && |
|
|
|
$_custom['exercises_hidden_when_no_start_date'] |
|
|
|
$_custom['exercises_hidden_when_no_start_date'] |
|
|
|
) { |
|
|
|
) { |
|
|
|
if (empty($row['start_time'])) { |
|
|
|
if (empty($startTime)) { |
|
|
|
$time_limits = true; |
|
|
|
$time_limits = true; |
|
|
|
$is_actived_time = false; |
|
|
|
$is_actived_time = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -8966,14 +8967,9 @@ class Exercise |
|
|
|
$currentRow['count_questions'] = $number_of_questions; |
|
|
|
$currentRow['count_questions'] = $number_of_questions; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Student only. |
|
|
|
// Student only. |
|
|
|
$visibility = api_get_item_visibility( |
|
|
|
$visibility = $exerciseEntity->isVisible($course, null); |
|
|
|
$courseInfo, |
|
|
|
|
|
|
|
TOOL_QUIZ, |
|
|
|
|
|
|
|
$exerciseId, |
|
|
|
|
|
|
|
$sessionId |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($visibility == 0) { |
|
|
|
if (false === $visibility) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -8982,8 +8978,6 @@ class Exercise |
|
|
|
|
|
|
|
|
|
|
|
// Link of the exercise. |
|
|
|
// Link of the exercise. |
|
|
|
$currentRow['title'] = $url.' '.$session_img; |
|
|
|
$currentRow['title'] = $url.' '.$session_img; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This query might be improved later on by ordering by the new "tms" field rather than by exe_id |
|
|
|
// This query might be improved later on by ordering by the new "tms" field rather than by exe_id |
|
|
|
// Don't remove this marker: note-query-exe-results |
|
|
|
// Don't remove this marker: note-query-exe-results |
|
|
|
$sql = "SELECT * FROM $TBL_TRACK_EXERCISES |
|
|
|
$sql = "SELECT * FROM $TBL_TRACK_EXERCISES |
|
|
@ -9001,8 +8995,7 @@ class Exercise |
|
|
|
$num = Database :: num_rows($qryres); |
|
|
|
$num = Database :: num_rows($qryres); |
|
|
|
|
|
|
|
|
|
|
|
// Hide the results. |
|
|
|
// Hide the results. |
|
|
|
$my_result_disabled = $row['results_disabled']; |
|
|
|
$my_result_disabled = $exerciseEntity->getResultsDisabled(); |
|
|
|
|
|
|
|
|
|
|
|
$attempt_text = '-'; |
|
|
|
$attempt_text = '-'; |
|
|
|
// Time limits are on |
|
|
|
// Time limits are on |
|
|
|
if ($time_limits) { |
|
|
|
if ($time_limits) { |
|
|
@ -9023,14 +9016,14 @@ class Exercise |
|
|
|
// More than one attempt |
|
|
|
// More than one attempt |
|
|
|
if ($num > 0) { |
|
|
|
if ($num > 0) { |
|
|
|
$row_track = Database :: fetch_array($qryres); |
|
|
|
$row_track = Database :: fetch_array($qryres); |
|
|
|
$attempt_text = get_lang('LatestAttempt').' : '; |
|
|
|
$attempt_text = get_lang('Latest attempt').' : '; |
|
|
|
$attempt_text .= ExerciseLib::show_score( |
|
|
|
$attempt_text .= ExerciseLib::show_score( |
|
|
|
$row_track['exe_result'], |
|
|
|
$row_track['exe_result'], |
|
|
|
$row_track['exe_weighting'] |
|
|
|
$row_track['exe_weighting'] |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//No attempts |
|
|
|
//No attempts |
|
|
|
$attempt_text = get_lang('NotAttempted'); |
|
|
|
$attempt_text = get_lang('Not attempted'); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$attempt_text = '-'; |
|
|
|
$attempt_text = '-'; |
|
|
@ -9038,37 +9031,34 @@ class Exercise |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// Quiz not ready due to time limits |
|
|
|
// Quiz not ready due to time limits |
|
|
|
//@todo use the is_visible function |
|
|
|
//@todo use the is_visible function |
|
|
|
if (!empty($row['start_time']) && !empty($row['end_time'])) { |
|
|
|
if (!empty($startTime) && !empty($endTime)) { |
|
|
|
$today = time(); |
|
|
|
$today = time(); |
|
|
|
$start_time = api_strtotime($row['start_time'], 'UTC'); |
|
|
|
|
|
|
|
$end_time = api_strtotime($row['end_time'], 'UTC'); |
|
|
|
|
|
|
|
if ($today < $start_time) { |
|
|
|
if ($today < $start_time) { |
|
|
|
$attempt_text = sprintf( |
|
|
|
$attempt_text = sprintf( |
|
|
|
get_lang('ExerciseWillBeActivatedFromXToY'), |
|
|
|
get_lang('ExerciseWillBeActivatedFromXToY'), |
|
|
|
api_convert_and_format_date($row['start_time']), |
|
|
|
api_convert_and_format_date($start_time), |
|
|
|
api_convert_and_format_date($row['end_time']) |
|
|
|
api_convert_and_format_date($end_time) |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if ($today > $end_time) { |
|
|
|
if ($today > $end_time) { |
|
|
|
$attempt_text = sprintf( |
|
|
|
$attempt_text = sprintf( |
|
|
|
get_lang('ExerciseWasActivatedFromXToY'), |
|
|
|
get_lang('ExerciseWasActivatedFromXToY'), |
|
|
|
api_convert_and_format_date($row['start_time']), |
|
|
|
api_convert_and_format_date($start_time), |
|
|
|
api_convert_and_format_date($row['end_time']) |
|
|
|
api_convert_and_format_date($end_time) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//$attempt_text = get_lang('ExamNotAvailableAtThisTime'); |
|
|
|
if (!empty($startTime)) { |
|
|
|
if (!empty($row['start_time'])) { |
|
|
|
|
|
|
|
$attempt_text = sprintf( |
|
|
|
$attempt_text = sprintf( |
|
|
|
get_lang('ExerciseAvailableFromX'), |
|
|
|
get_lang('ExerciseAvailableFromX'), |
|
|
|
api_convert_and_format_date($row['start_time']) |
|
|
|
api_convert_and_format_date($start_time) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!empty($row['end_time'])) { |
|
|
|
if (!empty($endTime)) { |
|
|
|
$attempt_text = sprintf( |
|
|
|
$attempt_text = sprintf( |
|
|
|
get_lang('ExerciseAvailableUntilX'), |
|
|
|
get_lang('ExerciseAvailableUntilX'), |
|
|
|
api_convert_and_format_date($row['end_time']) |
|
|
|
api_convert_and_format_date($end_time) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -9095,14 +9085,10 @@ class Exercise |
|
|
|
$row_track['exe_weighting'] |
|
|
|
$row_track['exe_weighting'] |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$attempt_text = get_lang('NotAttempted'); |
|
|
|
$attempt_text = get_lang('Not attempted'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($returnData) { |
|
|
|
|
|
|
|
$attempt_text = $num; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$currentRow['attempt'] = $attempt_text; |
|
|
|
$currentRow['attempt'] = $attempt_text; |
|
|
@ -9130,14 +9116,6 @@ class Exercise |
|
|
|
$currentRow[] = '<a href="exercise_report.php?'.api_get_cidreq().'&id='.$exerciseId.'">'. |
|
|
|
$currentRow[] = '<a href="exercise_report.php?'.api_get_cidreq().'&id='.$exerciseId.'">'. |
|
|
|
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
|
|
|
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($returnData) { |
|
|
|
|
|
|
|
$currentRow['id'] = $exercise->id; |
|
|
|
|
|
|
|
$currentRow['url'] = $webPath.'exercise/overview.php?' |
|
|
|
|
|
|
|
.api_get_cidreq_params($courseInfo['code'], $sessionId).'&' |
|
|
|
|
|
|
|
."$mylpid$mylpitemid&id={$exerciseId}"; |
|
|
|
|
|
|
|
$currentRow['name'] = $currentRow[0]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
$tableRows[] = $currentRow; |
|
|
|
$tableRows[] = $currentRow; |
|
|
|
} |
|
|
|
} |
|
|
@ -9164,8 +9142,8 @@ class Exercise |
|
|
|
$table->setTableData($tableRows); |
|
|
|
$table->setTableData($tableRows); |
|
|
|
$table->setTotalNumberOfItems($total); |
|
|
|
$table->setTotalNumberOfItems($total); |
|
|
|
$table->set_additional_parameters([ |
|
|
|
$table->set_additional_parameters([ |
|
|
|
'cidReq' => api_get_course_id(), |
|
|
|
'cid' => api_get_course_int_id(), |
|
|
|
'id_session' => api_get_session_id(), |
|
|
|
'sid' => api_get_session_id(), |
|
|
|
'category_id' => $categoryId, |
|
|
|
'category_id' => $categoryId, |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
@ -9181,10 +9159,10 @@ class Exercise |
|
|
|
if ($is_allowedToEdit) { |
|
|
|
if ($is_allowedToEdit) { |
|
|
|
$table->set_header($i++, '', false, 'width="18px"'); |
|
|
|
$table->set_header($i++, '', false, 'width="18px"'); |
|
|
|
} |
|
|
|
} |
|
|
|
$table->set_header($i++, get_lang('ExerciseName'), false); |
|
|
|
$table->set_header($i++, get_lang('Test name'), false); |
|
|
|
|
|
|
|
|
|
|
|
if ($is_allowedToEdit) { |
|
|
|
if ($is_allowedToEdit) { |
|
|
|
$table->set_header($i++, get_lang('QuantityQuestions'), false); |
|
|
|
$table->set_header($i++, get_lang('Questions'), false); |
|
|
|
$table->set_header($i++, get_lang('Actions'), false); |
|
|
|
$table->set_header($i++, get_lang('Actions'), false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$table->set_header($i++, get_lang('Status'), false); |
|
|
|
$table->set_header($i++, get_lang('Status'), false); |
|
|
|