Fixing open question see #5392

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

@ -2520,7 +2520,7 @@ class Exercise {
} }
} elseif($answerType == FREE_ANSWER) { } elseif($answerType == FREE_ANSWER) {
if($origin != 'learnpath') { if($origin != 'learnpath') {
ExerciseShowFunctions::display_free_answer($choice,0,0); ExerciseShowFunctions::display_free_answer($choice, $exeId, $questionId);
} }
} elseif($answerType == ORAL_EXPRESSION) { } elseif($answerType == ORAL_EXPRESSION) {
// to store the details of open questions in an array to be used in mail // 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 ($show_results) {
if (0) { //if (0) {
echo '<table width="100%" border="0" cellspacing="3" cellpadding="0">'; echo '<table width="100%" border="0" cellspacing="3" cellpadding="0">';
if ($is_allowedToEdit && $locked == false && !api_is_drh() ) { if ($is_allowedToEdit && $locked == false && !api_is_drh() ) {
@ -540,8 +540,7 @@ foreach ($questionList as $questionId) {
echo '<div id="question_feedback">'.$comnt.'</div>'; echo '<div id="question_feedback">'.$comnt.'</div>';
} }
echo '</td><td>'; echo '</td><td>';
} }
if ($is_allowedToEdit) { if ($is_allowedToEdit) {
if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) {
$marksname = "marksName".$questionId; $marksname = "marksName".$questionId;
@ -558,8 +557,8 @@ foreach ($questionList as $questionId) {
echo '</select>'; echo '</select>';
echo '</form><br/ ></div>'; echo '</form><br/ ></div>';
if ($questionScore==-1 ) { if ($questionScore==-1 ) {
$questionScore=0; $questionScore = 0;
echo '<br />'.get_lang('notCorrectedYet'); echo Display::return_message(get_lang('notCorrectedYet'));
} }
} else { } else {
$arrmarks[] = $questionId; $arrmarks[] = $questionId;

@ -1327,11 +1327,11 @@ function get_all_exercises_from_lp($lp_id, $course_id) {
* @param int $question_id * @param int $question_id
* @return str the comment * @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); $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); $sqlres = Database::query($sql);
$comm = Database::result($sqlres,0,"teacher_comment"); $comm = Database::result($sqlres, 0, "teacher_comment");
return $comm; return $comm;
} }

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