Fixing open question see #5392

skala
Julio Montoya 13 years ago
parent 387bf820bf
commit 0acb42ab1c
  1. 2
      main/exercice/exercise.class.php
  2. 9
      main/exercice/exercise_show.php
  3. 6
      main/inc/lib/events.lib.inc.php
  4. 31
      main/inc/lib/exercise_show_functions.lib.php

@ -2520,7 +2520,7 @@ class Exercise {
}
} elseif($answerType == FREE_ANSWER) {
if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice,0,0);
ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId);
}
} elseif($answerType == ORAL_EXPRESSION) {
// to store the details of open questions in an array to be used in mail

@ -487,8 +487,8 @@ foreach ($questionList as $questionId) {
}
}
//if ($show_results) {
if (0) {
if ($show_results) {
//if (0) {
echo '<table width="100%" border="0" cellspacing="3" cellpadding="0">';
if ($is_allowedToEdit && $locked == false && !api_is_drh() ) {
@ -541,7 +541,6 @@ foreach ($questionList as $questionId) {
}
echo '</td><td>';
}
if ($is_allowedToEdit) {
if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
$marksname = "marksName".$questionId;
@ -558,8 +557,8 @@ foreach ($questionList as $questionId) {
echo '</select>';
echo '</form><br/ ></div>';
if ($questionScore==-1 ) {
$questionScore=0;
echo '<br />'.get_lang('notCorrectedYet');
$questionScore = 0;
echo Display::return_message(get_lang('notCorrectedYet'));
}
} else {
$arrmarks[] = $questionId;

@ -1327,11 +1327,11 @@ function get_all_exercises_from_lp($lp_id, $course_id) {
* @param int $question_id
* @return str the comment
*/
function get_comments($id,$question_id) {
function get_comments($exe_id, $question_id) {
$table_track_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$sql = "SELECT teacher_comment FROM ".$table_track_attempt." where exe_id='".Database::escape_string($exe_id)."' and question_id = '".Database::escape_string($question_id)."' ORDER by question_id";
$sqlres = Database::query($sql);
$comm = Database::result($sqlres,0,"teacher_comment");
$comm = Database::result($sqlres, 0, "teacher_comment");
return $comm;
}

@ -55,34 +55,23 @@ class ExerciseShowFunctions {
* @param int Question ID
* @return void
*/
static function display_free_answer($answer,$id,$questionId) {
static function display_free_answer($answer, $exe_id, $questionId) {
global $feedback_type;
if (empty($id)) {
$comments = get_comments($exe_id, $questionId);
if (!empty($answer)) {
echo '<tr>';
echo Display::tag('td', nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)), array('width'=>'55%'));
echo '</tr>';
echo '<tr><td>';
echo nl2br(Security::remove_XSS($answer, COURSEMANAGERLOWSECURITY));
echo '</td></tr>';
}
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if (empty($comments)) {
echo '<tr>';
echo Display::tag('td', get_lang('notCorrectedYet'), array('width'=>'45%'));
echo Display::tag('td', Display::return_message(get_lang('notCorrectedYet')), array());
echo '</tr>';
} else {
echo '<tr><td>&nbsp;</td></tr>';
}
} else {
echo '<tr>';
if (!empty($answer)) {
echo '<td>';
echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY));
echo '</td>';
}
if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
echo '<td>';
$comm = get_comments($id,$questionId);
echo '</td>';
}
echo '</tr>';
}
}

Loading…
Cancel
Save