Minor - Format code - refs BT#12615

pull/2487/head
Angel Fernando Quiroz Campos 8 years ago
parent 87cebd1ed1
commit 09f202ac3b
  1. 111
      main/exercise/exercise_show.php

@ -95,7 +95,8 @@ if (empty($action)) {
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_course_tutor() || api_is_session_admin() || api_is_drh() || api_is_student_boss();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_course_tutor() || api_is_session_admin()
|| api_is_drh() || api_is_student_boss();
if (!empty($sessionId) && !$is_allowedToEdit) {
if (api_is_course_session_coach(
@ -139,7 +140,10 @@ if (isset($_SESSION['gradebook'])) {
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
$interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
@ -294,12 +298,12 @@ $sql = "SELECT attempts.question_id, answer
quizz_rel_questions.exercice_id=stats_exercises.exe_exo_id AND
quizz_rel_questions.question_id = attempts.question_id AND
quizz_rel_questions.c_id=".api_get_course_int_id()."
INNER JOIN " . $TBL_QUESTIONS." AS questions
INNER JOIN ".$TBL_QUESTIONS." AS questions
ON
questions.id=quizz_rel_questions.question_id AND
questions.c_id = " . api_get_course_int_id()."
questions.id = quizz_rel_questions.question_id AND
questions.c_id = ".api_get_course_int_id()."
WHERE
attempts.exe_id = " . intval($id)." $user_restriction
attempts.exe_id = ".intval($id)." $user_restriction
GROUP BY quizz_rel_questions.question_order, attempts.question_id";
$result = Database::query($sql);
$question_list_from_database = array();
@ -526,30 +530,42 @@ foreach ($questionList as $questionId) {
$final_excess = 100;
}
$table_resume = '<table class="data_table">
<tr class="row_odd" >
<td></td>
<td ><b>' . get_lang('Requirements').'</b></td>
<td><b>' . get_lang('YourAnswer').'</b></td>
</tr>
<tr class="row_even">
<td><b>' . get_lang('Overlap').'</b></td>
<td>' . get_lang('Min').' '.$threadhold1.'</td>
<td><div style="color:' . $overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
</tr>
<tr>
<td><b>' . get_lang('Excess').'</b></td>
<td>' . get_lang('Max').' '.$threadhold2.'</td>
<td><div style="color:' . $excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
</tr>
<tr class="row_even">
<td><b>' . get_lang('Missing').'</b></td>
<td>' . get_lang('Max').' '.$threadhold3.'</td>
<td><div style="color:' . $missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
</tr></table>';
$table_resume = '
<table class="data_table">
<tr class="row_odd" >
<td>&nbsp;</td>
<td><b>'.get_lang('Requirements').'</b></td>
<td><b>'.get_lang('YourAnswer').'</b></td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Overlap').'</b></td>
<td>'.get_lang('Min').' '.$threadhold1.'</td>
<td>
<div style="color:'.$overlap_color.'">
'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'
</div>
</td>
</tr>
<tr>
<td><b>'.get_lang('Excess').'</b></td>
<td>'.get_lang('Max').' '.$threadhold2.'</td>
<td>
<div style="color:'.$excess_color.'">
'.(($final_excess < 0) ? 0 : intval($final_excess)).'
</div>
</td>
</tr>
<tr class="row_even">
<td><b>'.get_lang('Missing').'</b></td>
<td>'.get_lang('Max').' '.$threadhold3.'</td>
<td>
<div style="color:'.$missing_color.'">
'.(($final_missing < 0) ? 0 : intval($final_missing)).'
</div>
</td>
</tr>
</table>
';
if ($answerType != HOT_SPOT_DELINEATION) {
$item_list = explode('@@', $destination);
@ -590,7 +606,7 @@ foreach ($questionList as $questionId) {
//showing the score
$queryfree = "SELECT marks from ".$TBL_TRACK_ATTEMPT."
WHERE exe_id = " . intval($id)." AND question_id= ".intval($questionId)."";
WHERE exe_id = ".intval($id)." AND question_id= ".intval($questionId)."";
$resfree = Database::query($queryfree);
$questionScore = Database::result($resfree, 0, "marks");
$totalScore += $questionScore;
@ -659,11 +675,7 @@ foreach ($questionList as $questionId) {
$comnt = null;
if ($show_results) {
if ($is_allowedToEdit &&
$locked == false &&
!api_is_drh() &&
$isCoachAllowedToEdit
) {
if ($is_allowedToEdit && $locked == false && !api_is_drh() && $isCoachAllowedToEdit) {
$isFeedbackAllowed = true;
} elseif (!$isCoachAllowedToEdit && $allowCoachFeedbackExercises) {
$isFeedbackAllowed = true;
@ -710,7 +722,7 @@ foreach ($questionList as $questionId) {
$arrid[] = $questionId;
$feedback_form = new FormValidator('frmcomments'.$questionId, 'post', '');
$feedback_form->addElement('html', '<br>');
$renderer = & $feedback_form->defaultRenderer();
$renderer = &$feedback_form->defaultRenderer();
$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
$renderer->setCustomElementTemplate('<div align="left">{element}</div>');
$comnt = Event::get_comments($id, $questionId);
@ -765,8 +777,16 @@ foreach ($questionList as $questionId) {
}
} else {
$arrmarks[] = $questionId;
echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action="">
<select name="marks" id="marks" style="display:none;"><option>' . $questionScore.'</option></select></form><br/ ></div>';
echo '
<div id="'.$marksname.'" style="display:none">
<form name="marksform_'.$questionId.'" method="post" action="">
<select name="marks" id="marks" style="display:none;">
<option>'.$questionScore.'</option>
</select>
</form>
<br/>
</div>
';
}
} else {
if ($questionScore == -1) {
@ -950,9 +970,12 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
if (empty($track_exercise_info['orig_lp_id']) || empty($track_exercise_info['orig_lp_item_id'])) {
// Default url
$url = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq().'&show_headers=1&id_session='.api_get_session_id();
$url = api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq()
.'&show_headers=1&id_session='.api_get_session_id();
} else {
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=view&item_id='.$track_exercise_info['orig_lp_item_id'].'&lp_id='.$track_exercise_info['orig_lp_id'].'&'.api_get_cidreq().'&id_session='.api_get_session_id();
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=view&item_id='
.$track_exercise_info['orig_lp_item_id'].'&lp_id='.$track_exercise_info['orig_lp_id'].'&'.api_get_cidreq()
.'&id_session='.api_get_session_id();
}
$content = ExerciseLib::getEmailNotification(
@ -974,7 +997,7 @@ if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress
//Came from lpstats in a lp
if ($origin == 'student_progress') { ?>
<button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>">
<?php echo get_lang('Back'); ?>
<?php echo get_lang('Back'); ?>
</button>
<?php
} elseif ($origin == 'myprogress') {
@ -1001,7 +1024,9 @@ if ($origin != 'learnpath') {
'exeId' => $exeId,
'fb_type' => $feedback_type
]);
$href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" ';
$href = ($lp_mode == 'fullscreen')
? ' window.opener.location.href="'.$url.'" '
: ' top.location.href="'.$url.'" ';
echo '<script type="text/javascript">'.$href.'</script>';
// Record the results in the learning path, using the SCORM interface (API)
echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>";

Loading…
Cancel
Save