Fix redirection, format code.

ofaj
jmontoya 9 years ago
parent a729d6b2f6
commit faf981ba76
  1. 27
      main/exercice/exercise_report.php
  2. 201
      main/exercice/exercise_show.php
  3. 1
      main/inc/lib/api.lib.php
  4. 2
      main/inc/lib/message.lib.php

@ -95,7 +95,7 @@ if (!empty($_REQUEST['export_report']) && $_REQUEST['export_report'] == '1') {
$export->setOnlyBestAttempts($onlyBestAttempts);
switch ($_GET['export_format']) {
case 'xls' :
case 'xls':
$export->exportCompleteReportXLS(
$documentPath,
null,
@ -105,8 +105,8 @@ if (!empty($_REQUEST['export_report']) && $_REQUEST['export_report'] == '1') {
);
exit;
break;
case 'csv' :
default :
case 'csv':
default:
$export->exportCompleteReportCSV(
$documentPath,
null,
@ -130,6 +130,7 @@ if (isset($_REQUEST['comments']) &&
//filtered by post-condition
$id = intval($_GET['exeid']);
$track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id);
if (empty($track_exercise_info)) {
api_not_allowed();
}
@ -137,8 +138,8 @@ if (isset($_REQUEST['comments']) &&
$student_id = $track_exercise_info['exe_user_id'];
$session_id = $track_exercise_info['session_id'];
$lp_id = $track_exercise_info['orig_lp_id'];
//$lp_item_id = $track_exercise_info['orig_lp_item_id'];
$lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
$exerciseId = $track_exercise_info['exe_exo_id'];
$course_info = api_get_course_info();
@ -216,6 +217,7 @@ if (isset($_REQUEST['comments']) &&
$sql = "UPDATE $TBL_TRACK_EXERCISES
SET exe_result = '".floatval($tot)."'
WHERE exe_id = ".$id;
Database::query($sql);
if (isset($_POST['send_notification'])) {
@ -226,9 +228,9 @@ if (isset($_REQUEST['comments']) &&
$message .= '<h3>'.get_lang('CourseName').'</h3><p>'.Security::remove_XSS($course_info['name']).'';
$message .= '<h3>'.get_lang('Exercise').'</h3><p>'.Security::remove_XSS($test);
//Only for exercises not in a LP
// Only for exercises not in a LP
if ($lp_id == 0) {
$message .= '<p>'.get_lang('ClickLinkToViewComment').' <a href="#url#">#url#</a><br />';
$message .= '<p>'.get_lang('ClickLinkToViewComment').' <br /><a href="#url#">#url#</a><br />';
}
$message .= '<p>'.get_lang('Regards').'</p>';
@ -246,23 +248,24 @@ if (isset($_REQUEST['comments']) &&
Display::addFlash(
Display::return_message(get_lang('MessageSent'))
);
header('Location: ' . api_get_path(WEB_PATH));
header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
exit;
}
}
//Updating LP score here
if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
// Updating LP score here
if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))
) {
$sql = "UPDATE $TBL_LP_ITEM_VIEW SET score = '".floatval($tot)."'
WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id;
Database::query($sql);
if ($origin == 'tracking_course') {
//Redirect to the course detail in lp
header('location: exercise.php?course='.Security :: remove_XSS($_GET['course']));
header('location: '.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?course='.Security :: remove_XSS($_GET['course']));
exit;
} else {
//Redirect to the reporting
header('location: ../mySpace/myStudents.php?origin='.$origin.'&student='.$student_id.'&details=true&course='.$course_id.'&session_id='.$session_id);
// Redirect to the reporting
header('Location: '.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?origin='.$origin.'&student='.$student_id.'&details=true&course='.$course_id.'&session_id='.$session_id);
exit;
}
}

@ -231,7 +231,10 @@ if ($show_results || $show_only_total_score) {
$i = $totalScore = $totalWeighting = 0;
if ($debug > 0){error_log("ExerciseResult: ".print_r($exerciseResult,1)); error_log("QuestionList: ".print_r($questionList,1));}
if ($debug > 0) {
error_log("ExerciseResult: ".print_r($exerciseResult, 1));
error_log("QuestionList: ".print_r($questionList, 1));
}
$arrques = array();
$arrans = array();
@ -323,48 +326,138 @@ foreach ($questionList as $questionId) {
}*/
if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
$choice = array();
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
echo '</table>';
} elseif ($answerType == FILL_IN_BLANKS) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == FREE_ANSWER) {
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
$choice = array();
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
echo '</table>';
} elseif ($answerType == FILL_IN_BLANKS) {
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) {
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == FREE_ANSWER) {
$answer = $str;
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == ORAL_EXPRESSION) {
$answer = $str;
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif (in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE])) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == ORAL_EXPRESSION) {
$answer = $str;
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif (in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE])) {
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
} elseif ($answerType == HOT_SPOT) {
if ($show_results) {
echo '<table width="500" border="0"><tr>
<td valign="top" align="center" style="padding-left:0px;" >
<table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">';
}
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg()
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
@ -394,22 +487,33 @@ foreach ($questionList as $questionId) {
}
} else if($answerType == HOT_SPOT_DELINEATION) {
$question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database');
$question_result = $objExercise->manage_answer(
$id,
$questionId,
$choice,
'exercise_show',
array(),
false,
true,
$show_results,
$objExercise->selectPropagateNeg(),
'database'
);
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
$questionScore = $question_result['score'];
$totalScore += $question_result['score'];
$final_overlap = $question_result['extra']['final_overlap'];
$final_missing = $question_result['extra']['final_missing'];
$final_excess = $question_result['extra']['final_excess'];
$final_overlap = $question_result['extra']['final_overlap'];
$final_missing = $question_result['extra']['final_missing'];
$final_excess = $question_result['extra']['final_excess'];
$overlap_color = $question_result['extra']['overlap_color'];
$missing_color = $question_result['extra']['missing_color'];
$excess_color = $question_result['extra']['excess_color'];
$overlap_color = $question_result['extra']['overlap_color'];
$missing_color = $question_result['extra']['missing_color'];
$excess_color = $question_result['extra']['excess_color'];
$threadhold1 = $question_result['extra']['threadhold1'];
$threadhold2 = $question_result['extra']['threadhold2'];
$threadhold3 = $question_result['extra']['threadhold3'];
$threadhold1 = $question_result['extra']['threadhold1'];
$threadhold2 = $question_result['extra']['threadhold2'];
$threadhold3 = $question_result['extra']['threadhold3'];
if ($show_results) {
@ -780,6 +884,7 @@ if ($isFeedbackAllowed) {
if ($origin !='learnpath' && $origin!='student_progress') {
echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>';
?>
<br />
<button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');">
<?php echo get_lang('CorrectTest'); ?>
</button>

@ -7952,7 +7952,6 @@ function api_mail_html(
}
}
}
//$message = str_replace(array("\n\r", "\n", "\r"), '<br />', $message);
$mailView = new Template(null, false, false, false, false, false, false);
$mailView->assign('content', $message);

@ -244,7 +244,7 @@ class MessageManager
format_file_size(api_get_setting('message_max_upload_filesize'))
);
Display::addFlash(Display::return_message($warning , 'warning'));
Display::addFlash(Display::return_message($warning, 'warning'));
return false;
}

Loading…
Cancel
Save