Julio Montoya 12 년 전
부모
커밋
7b65844a1c
3개의 변경된 파일20개의 추가작업 그리고 18개의 파일을 삭제
  1. 11 9
      main/exercice/exercise.class.php
  2. 2 3
      main/exercice/exercise.lib.php
  3. 7 6
      main/exercice/overview.php

+ 11 - 9
main/exercice/exercise.class.php

@@ -17,6 +17,11 @@ define('EXERCISE_FEEDBACK_TYPE_END',        0); //Feedback 		 - show score and e
 define('EXERCISE_FEEDBACK_TYPE_DIRECT',     1); //DirectFeedback - Do not show score nor answers
 define('EXERCISE_FEEDBACK_TYPE_EXAM',       2); //NoFeedback 	 - Show score only
 
+define('RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS',        0); //show score and expected answers
+define('RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS',     1); //Do not show score nor answers
+define('RESULT_DISABLE_SHOW_SCORE_ONLY',       2); //Show score only
+define('RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES',       3); //Show final score only with categories
+
 define('EXERCISE_MAX_NAME_SIZE',            80);
 
 $debug = false; //All exercise scripts should depend in this debug variable
@@ -414,7 +419,7 @@ class Exercise {
 
 			$sql = "SELECT e.question_id, e.question_order
                     FROM $TBL_EXERCICE_QUESTION e INNER JOIN $TBL_QUESTIONS  q
-                        ON (e.question_id	= q.id AND e.c_id = ".$this->course_id." AND q.c_id = ".$this->course_id.")
+                        ON (e.question_id= q.id AND e.c_id = ".$this->course_id." AND q.c_id = ".$this->course_id.")
 					WHERE e.exercice_id	= '".Database::escape_string($this->id)."'
 					ORDER BY question_order";
             $result = Database::query($sql);
@@ -943,7 +948,6 @@ class Exercise {
 				$radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2'));
 				$form->addGroup($radios_feedback, null, get_lang('FeedbackType'), '');
 
-				//$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
 				// test type
 				$radios = array();
 
@@ -955,7 +959,9 @@ class Exercise {
 				$radios_results_disabled = array();
 				$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
 				$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
-				$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
+				$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2', array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
+                //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'),  '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()'));
+
 				$form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
 
 			} else {
@@ -1006,7 +1012,7 @@ class Exercise {
 			}
 
             // number of random question
-			$option = array();
+
 			$max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ;
 			$option = range(0,$max);
 			$option[0] = get_lang('No');
@@ -1098,10 +1104,7 @@ class Exercise {
 				require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
 
 				$form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
-				//$form->addElement ('html', '<div class="label">'. get_lang('SearchFeatureDocumentLanguage') .'</div>');
-				//$form->addElement ('html', '<div class="formw">'. api_get_languages_combo() .'</div>');
                 $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
-				//$form->addElement ('html','</div><div class="sub-form">');
 
 				$specific_fields = get_specific_field_list();
 
@@ -1125,7 +1128,7 @@ class Exercise {
 		}
 
 		// submit
-		isset($_GET['exerciseId'])?$text=get_lang('ModifyExercise'):$text=get_lang('ProcedToQuestions');
+		$text = isset($_GET['exerciseId']) ? get_lang('ModifyExercise') : get_lang('ProcedToQuestions');
 
 		$form->addElement('style_submit_button', 'submitExercise', $text, 'class="save"');
 
@@ -1136,7 +1139,6 @@ class Exercise {
 			$form->addRule('exerciseAttempts', get_lang('Numeric'), 'numeric');
 			$form->addRule('start_time', get_lang('InvalidDate'), 'date');
 			$form->addRule('end_time', get_lang('InvalidDate'), 'date');
-			//$form->addRule(array ('start_time', 'end_time'), get_lang('StartDateShouldBeBeforeEndDate'), 'date_compare', 'lte');
 		}
 
 		// defaults

+ 2 - 3
main/exercice/exercise.lib.php

@@ -2100,11 +2100,11 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
     $show_results     = false;
     $show_only_score  = false;
 
-    if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_END) {
+    if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS) {
         $show_results = true;
     }
 
-    if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_EXAM) {
+    if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
         $show_only_score = true;
     }
 
@@ -2148,7 +2148,6 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
                 'answer_type' => $result['answer_type']
             );
 
-
             $my_total_score  = $result['score'];
             $my_total_weight = $result['weight'];
 

+ 7 - 6
main/exercice/overview.php

@@ -150,11 +150,11 @@ if (!empty($attempts)) {
 				);
 		$attempt_link .= "&nbsp;&nbsp;&nbsp;".$teacher_revised;
 
-		if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_END || $objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_EXAM) {
+		if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
 			$row['result'] = $score;
 		}
 
-		if ($objExercise->results_disabled == EXERCISE_FEEDBACK_TYPE_END) {
+		if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
 			$row['attempt_link'] = $attempt_link;
 		}
 		$my_attempt_array[] = $row;
@@ -164,14 +164,15 @@ if (!empty($attempts)) {
 	$table = new HTML_Table(array('class' => 'data_table'));
 
 	//Hiding score and answer
-	switch($objExercise->results_disabled) {
-		case EXERCISE_FEEDBACK_TYPE_END:
+	switch ($objExercise->results_disabled) {
+		case RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS:
+        case RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES:
 			$header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('Score'), get_lang('Details'));
 			break;
-		case EXERCISE_FEEDBACK_TYPE_DIRECT:
+		case RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS:
 			$header_names = array(get_lang('Attempt'), get_lang('StartDate'));
 			break;
-		case EXERCISE_FEEDBACK_TYPE_EXAM:
+		case RESULT_DISABLE_SHOW_SCORE_ONLY:
 			$header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('Score'));
 			break;
 	}