|
|
|
@ -1,75 +1,89 @@ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
/** |
|
|
|
|
* Exercise reminder overview |
|
|
|
|
* Then it shows the results on the screen. |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author Julio Montoya Armas switchable fill in blank option added |
|
|
|
|
* Exercise reminder overview |
|
|
|
|
* Then it shows the results on the screen. |
|
|
|
|
* @package chamilo.exercise |
|
|
|
|
* @author Julio Montoya Armas switchable fill in blank option added |
|
|
|
|
*/ |
|
|
|
|
require_once '../inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
$this_section = SECTION_COURSES; |
|
|
|
|
|
|
|
|
|
/* ACCESS RIGHTS */ |
|
|
|
|
/* ACCESS RIGHTS */ |
|
|
|
|
// notice for unauthorized people. |
|
|
|
|
api_protect_course_script(true); |
|
|
|
|
|
|
|
|
|
if($debug>0){error_log('Entered exercise_result.php: '.print_r($_POST,1));} |
|
|
|
|
if ($debug>0) { |
|
|
|
|
error_log('Entered exercise_result.php: '.print_r($_POST, 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// general parameters passed via POST/GET |
|
|
|
|
if ( empty ( $origin ) ) { $origin = Security::remove_XSS($_REQUEST['origin']);} |
|
|
|
|
if ( empty ( $learnpath_id ) ) { $learnpath_id = intval($_REQUEST['learnpath_id']);} |
|
|
|
|
if ( empty ( $learnpath_item_id ) ) { $learnpath_item_id = intval($_REQUEST['learnpath_item_id']);} |
|
|
|
|
if ( empty ( $learnpath_item_view_id ) ) { $learnpath_item_view_id = intval($_REQUEST['learnpath_item_view_id']);} |
|
|
|
|
if (empty ($origin)) { |
|
|
|
|
$origin = Security::remove_XSS($_REQUEST['origin']); |
|
|
|
|
} |
|
|
|
|
if (empty($learnpath_id)) { |
|
|
|
|
$learnpath_id = intval($_REQUEST['learnpath_id']); |
|
|
|
|
} |
|
|
|
|
if (empty($learnpath_item_id)) { |
|
|
|
|
$learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
|
|
|
} |
|
|
|
|
if (empty($learnpath_item_view_id)) { |
|
|
|
|
$learnpath_item_view_id = intval($_REQUEST['learnpath_item_view_id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( empty ($exerciseId)) { $exerciseId = intval($_REQUEST['exerciseId']);} |
|
|
|
|
if (empty($exerciseId)) { |
|
|
|
|
$exerciseId = intval($_REQUEST['exerciseId']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( empty ($objExercise)) { $objExercise = $_SESSION['objExercise'];} |
|
|
|
|
if (empty($objExercise)) { |
|
|
|
|
$objExercise = $_SESSION['objExercise']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$objExercise) { |
|
|
|
|
//Redirect to the exercise overview |
|
|
|
|
//Check if the exe_id exists |
|
|
|
|
header("Location: overview.php?exerciseId=".$exerciseId); |
|
|
|
|
exit; |
|
|
|
|
//Redirect to the exercise overview |
|
|
|
|
//Check if the exe_id exists |
|
|
|
|
header("Location: overview.php?exerciseId=".$exerciseId); |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$time_control = false; |
|
|
|
|
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); |
|
|
|
|
|
|
|
|
|
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) { |
|
|
|
|
$time_control = true; |
|
|
|
|
$time_control = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($time_control) { |
|
|
|
|
// Get time left for exipiring 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'); |
|
|
|
|
$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->show_time_control_js($time_left); |
|
|
|
|
$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_SESSION['exe_id'])) { |
|
|
|
|
$exe_id = intval($_SESSION['exe_id']); |
|
|
|
|
$exe_id = intval($_SESSION['exe_id']); |
|
|
|
|
} |
|
|
|
|
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
|
|
|
|
if (!empty($exercise_stat_info['data_tracking'])) { |
|
|
|
|
$question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
|
|
|
$question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($exercise_stat_info) || empty($question_list)) { |
|
|
|
|
api_not_allowed(); |
|
|
|
|
api_not_allowed(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$nameTools = get_lang('Exercice'); |
|
|
|
|
$interbreadcrumb[] = array("url" => "exercice.php?".api_get_cidreq(), "name" => get_lang('Exercices')); |
|
|
|
|
|
|
|
|
|
if ($origin != 'learnpath') { |
|
|
|
|
//so we are not in learnpath tool |
|
|
|
|
Display::display_header($nameTools,get_lang('Exercise')); |
|
|
|
|
//so we are not in learnpath tool |
|
|
|
|
Display::display_header($nameTools, get_lang('Exercise')); |
|
|
|
|
} else { |
|
|
|
|
Display::display_reduced_header(); |
|
|
|
|
} |
|
|
|
@ -78,10 +92,10 @@ if ($origin != 'learnpath') { |
|
|
|
|
|
|
|
|
|
// I'm in a preview mode as course admin. Display the action menu. |
|
|
|
|
if (api_is_course_admin() && $origin != 'learnpath') { |
|
|
|
|
echo '<div class="actions">'; |
|
|
|
|
echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>'; |
|
|
|
|
echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
echo '<div class="actions">'; |
|
|
|
|
echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>'; |
|
|
|
|
echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>'; |
|
|
|
|
echo '</div>'; |
|
|
|
|
} |
|
|
|
|
echo Display::page_header(get_lang('QuestionsToReview')); |
|
|
|
|
|
|
|
|
@ -163,39 +177,39 @@ $counter = 0; |
|
|
|
|
|
|
|
|
|
foreach ($question_list as $questionId) { |
|
|
|
|
// destruction of the Question object |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
unset($objQuestionTmp); |
|
|
|
|
|
|
|
|
|
// creates a temporary Question object |
|
|
|
|
$objQuestionTmp = Question :: read($questionId); |
|
|
|
|
// creates a temporary Question object |
|
|
|
|
$objQuestionTmp = Question :: read($questionId); |
|
|
|
|
|
|
|
|
|
$quesId = $objQuestionTmp->selectId(); |
|
|
|
|
$check_id = 'remind_list['.$questionId.']'; |
|
|
|
|
$attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); |
|
|
|
|
$quesId = $objQuestionTmp->selectId(); |
|
|
|
|
$check_id = 'remind_list['.$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; |
|
|
|
|
if (in_array($questionId, $remind_list)) { |
|
|
|
|
$attributes['checked'] = 1; |
|
|
|
|
} |
|
|
|
|
$label_attributes = array(); |
|
|
|
|
$label_attributes['class'] = 'checkbox'; |
|
|
|
|
$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'; |
|
|
|
|
$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); |
|
|
|
|
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
|
|
|
} else { |
|
|
|
|
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
|
|
|
} |
|
|
|
|
$counter++; |
|
|
|
|
if ($objExercise->type == ONE_PER_PAGE) { |
|
|
|
|
$question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
|
|
|
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
|
|
|
} else { |
|
|
|
|
$question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
|
|
|
} |
|
|
|
|
//Check if the question doesn't have an answer |
|
|
|
|
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')); |
|
|
|
@ -207,6 +221,6 @@ echo Display::div('', array('class'=>'clear')); |
|
|
|
|
echo Display::div($exercise_actions, array('class'=>'form-actions')); |
|
|
|
|
|
|
|
|
|
if ($origin != 'learnpath') { |
|
|
|
|
// We are not in learnpath tool |
|
|
|
|
Display::display_footer(); |
|
|
|
|
// We are not in learnpath tool |
|
|
|
|
Display::display_footer(); |
|
|
|
|
} |
|
|
|
|