Эх сурвалжийг харах

[svn r17311] logic changes - fixed some bugs founded in exercises (partial FS#3249)

Cristian Fasanando 16 жил өмнө
parent
commit
cab03b0561

+ 7 - 3
main/exercice/exercice_history.php

@@ -62,6 +62,7 @@ if(!$is_allowedToEdit){
 
 $TBL_USER          	    = Database::get_main_table(TABLE_MAIN_USER);
 $TBL_EXERCICES			= Database::get_course_table(TABLE_QUIZ_TEST);
+$TBL_EXERCICES_QUESTION	= Database::get_course_table(TABLE_QUIZ_QUESTION);
 $TBL_TRACK_EXERCICES	= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
 $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
 //$nameTools=get_lang('Exercices');
@@ -87,6 +88,7 @@ $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRAC
 		 <tr class="row_odd">
 		  <th><?php echo get_lang('Question'); ?></th>
 		  <th><?php echo get_lang('Value'); ?></th>
+		  <th><?php echo get_lang('FeedBack'); ?></th>
 		  <th><?php echo get_lang('Date'); ?></th>
 		  <th><?php echo get_lang('Author'); ?></th>
 		 </tr>
@@ -98,7 +100,7 @@ $sql = 'SELECT * FROM '.$TBL_EXERCICES;
 $query = api_sql_query($sql,__FILE__,__LINE__);
 */
 
-$sql = 'SELECT *, CONCAT(firstname,'."' '".',lastname) as full_name FROM '.$TBL_TRACK_ATTEMPT_RECORDING.' LEFT JOIN '.$TBL_USER.' ON user_id = author where exe_id = '.(int)$_GET['exe_id'].' ORDER BY insert_date ASC';
+$sql = "SELECT *, quiz_question.question, CONCAT(firstname,' ',lastname) as full_name FROM $TBL_TRACK_ATTEMPT_RECORDING,$TBL_USER,$TBL_EXERCICES_QUESTION quiz_question WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY insert_date ASC";
 $query = api_sql_query($sql,__FILE__,__LINE__);
 
 while($row = mysql_fetch_array($query)){
@@ -106,12 +108,14 @@ while($row = mysql_fetch_array($query)){
 	if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"';
 	echo '>';
 	
-	echo '<td>'.$row['question_id'].'</td>';
+	echo '<td>'.$row['question'].'</td>';
+	echo '<td>'.get_lang('NewScore').': '.$row['marks'].'</td>';
 	if(!empty($row['teacher_comment'])){
 		echo '<td>'.get_lang('NewComment').': '.$row['teacher_comment'].'</td>';
 	} else {
-		echo '<td>'.get_lang('NewScore').': '.$row['marks'].'</td>';
+		echo '<td>'.get_lang('WithoutComment').'</td>';
 	}
+	
 	echo '<td>'.$row['insert_date'].'</td>';
 	echo '<td>'.(empty($row['full_name'])?'<i>'.get_lang('OriginalValue').'</i>':$row['full_name']).'</td>';
 

+ 10 - 8
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 17296 2008-12-15 17:08:44Z cfasanando $
+* 	@version $Id: exercise.class.php 17311 2008-12-16 00:53:24Z cfasanando $
 */
 
 
@@ -805,8 +805,10 @@ class Exercise
         $form -> addElement('select', 'exerciseAttempts',get_lang('ExerciseAttempts').' : ',$attempt_option);
 
         $form -> addElement('checkbox', 'enabletimelimit',null ,get_lang('EnableTimeLimits'));
-        $form -> addElement('date', 'start_time', get_lang('ExeStartTime'), array('language'=>'es','format' => 'dMYHi'));
-        $form -> addElement('date', 'end_time', get_lang('ExeEndTime'), array('language'=>'es','format' => 'dMYHi'));
+        //$form -> addElement('date', 'start_time', get_lang('ExeStartTime'), array('language'=>'es','format' => 'dMYHi'));
+        //$form -> addElement('date', 'end_time', get_lang('ExeEndTime'), array('language'=>'es','format' => 'dMYHi'));
+        $form->addElement('datepicker', 'start_time', get_lang('ExeStartTime'), array('form_name'=>'exercise_admin'));
+		$form->addElement('datepicker', 'end_time', get_lang('ExeEndTime'), array('form_name'=>'exercise_admin'));
 
 		// Exercise attempts
 		//$form -> addElement('text', 'exerciseAttempts', get_lang('ExerciseAttempts').' : ',array('size'=>'2'));		
@@ -819,9 +821,9 @@ class Exercise
 		// rules
 		$form -> addRule ('exerciseTitle', get_lang('GiveExerciseName'), 'required');
 		$form -> addRule ('exerciseAttempts', get_lang('Numeric'), 'numeric');
-		$form -> addRule ('start_time', get_lang('DateNotValid'), 'errordate');
-        $form -> addRule ('end_time', get_lang('DateNotValid'), 'errordate');
-        $form -> addRule (array('start_time','end_time'), get_lang('StartDateMustNotBeGreaterThanEndDate'), 'comparedate');
+		$form -> addRule ('start_time', get_lang('DateNotValid'), 'date');
+        $form -> addRule ('end_time', get_lang('DateNotValid'), 'date');
+        $form->addRule(array ('start_time', 'end_time'), get_lang('StartDateShouldBeBeforeEndDate'), 'date_compare', 'lte');
         
 
 		// defaults
@@ -877,9 +879,9 @@ class Exercise
 		if($form -> getSubmitValue('enabletimelimit')==1)
         {
            $start_time = $form -> getSubmitValue('start_time');
-           $this->start_time = $start_time['Y'].'-'.$start_time['M'].'-'.$start_time['d'].' '.$start_time['H'].':'.$start_time['i'].':00';
+           $this->start_time = $start_time['Y'].'-'.$start_time['F'].'-'.$start_time['d'].' '.$start_time['H'].':'.$start_time['i'].':00';
            $end_time = $form -> getSubmitValue('end_time');
-           $this->end_time = $end_time['Y'].'-'.$end_time['M'].'-'.$end_time['d'].' '.$end_time['H'].':'.$end_time['i'].':00';
+           $this->end_time = $end_time['Y'].'-'.$end_time['F'].'-'.$end_time['d'].' '.$end_time['H'].':'.$end_time['i'].':00';
         }
           else
   		{