diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php
index bff5fd92da..04772dd889 100644
--- a/main/exercice/exercice.php
+++ b/main/exercice/exercice.php
@@ -1,5 +1,5 @@
$key_value) {
+ $my_post_info=explode('_',$key_index);
+ $post_content_id[]=$my_post_info[1];
+ if ($my_post_info[0]=='comments') {
+ $comments_exist=true;
+ }
+ }
+ //var_dump($comments_exist);
+ $loop_in_track=($comments_exist===true) ? (count($_POST)/2) : count($_POST);
+ //var_dump($loop_in_track);
+ $k=$post_content_id[0];
+ for ($i=$k;$i<($loop_in_track+$k);$i++) {
+
+ //echo $_POST['marks_'.$i].' y '.$_POST['comments_'.$i].'
';
+
+ $my_marks=$_POST['marks_'.$i];
+ $contain_comments=$_POST['comments_'.$i];
+
+ if (isset($contain_comments)) {
+ $my_comments=$_POST['comments_'.$i];
+ } else {
+ $my_comments='';
+ }
+ $my_questionid=$i;
+ $sql = "SELECT question from $TBL_QUESTIONS WHERE id = '$my_questionid'";
+ $result =api_sql_query($sql, __FILE__, __LINE__);
+ $ques_name = Database::result($result,0,"question");
+
+ $query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '".$my_marks."',teacher_comment = '".$my_comments."'
+ WHERE question_id = '".$my_questionid."'
+ AND exe_id='".$id."'";
+ api_sql_query($query, __FILE__, __LINE__);
+
+ $qry = 'SELECT sum(marks) as tot
+ FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.intval($id).'
+ GROUP BY question_id';
+
+ $res = api_sql_query($qry,__FILE__,__LINE__);
+ $tot = Database::result($res,0,'tot');
+ //updating also the total weight
+ $totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".Database::escape_string($tot)."', exe_weighting = '".Database::escape_string($total_weighting)."'
+ WHERE exe_Id='".Database::escape_string($id)."'";
+
+ api_sql_query($totquery, __FILE__, __LINE__);
- foreach ($_POST as $key => $v) {
+ $recording_changes = 'INSERT INTO '.$TBL_RECORDING.' ' .
+ '(exe_id,
+ question_id,
+ marks,
+ insert_date,
+ author,
+ teacher_comment)
+ VALUES
+ ('."'$id','".$my_questionid."','$my_marks','".date('Y-m-d H:i:s')."','".api_get_user_id()."'".',"'.$my_comments.'")';
+ api_sql_query($recording_changes, __FILE__, __LINE__);
+
+ }
+ $post_content_id=array();
+
+ /*foreach ($_POST as $key => $v) {
$keyexp = explode('_', $key);
$id = Database :: escape_string($id);
@@ -214,7 +276,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
(' . "'$id','" . $my_questionid . "','$v','" . date('Y-m-d H:i:s') . "','" . api_get_user_id() . "'" . ')';
api_sql_query($recording_changes, __FILE__, __LINE__);
}
- }
+ }*/
$qry = 'SELECT DISTINCT question_id, marks
FROM ' . $TBL_TRACK_ATTEMPT . ' where exe_id = ' . intval($id) . '
@@ -1036,7 +1098,7 @@ if ($show == 'test') {
- | + | - | - | + | + | '.$row['question'].' | '; - echo ''.get_lang('NewScore').': '.$row['marks'].' | '; + echo ''.$row['marks'].' | '; if(!empty($row['teacher_comment'])){ - echo ''.get_lang('NewComment').': '.$row['teacher_comment'].' | '; + echo ''.$row['teacher_comment'].' | '; } else { echo ''.get_lang('WithoutComment').' | '; } diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index b7650c1851..7461125758 100644 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -25,7 +25,7 @@ * Exercise class: This class allows to instantiate an object of type Exercise * @package dokeos.exercise * @author Olivier Brouckaert -* @version $Id: exercise.class.php 20092 2009-04-24 21:35:40Z juliomontoya $ +* @version $Id: exercise.class.php 20100 2009-04-24 23:55:22Z iflorespaz $ */ @@ -891,11 +891,11 @@ class Exercise if($type=='full') { // feedback type $radios_feedback = array(); - $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('Feedback'),'0'); + $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('ExerciceAtEndOfTest'),'0'); $radios_feedback[] = FormValidator :: createElement ('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2'); $form -> addGroup($radios_feedback, null, get_lang('FeedbackType')); - $feedback_option[0]=get_lang('Feedback'); + $feedback_option[0]=get_lang('ExerciceAtEndOfTest'); $feedback_option[1]=get_lang('DirectFeedback'); $feedback_option[2]=get_lang('NoFeedback'); diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 00593a8659..ee5eed54d2 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -4,7 +4,7 @@ * * @package dokeos.exercise * @author Julio Montoya Armas Added switchable fill in blank option added -* @version $Id: exercise_show.php 20089 2009-04-24 21:12:54Z cvargas1 $ +* @version $Id: exercise_show.php 20100 2009-04-24 23:55:22Z iflorespaz $ * * @todo remove the debug code and use the general debug library * @todo use the Database:: functions @@ -967,7 +967,7 @@ if($is_allowedToEdit) {
---|