Example #1
0
                        	$("#save_all_reponse").html("' . addslashes(Display::return_icon('wrong.gif')) . '");
                        }
                    }
                });
                return false;
            }

            function validate_all() {
   				save_now_all("validate");
                return false;
            }
		</script>';
    // Show list of questions.
    $attempt_list = array();
    if (isset($exe_id)) {
        $attempt_list = getAllExerciseEventByExeId($exe_id);
    }
    $remind_list = array();
    if (isset($exercise_stat_info['questions_to_check']) && !empty($exercise_stat_info['questions_to_check'])) {
        $remind_list = explode(',', $exercise_stat_info['questions_to_check']);
    }
    echo '<form id="exercise_form" method="post" action="' . api_get_path(WEB_PUBLIC_PATH) . 'main/exercice/exercise_submit.php?' . api_get_cidreq() . '&autocomplete=off&gradebook=' . $gradebook . "&exerciseId=" . $exerciseId . '" name="frm_exercise" ' . $onsubmit . '>
     <input type="hidden" name="formSent"				value="1" />
     <input type="hidden" name="exerciseId" 			value="' . $exerciseId . '" />
     <input type="hidden" name="num" 					value="' . $current_question . '" id="num_current_id" />
     <input type="hidden" name="exe_id" 				value="' . $exe_id . '" />
     <input type="hidden" name="origin" 				value="' . $origin . '" />
     <input type="hidden" name="learnpath_id" 			value="' . $learnpath_id . '" />
     <input type="hidden" name="learnpath_item_id" 		value="' . $learnpath_item_id . '" />
     <input type="hidden" name="learnpath_item_view_id" value="' . $learnpath_item_view_id . '" />';
    $objExercise->renderQuestionList($questionList, $current_question, $exerciseResult, $attempt_list, $remind_list);
Example #2
0
    $url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() . '&exerciseId=' . $objExercise->id;
    $edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), $url);
}
//Exercise name
$html .= Display::page_subheader($objExercise->name . ' ' . $edit_link);
//Exercise description
if (!empty($objExercise->description)) {
    $html .= Display::div($objExercise->description, array('class' => 'exercise_description'));
}
$extra_params = '';
if (isset($_GET['preview'])) {
    $extra_params = '&preview=1';
}
$attempt_list = null;
if (isset($exercise_stat_info['exe_id'])) {
    $attempt_list = getAllExerciseEventByExeId($exercise_stat_info['exe_id']);
}
//1. Check if this is a new attempt or a previous
$label = get_lang('StartTest');
if ($time_control && !empty($clock_expired_time) || !empty($attempt_list)) {
    $label = get_lang('ContinueTest');
}
if (!empty($attempt_list)) {
    $message = Display::return_message(get_lang('YouTriedToResolveThisExerciseEarlier'));
}
//2. Exercise button
//Notice we not add there the lp_item_view_id because is not already generated
$exercise_url = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_submit.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '&origin=' . $origin . '&learnpath_id=' . $learnpath_id . '&learnpath_item_id=' . $learnpath_item_id . $extra_params;
$exercise_url_button = Display::url($label, $exercise_url, array('class' => 'btn btn-primary btn-large'));
//3. Checking visibility of the exercise (overwrites the exercise button)
$visible_return = $objExercise->is_visible($learnpath_id, $learnpath_item_id, null, false);
Example #3
0
 function getAnsweredQuestionsFromAttempt($exe_id, $objExercise)
 {
     $attempt_list = getAllExerciseEventByExeId($exe_id);
     $exercise_result = array();
     if (!empty($attempt_list)) {
         foreach ($attempt_list as $question_id => $options) {
             foreach ($options as $item) {
                 $question_obj = Question::read($item['question_id']);
                 switch ($question_obj->type) {
                     case FILL_IN_BLANKS:
                         $item['answer'] = $objExercise->fill_in_blank_answer_to_string($item['answer']);
                         break;
                     case HOT_SPOT:
                         //var_dump($item['answer']);
                         break;
                 }
                 if ($item['answer'] != '0' && !empty($item['answer'])) {
                     $exercise_result[] = $question_id;
                     break;
                 }
             }
         }
     }
     return $exercise_result;
 }