function save_remind_item(obj, question_id) { var action = ""; if ($(obj).is(\':checked\')) { action = "add"; } else { action = "delete"; } $.ajax({ url: "' . api_get_path(WEB_AJAX_PATH) . 'exercise.ajax.php?a=add_question_to_reminder", data: "question_id="+question_id+"&exe_id=' . $exe_id . '&action="+action, success: function(return_value) { }, }); } </script>'; $exercise_result = getAnsweredQuestionsFromAttempt($exe_id, $objExercise); $remind_list = $exercise_stat_info['questions_to_check']; $remind_list = explode(',', $remind_list); $table = '<div class="row">'; $counter = 0; $split_by = 25; //$count_cols = round(count($question_list)/$split_by); $count_cols = 3; $span_size = 12 / $count_cols; $span_class = "span{$span_size}"; $table .= '<div class="' . $span_class . '">'; $table .= '<ul class="nav nav-list">'; $cols = 1; // Loop over all question to show results for each of them, one by one $currentCategory = null; foreach ($question_list as $questionId) {
/** * Gets a list of numbers with links to the questions, like a pagination. If there are categories associated, * the list is organized by categories. * * @param int $exe_id * @param array $questionList * @param array $questionListFlatten * @param array $remindList * @param int $reminder * @param int $remindQuestionId * @param string $url * @param int $current_question * @return string */ public function getProgressPagination($exe_id, $questionList, $questionListFlatten, $remindList, $reminder, $remindQuestionId, $url, $current_question) { $exercise_result = getAnsweredQuestionsFromAttempt($exe_id, $this); $fixedRemindList = array(); if (!empty($remindList)) { foreach ($questionListFlatten as $questionId) { if (in_array($questionId, $remindList)) { $fixedRemindList[] = $questionId; } } } if (isset($reminder) && $reminder == 2) { $values = array_flip($questionListFlatten); if (!empty($current_question)) { $current_question = isset($values[$remindQuestionId]) ? $values[$remindQuestionId] + 1 : $values[$fixedRemindList[0]] + 1; } } $categoryList = Session::read('categoryList'); $categoryList = null; if (empty($categoryList)) { $categoryList = $this->getListOfCategoriesWithQuestionForTest(); Session::write('categoryList', $categoryList); } $conditions = array(); $conditions[] = array("class" => 'answered', 'items' => $exercise_result); $conditions[] = array("class" => 'remind', 'mode' => 'overwrite', 'items' => $remindList); $link = $url . '&num='; $html = '<div class="row" id="exercise_progress_block">'; $html .= '<div class="span10" id="exercise_progress_bars">'; if (!empty($categoryList)) { $html .= $this->progressExercisePaginationBarWithCategories($categoryList, $current_question, $conditions, $link); } else { $html .= $this->progressExercisePaginationBar($questionList, $current_question, $conditions, $link); } $html .= '</div>'; $html .= '<div class="span2" id="exercise_progress_legend"><div class="legend_static">'; $reviewAnswerLabel = null; if ($this->review_answers) { $reviewAnswerLabel = Display::label(sprintf(get_lang('ToReviewZ'), 'c'), 'warning') . '<br />'; } $currentAnswerLabel = null; if (!empty($current_question)) { $currentAnswerLabel = Display::label(sprintf(get_lang('CurrentQuestionZ'), 'd'), 'info'); } // Count the number of answered, unanswered and 'for review' questions - see BT#6523 $numa = count(array_flip(array_merge($exercise_result, $remindList))); $numu = count($questionListFlatten) - $numa; $numr = count($remindList); $html .= Display::label(sprintf(get_lang('AnsweredZ'), 'a'), 'success') . '<br />' . Display::label(sprintf(get_lang('UnansweredZ'), 'b')) . '<br />' . $reviewAnswerLabel . $currentAnswerLabel . '</div><div class="legend_dynamic">' . sprintf(get_lang('AnsweredXYZ'), str_pad($numa, 2, '0', STR_PAD_LEFT), 'a', 'c') . '<br />' . sprintf(get_lang('UnansweredXYZ'), str_pad($numu, 2, '0', STR_PAD_LEFT), 'b') . '<br />' . sprintf(get_lang('ToReviewXYZ'), str_pad($numr, 2, '0', STR_PAD_LEFT), 'c') . '</div>' . '</div>'; $html .= '</div>'; return $html; }