소스 검색

More fixes in Exercises

Julio Montoya 14 년 전
부모
커밋
9a2df53996

+ 2 - 3
main/exercice/admin.php

@@ -43,7 +43,6 @@
 *
 *	@package chamilo.exercise
 * 	@author Olivier Brouckaert
-* 	@version $Id: admin.php 21662 2009-06-29 14:55:09Z iflorespaz $
 */
 
 require_once 'exercise.class.php';
@@ -431,7 +430,7 @@ if (isset($exerciseId) && !empty($exerciseId)) {
 
 echo '<div class="actions">';
 if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
-echo Display::return_icon('back.png', get_lang('GoBackToQuestionList')).' '.'<a href="admin.php?exerciseId='.$exerciseId.'">'.get_lang('GoBackToQuestionList').'</a>';
+    echo Display::return_icon('back.png', get_lang('GoBackToQuestionList')).' '.'<a href="admin.php?exerciseId='.$exerciseId.'">'.get_lang('GoBackToQuestionList').'</a>';
 
 echo Display::return_icon('preview.gif', get_lang('Preview')).'<a href="exercice_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'.get_lang('Preview').'</a>';
 echo Display::return_icon('edit.gif', get_lang('ModifyExercise')).'<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.get_lang('ModifyExercise').'</a>';
@@ -455,7 +454,7 @@ if(!empty($description))
 
 if ($newQuestion || $editQuestion) {
 	// statement management
-	$type = $_REQUEST['answerType'];
+	$type = $_REQUEST['answerType'];    
 	?><input type="hidden" name="Type" value="<?php echo $type; ?>" />
 	<?php
     require 'question_admin.inc.php';

+ 7 - 18
main/exercice/exercice_history.php

@@ -3,11 +3,10 @@
 
 /**
 *	Exercise list: This script shows the list of exercises for administrators and students.
-*	@package dokeos.exercise
+*	@package chamilo.exercise
 *	@author Olivier Brouckaert, original author
 *	@author Denes Nagy, HotPotatoes integration
 *	@author Wolfgang Schneider, code/html cleanup
-* 	@version $Id:exercice.php 12269 2007-05-03 14:17:37Z elixir_julian $
 */
 
 // name of the language file that needs to be included
@@ -34,26 +33,16 @@ if(!$is_allowedToEdit){
 	exit;
 }
 
-$interbreadcrumb[]= array (
-	'url' => 'exercice.php'.'?show=result',
-	'name' => get_lang('Exercices')
-);
-$interbreadcrumb[]= array (
-	'url' => 'exercice.php'.'?show=result&amp;filter=2',
-	'name' => get_lang('StudentScore')
-);
-$interbreadcrumb[]= array (
-	'url' => 'exercice_history.php'.'?exe_id='.Security::remove_XSS($_GET['exe_id']),
-	'name' => get_lang('Details')
-);
+$interbreadcrumb[]= array ('url' => 'exercice.php'.'?show=result','name' => get_lang('Exercices'));
+$interbreadcrumb[]= array ('url' => 'exercice.php'.'?show=result&amp;filter=2','name' => get_lang('StudentScore'));
+$interbreadcrumb[]= array ('url' => 'exercice_history.php'.'?exe_id='.intval($_GET['exe_id']), 'name' => get_lang('Details'));
 
 $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');
-Display::display_header($nameTools,"Exercise");
+Display::display_header($nameTools,get_lang('Exercise'));
 
 	if(isset($_GET['message'])) {
 		if (in_array($_GET['message'], array('ExerciseEdited'))) {
@@ -66,7 +55,7 @@ Display::display_header($nameTools,"Exercise");
 
 ?>
 <div class="actions">
-<a href="exercice.php?cidReq=<?php echo $_GET['cidReq'] ?>&show=result"><img src="../img/back.png"/><?php echo get_lang('BackToResultList') ?></a>
+<a href="exercice.php?cidReq=<?php echo Security::remove_XSS($_GET['cidReq']) ?>&show=result&filter=2"><img src="../img/back.png"/><?php echo get_lang('BackToResultList') ?></a>
 </div>
 <table class="data_table">
 		 <tr class="row_odd">
@@ -78,7 +67,7 @@ Display::display_header($nameTools,"Exercise");
 		 </tr>
 <?php
 
-$sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t,$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 t.insert_date desc,question ASC";
+$sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t,$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 position";
 $query = Database::query($sql);
 while($row = Database::fetch_array($query)){
 	echo '<tr';

+ 27 - 57
main/exercice/hotspot_admin.inc.php

@@ -18,22 +18,19 @@ if(!is_object($objQuestion)) {
 	$objQuestion = Question :: read($modifyAnswers);
 }
 
-$questionName=$objQuestion->selectTitle();
-$answerType=$objQuestion->selectType();
-$pictureName=$objQuestion->selectPicture();
-
+$questionName   = $objQuestion->selectTitle();
+$answerType     = $objQuestion->selectType();
+$pictureName    = $objQuestion->selectPicture();
 
 $debug = 0; // debug variable to get where we are
 
 $okPicture=empty($pictureName)?false:true;
 
 // if we come from the warning box "this question is used in serveral exercises"
-if($modifyIn)
-{
+if($modifyIn) {
     if($debug>0){echo '$modifyIn was set'."<br />\n";}
     // if the user has chosed to modify the question only in the current exercise
-    if($modifyIn == 'thisExercise')
-    {
+    if($modifyIn == 'thisExercise') {
         // duplicates the question
         $questionId=$objQuestion->duplicate();
 
@@ -70,15 +67,13 @@ if($modifyIn)
     unset($buttonBack);
 }
 
-// the answer form has been submitted
-if($submitAnswers || $buttonBack)
-{
+// The answer form has been submitted
+if ($submitAnswers || $buttonBack) {
     if($debug>0){echo '$submitAnswers or $buttonBack was set'."<br />\n";}
 
     $questionWeighting=$nbrGoodAnswers=0;
 
-    for($i=1;$i <= $nbrAnswers;$i++)
-    {
+    for($i=1;$i <= $nbrAnswers;$i++) {
         if($debug>0){echo str_repeat('&nbsp;',4).'$answerType is HOT_SPOT'."<br />\n";}
 
         $reponse[$i]=trim($reponse[$i]);
@@ -111,7 +106,7 @@ if($submitAnswers || $buttonBack)
     }  // end for()
 
 
-    if(empty($msgErr)) {
+    if (empty($msgErr)) {
 
     	for($i=1;$i <= $nbrAnswers;$i++) {
             if($debug>0){echo str_repeat('&nbsp;',4).'$answerType is HOT_SPOT'."<br />\n";}
@@ -134,16 +129,13 @@ if($submitAnswers || $buttonBack)
 
         $editQuestion=$questionId;
         unset($modifyAnswers);
-        echo '<script type="text/javascript">window.location.href="admin.php"</script>';
+        echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'"</script>';
 
     }
     if($debug>0){echo '$modifyIn was set - end'."<br />\n";}
-
 }
 
-if($modifyAnswers)
-{
-
+if($modifyAnswers) {
 
     if($debug>0){echo str_repeat('&nbsp;',0).'$modifyAnswers is set'."<br />\n";}
 
@@ -156,20 +148,17 @@ if($modifyAnswers)
 
 	$TBL_ANSWERS = Database::get_course_table(TABLE_QUIZ_ANSWER);
 
-	if(!$nbrAnswers)
-    {
+	if(!$nbrAnswers) {
 
         $nbrAnswers=$objAnswer->selectNbrAnswers();
-
-        $reponse=Array();
-        $comment=Array();
-        $weighting=Array();
-        $hotspot_coordinates=Array();
+        $reponse=array();
+        $comment=array();
+        $weighting=array();
+        $hotspot_coordinates=array();
         $hotspot_type=array();
 
 
-        for($i=1;$i <= $nbrAnswers;$i++)
-        {
+        for($i=1;$i <= $nbrAnswers;$i++) {
             $reponse[$i]=$objAnswer->selectAnswer($i);
             if ($objExercise->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
             	$comment[$i]=$objAnswer->selectComment($i);
@@ -191,8 +180,7 @@ if($modifyAnswers)
     $_SESSION['tmp_answers']['hotspot_coordinates'] = $hotspot_coordinates;
     $_SESSION['tmp_answers']['hotspot_type'] = $hotspot_type;
 
-    if($lessAnswers)
-    {
+    if ($lessAnswers) {
     	// At least 1 answer
     	if ($nbrAnswers > 1) {
             $nbrAnswers--;
@@ -209,10 +197,8 @@ if($modifyAnswers)
     	}
     }
 
-    if($moreAnswers)
-    {
-    	if ($nbrAnswers < 12)
-    	{
+    if($moreAnswers) {
+    	if ($nbrAnswers < 12) {
             $nbrAnswers++;
 
             // Add a new answer
@@ -223,18 +209,12 @@ if($modifyAnswers)
 			$_SESSION['tmp_answers']['weighting'][]='1';
 			$_SESSION['tmp_answers']['hotspot_coordinates'][]='0;0|0|0';
 			$_SESSION['tmp_answers']['hotspot_type'][]='square';
-    	}
-    	else
-    	{
+    	} else {
     		$msgErr=get_lang('MaxHotspot');
     	}
-
-
     }
 
         if($debug>0){echo str_repeat('&nbsp;',2).'$usedInSeveralExercises is untrue'."<br />\n";}
-
-
         if($debug>0){echo str_repeat('&nbsp;',4).'$answerType is HOT_SPOT'."<br />\n";}
         $hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
         						"#4271B5",
@@ -250,17 +230,11 @@ if($modifyAnswers)
 								"#ED2024",
 								"#45C7F0",
 								"#F7BDE2");
-?>
-
-<h3>
-  <?php echo get_lang('Question').": ".$questionName.' <img src="../img/info3.gif" title="'.strip_tags(get_lang('HotspotChoose')).'" alt="'.strip_tags(get_lang('HotspotChoose')).'" />'; ?>
-</h3>
-<?php
-	if(!empty($msgErr))
-	{
-		Display::display_normal_message($msgErr); //main API
-	}
-
+                                
+Display::tag('h3',get_lang('Question').": ".$questionName.' <img src="../img/info3.gif" title="'.strip_tags(get_lang('HotspotChoose')).'" alt="'.strip_tags(get_lang('HotspotChoose')).'" />');
+if(!empty($msgErr)) {
+    Display::display_normal_message($msgErr); //main API
+}
 ?>
 
 <form method="post" action="<?php echo api_get_self(); ?>?hotspotadmin=<?php echo $modifyAnswers; ?>" id="frm_exercise" name="frm_exercise">
@@ -380,11 +354,7 @@ if($modifyAnswers)
 	</tr>
 </table>
 </form>
-
-
-
 <?php
-
     if($debug>0){echo str_repeat('&nbsp;',0).'$modifyAnswers was set - end'."<br />\n";}
 }
-?>
+?>

+ 1 - 1
main/exercice/question_list_admin.inc.php

@@ -211,7 +211,7 @@ if ($nbrQuestions) {
                         //echo $actions;
                         echo get_lang($question_class.$label);
                         echo '<br />';
-                        echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
+                        //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
                         echo '<br />';
                         showQuestion($id, false, '', '',false, true);                   
                     echo '</p>';                        

+ 1 - 1
main/inc/ajax/course_home.ajax.php

@@ -318,7 +318,7 @@ switch ($action) {
             foreach($flat_list as $lp_id => $lp_item) {                                                    
                 $temp[$count]['id']= $lp_id;
                 $lp_url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
-                Tracking::get_last_connection_date_on_the_course(api_get_user_id(),$item['code'], $session_id, false);
+                $last_date = Tracking::get_last_connection_date_on_the_course(api_get_user_id(),$item['code'], $session_id, false);
                 if ($lp_item['modified_on'] == '0000-00-00 00:00:00' || empty($lp_item['modified_on'])) {
                     $lp_date = api_get_local_time($lp_item['created_on'], null, date_default_timezone_get());
                     $image = 'new.gif';