|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
/** |
|
|
|
|
* Exercise reminder overview |
|
|
|
|
/** |
|
|
|
|
* Exercise reminder overview |
|
|
|
|
* Then it shows the results on the screen. |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
|
|
|
|
|
@ -47,11 +47,11 @@ if ( empty ($exerciseId)) { $exerciseId = intval($_REQUEST['exerciseId']);} |
|
|
|
|
|
|
|
|
|
if ( empty ($objExercise)) { $objExercise = $_SESSION['objExercise'];} |
|
|
|
|
|
|
|
|
|
if (!$objExercise) { |
|
|
|
|
if (!$objExercise) { |
|
|
|
|
//Redirect to the exercise overview |
|
|
|
|
//Check if the exe_id exists |
|
|
|
|
header("Location: overview.php?exerciseId=".$exerciseId); |
|
|
|
|
exit; |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$time_control = false; |
|
|
|
|
@ -69,7 +69,7 @@ if ($time_control) { |
|
|
|
|
$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->show_time_control_js($time_left); |
|
|
|
|
$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -107,48 +107,48 @@ if (api_is_course_admin() && $origin != 'learnpath') { |
|
|
|
|
echo Display::page_header(get_lang('QuestionsToReview')); |
|
|
|
|
|
|
|
|
|
if ($time_control) { |
|
|
|
|
echo $objExercise->return_time_left_div(); |
|
|
|
|
echo $objExercise->return_time_left_div(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
echo Display::div('', array('id'=>'message')); |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
lp_data = $.param({"learnpath_id": '.$learnpath_id.', "learnpath_item_id" : '.$learnpath_item_id.', "learnpath_item_view_id": '.$learnpath_item_view_id.'}); |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
lp_data = $.param({"learnpath_id": '.$learnpath_id.', "learnpath_item_id" : '.$learnpath_item_id.', "learnpath_item_view_id": '.$learnpath_item_view_id.'}); |
|
|
|
|
|
|
|
|
|
function final_submit() { |
|
|
|
|
//Normal inputs |
|
|
|
|
//Normal inputs |
|
|
|
|
window.location = "exercise_result.php?origin='.$origin.'&exe_id='.$exe_id.'&" + lp_data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function review_questions() { |
|
|
|
|
var is_checked = 1; |
|
|
|
|
$("input[type=checkbox]").each(function () { |
|
|
|
|
if ($(this).attr("checked") == "checked") { |
|
|
|
|
is_checked = 2; |
|
|
|
|
is_checked = 2; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (is_checked == 1) { |
|
|
|
|
$("#message").addClass("warning-message"); |
|
|
|
|
$("#message").html("'.addslashes(get_lang('SelectAQuestionToReview')).'"); |
|
|
|
|
} |
|
|
|
|
window.location = "exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&reminder=2&origin='.$origin.'&" + lp_data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function save_remind_item(obj, question_id) { |
|
|
|
|
var action = ""; |
|
|
|
|
var action = ""; |
|
|
|
|
if ($(obj).is(\':checked\')) { |
|
|
|
|
action = "add"; |
|
|
|
|
} else { |
|
|
|
|
action = "delete"; |
|
|
|
|
} |
|
|
|
|
$.ajax({ |
|
|
|
|
} |
|
|
|
|
$.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) { |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
data: "question_id="+question_id+"&exe_id='.$exe_id.'&action="+action, |
|
|
|
|
success: function(return_value) { |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
@ -162,10 +162,10 @@ $exercise_result = array(); |
|
|
|
|
foreach ($attempt_list as $question_id => $options) { |
|
|
|
|
//echo $question_id.'<br />'; |
|
|
|
|
foreach($options as $item) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$question_obj = Question::read($item['question_id']); |
|
|
|
|
|
|
|
|
|
switch($question_obj->type) { |
|
|
|
|
|
|
|
|
|
switch($question_obj->type) { |
|
|
|
|
case FILL_IN_BLANKS: |
|
|
|
|
$item['answer'] = $objExercise->fill_in_blank_answer_to_string($item['answer']); |
|
|
|
|
break; |
|
|
|
|
@ -173,12 +173,12 @@ foreach ($attempt_list as $question_id => $options) { |
|
|
|
|
//var_dump($item['answer']); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($item['answer'] != '0' && !empty($item['answer'])) { |
|
|
|
|
|
|
|
|
|
if ($item['answer'] != '0' && !empty($item['answer'])) { |
|
|
|
|
$exercise_result[] = $question_id; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
echo Display::label(get_lang('QuestionWithNoAnswer'), 'warning'); |
|
|
|
|
echo '<div class="clear"></div><br />'; |
|
|
|
|
@ -190,26 +190,26 @@ $counter = 0; |
|
|
|
|
foreach ($question_list as $questionId) { |
|
|
|
|
// destruction of the Question object |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// creates a temporary Question object |
|
|
|
|
$objQuestionTmp = Question :: read($questionId); |
|
|
|
|
// initialize question information |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$quesId = $objQuestionTmp->selectId(); |
|
|
|
|
$check_id = 'remind_list['.$questionId.']'; |
|
|
|
|
$attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); |
|
|
|
|
|
|
|
|
|
$attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); |
|
|
|
|
|
|
|
|
|
if (in_array($questionId, $remind_list)) { |
|
|
|
|
$attributes['checked'] = 1; |
|
|
|
|
} |
|
|
|
|
$label_attributes = array(); |
|
|
|
|
$label_attributes['class'] = 'checkbox'; |
|
|
|
|
$label_attributes['for'] = $check_id; |
|
|
|
|
$label_attributes['for'] = $check_id; |
|
|
|
|
$label_attributes['class'] = "checkbox"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$checkbox = Display::input('checkbox', 'remind_list['.$questionId.']', '', $attributes); |
|
|
|
|
$url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$counter++; |
|
|
|
|
if ($objExercise->type == ONE_PER_PAGE) { |
|
|
|
|
$question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
|
|
|
@ -221,14 +221,14 @@ foreach ($question_list as $questionId) { |
|
|
|
|
if (!in_array($questionId, $exercise_result)) { |
|
|
|
|
$question_title = Display::label($question_title, 'warning'); |
|
|
|
|
} |
|
|
|
|
$question_title = Display::tag('label', $checkbox.$question_title, $label_attributes); |
|
|
|
|
$table .= Display::div($question_title, array('class'=>'exercise_reminder_item')); |
|
|
|
|
$question_title = Display::tag('label', $checkbox.$question_title, $label_attributes); |
|
|
|
|
$table .= Display::div($question_title, array('class'=>'exercise_reminder_item')); |
|
|
|
|
} // end foreach() block that loops over all questions |
|
|
|
|
|
|
|
|
|
echo Display::div($table, array('class'=>'span10')); |
|
|
|
|
|
|
|
|
|
$exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-success')); |
|
|
|
|
$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn')); |
|
|
|
|
$exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-warning')); |
|
|
|
|
$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn btn-success')); |
|
|
|
|
|
|
|
|
|
echo Display::div('', array('class'=>'clear')); |
|
|
|
|
echo Display::div($exercise_actions, array('class'=>'form-actions')); |
|
|
|
|
|