|
|
|
|
@ -28,7 +28,7 @@ $sessionId = api_get_session_id(); |
|
|
|
|
$exercise_id = isset($_REQUEST['exerciseId']) ? intval($_REQUEST['exerciseId']) : 0; |
|
|
|
|
|
|
|
|
|
$objExercise = new Exercise(); |
|
|
|
|
$result = $objExercise->read($exercise_id, false); |
|
|
|
|
$result = $objExercise->read($exercise_id, true); |
|
|
|
|
|
|
|
|
|
if (!$result) { |
|
|
|
|
api_not_allowed(true); |
|
|
|
|
@ -392,7 +392,14 @@ if ($disable && empty($exercise_stat_info)) { |
|
|
|
|
$exercise_url_button = Display::return_message(get_lang('NewExerciseAttemptDisabled')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($exercise_url_button)) { |
|
|
|
|
$isLimitReached = ExerciseLib::isQuestionsLimitPerDayReached( |
|
|
|
|
api_get_user_id(), |
|
|
|
|
count($objExercise->get_validated_question_list()), |
|
|
|
|
api_get_course_int_id(), |
|
|
|
|
api_get_session_id() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($exercise_url_button) && !$isLimitReached) { |
|
|
|
|
$html .= Display::div( |
|
|
|
|
Display::div( |
|
|
|
|
$exercise_url_button, |
|
|
|
|
@ -402,6 +409,16 @@ if (!empty($exercise_url_button)) { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($isLimitReached) { |
|
|
|
|
$maxQuestionsAnswered = (int) api_get_course_setting('quiz_question_limit_per_day'); |
|
|
|
|
|
|
|
|
|
$html .= Display::return_message( |
|
|
|
|
sprintf(get_lang('QuizQuestionsLimitPerDayXReached'), $maxQuestionsAnswered), |
|
|
|
|
'warning', |
|
|
|
|
false |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$html .= Display::tag( |
|
|
|
|
'div', |
|
|
|
|
$table_content, |
|
|
|
|
|