|
|
|
@ -66,6 +66,7 @@ if ($origin != 'learnpath') { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$html = ''; |
|
|
|
|
$message = ''; |
|
|
|
|
|
|
|
|
|
$is_allowed_to_edit = api_is_allowed_to_edit(null,true); |
|
|
|
|
$edit_link = ''; |
|
|
|
@ -90,41 +91,37 @@ if (isset($exercise_stat_info['exe_id'])) { |
|
|
|
|
$attempt_list = get_all_exercise_event_by_exe_id($exercise_stat_info['exe_id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//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; |
|
|
|
|
//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); |
|
|
|
|
|
|
|
|
|
//Exercise is not visible remove the button |
|
|
|
|
if ($visible_return['value'] == false) { |
|
|
|
|
$exercise_url = api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id; |
|
|
|
|
$exercise_url_button = $visible_return['message']; |
|
|
|
|
if ($is_allowed_to_edit) { |
|
|
|
|
$message = Display::return_message(get_lang('ThisItemIsInvisibleForStudentsButYouHaveAccessAsTeacher'), 'warning'); |
|
|
|
|
} else { |
|
|
|
|
$message = $visible_return['message']; |
|
|
|
|
$exercise_url_button = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Message "you already try this exercise" |
|
|
|
|
|
|
|
|
|
$message = ''; |
|
|
|
|
if (!empty($attempt_list)) { |
|
|
|
|
$message = Display::return_message(get_lang('YouTriedToResolveThisExerciseEarlier')); |
|
|
|
|
$label = get_lang('ContinueTest'); |
|
|
|
|
} |
|
|
|
|
$html .= $message; |
|
|
|
|
|
|
|
|
|
$attempts = get_exercise_results_by_user(api_get_user_id(), $objExercise->id, api_get_course_id(), api_get_session_id(), $learnpath_id, $learnpath_item_id, 'desc'); |
|
|
|
|
$counter = count($attempts); |
|
|
|
|
|
|
|
|
|
$options = ''; |
|
|
|
|
if (!empty($exercise_url_button)) { |
|
|
|
|
$options .= $exercise_url_button; |
|
|
|
|
} |
|
|
|
|
//$options = Display::div($options, array('class'=>'offset4 span4')); |
|
|
|
|
|
|
|
|
|
$my_attempt_array = array(); |
|
|
|
|
$table_content = ''; |
|
|
|
|
|
|
|
|
@ -207,15 +204,21 @@ if ($objExercise->selectAttempts()) { |
|
|
|
|
} else { |
|
|
|
|
$attempt_message = Display::return_message($attempt_message, 'info'); |
|
|
|
|
} |
|
|
|
|
$options.= Display::div($attempt_message, array('class'=>"offset2 span2")); |
|
|
|
|
if ($visible_return['value'] == true) { |
|
|
|
|
$message .= $attempt_message; |
|
|
|
|
} |
|
|
|
|
//$options.= $attempt_message; //Display::div($attempt_message, array('class'=>"offset2 span2")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($time_control) { |
|
|
|
|
$html.= '<div align="left" id="wrapper-clock"><div id="square" class="rounded"><div id="text-content" align="center" class="count_down"></div></div></div>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$html.= Display::div(Display::div($options, array('class'=>'exercise_overview_options span12')), array('class'=>' row')); |
|
|
|
|
$html .= $message; |
|
|
|
|
|
|
|
|
|
if (!empty($exercise_url_button)) { |
|
|
|
|
$html .= Display::div(Display::div($exercise_url_button, array('class'=>'exercise_overview_options span12')), array('class'=>' row')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$html .= $table_content; |
|
|
|
|
|
|
|
|
|