getCategory($questionCategoryId); if (empty($objExercise) || empty($questionCategoryId) || empty($exeId) || empty($categoryObj)) { api_not_allowed(true); } $categoryId = (int) $categoryObj->id; $params = "exe_id=$exeId&exerciseId=$exerciseId&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id&".api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.$params; $validateUrl = api_get_path(WEB_CODE_PATH).'exercise/exercise_question_reminder.php?'. $params.'&category_id='.$categoryId.'&validate=1'; $time_control = false; $clock_expired_time = ExerciseLib::get_session_time_control_key( $objExercise->id, $learnpath_id, $learnpath_item_id ); if (0 != $objExercise->expired_time && !empty($clock_expired_time)) { $time_control = true; } if ($time_control) { // Get time left for expiring time $time_left = api_strtotime($clock_expired_time, 'UTC') - time(); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css'); $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js'); $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js'); $htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js'); $htmlHeadXtra[] = $objExercise->showTimeControlJS($time_left); } $htmlHeadXtra[] = api_get_css_asset('pretty-checkbox/dist/pretty-checkbox.min.css'); $trackInfo = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId); if (empty($trackInfo)) { api_not_allowed(); } $blockedCategories = []; if (isset($trackInfo['blocked_categories']) && !empty($trackInfo['blocked_categories'])) { $blockedCategories = explode(',', $trackInfo['blocked_categories']); } if ($validateCategory) { $blockedCategories[] = $categoryId; $blockedCategories = array_unique($blockedCategories); $value = implode(',', $blockedCategories); $value = Database::escape_string($value); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $sql = "UPDATE $table SET blocked_categories = '$value' WHERE exe_id = $exeId"; Database::query($sql); // Cleaning old remind list. $objExercise->removeAllQuestionToRemind($exeId); api_location($url.'&num='.$currentQuestion); } $nameTools = get_lang('Exercises'); $interbreadcrumb[] = ['url' => 'exercise.php?'.api_get_cidreq(), 'name' => get_lang('Exercises')]; $hideHeaderAndFooter = in_array($origin, ['learnpath', 'embeddable']); if (!$hideHeaderAndFooter) { Display::display_header($nameTools, get_lang('Exercise')); } else { Display::display_reduced_header(); } // I'm in a preview mode as course admin. Display the action menu. if (!$hideHeaderAndFooter && api_is_course_admin()) { $actions = ''. Display::return_icon('back.png', get_lang('GoBackToQuestionList'), [], 32).''; $actions .= ''. Display::return_icon('edit.png', get_lang('ModifyExercise'), [], 32).''; echo Display::toolbarAction('toolbar', [$actions]); } echo Display::page_header($categoryObj->name); echo '
'.Security::remove_XSS($categoryObj->description).'
'; echo ''.get_lang('BlockCategoryExplanation').'
'; $categoryList = Session::read('categoryList'); $disableAllQuestions = ''; $questionList = []; if (isset($categoryList[$categoryId])) { $questionList = $categoryList[$categoryId]; } if ($objExercise->review_answers) { $disableAllQuestions = 'changeOptionStatus(0);'; echo $objExercise->getReminderTable($questionList, $trackInfo); } if ($time_control) { echo $objExercise->returnTimeLeftDiv(); } echo Display::div('', ['id' => 'message']); $previousQuestion = $currentQuestion - 1; $nextQuestion = $currentQuestion + 1; if (!empty($questionList)) { $firstQuestionOfCategory = end($questionList); $dataTracking = explode(',', $trackInfo['data_tracking']); $index = 0; foreach ($dataTracking as $index => $question) { if ($firstQuestionOfCategory == $question) { break; } } $nextQuestion = $index + 1; } echo ''; $exercise_result = $objExercise->getUserAnswersSavedInExercise($exeId); echo '