[svn r10793] repair the test tool

skala
Eric Marguin 18 years ago
parent 4e67e3363b
commit 8d8cddff08
  1. 10
      main/exercice/answer.class.php
  2. 10
      main/exercice/exercice.php
  3. 14
      main/exercice/question.class.php
  4. 8
      main/exercice/question_pool.php

@ -23,7 +23,7 @@
* 5 arrays are created to receive the attributes of each answer belonging to a specified question
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: answer.class.php 10789 2007-01-18 19:18:27Z pcool $
* @version $Id: answer.class.php 10793 2007-01-19 09:17:15Z elixir_inter $
*/
@ -384,7 +384,7 @@ $this->hotspot_coordinates[$i]=$object->hotspot_coordinates;
$questionId=$this->questionId;
$sql = "UPDATE `$TBL_REPONSES` SET " .
$sql = "UPDATE $TBL_REPONSES SET " .
"`answer` = '$answer', " .
"`comment` = '$comment', " .
"`ponderation` = '$weighting', " .
@ -407,11 +407,11 @@ $this->hotspot_coordinates[$i]=$object->hotspot_coordinates;
$questionId=$this->questionId;
// removes old answers before inserting of new ones
$sql="DELETE FROM `$TBL_REPONSES` WHERE question_id='$questionId'";
$sql="DELETE FROM $TBL_REPONSES WHERE question_id='$questionId'";
api_sql_query($sql,__FILE__,__LINE__);
// inserts new answers into data base
$sql="INSERT INTO `$TBL_REPONSES`" .
$sql="INSERT INTO $TBL_REPONSES" .
"(id,question_id,answer,correct,comment," .
"ponderation,position,hotspot_coordinates,hotspot_type) VALUES";
@ -462,7 +462,7 @@ $this->hotspot_coordinates[$i]=$object->hotspot_coordinates;
if($this->nbrAnswers)
{
// inserts new answers into data base
$sql="INSERT INTO `$TBL_REPONSES`" .
$sql="INSERT INTO $TBL_REPONSES" .
"(id,question_id,answer,correct,comment," .
"ponderation,position,hotspot_coordinates,hotspot_type) VALUES";

@ -24,7 +24,7 @@
* @author Olivier Brouckaert, original author
* @author Denes Nagy, HotPotatoes integration
* @author Wolfgang Schneider, code/html cleanup
* @version $Id: exercice.php 10789 2007-01-18 19:18:27Z pcool $
* @version $Id: exercice.php 10793 2007-01-19 09:17:15Z elixir_inter $
*/
@ -717,7 +717,7 @@ if($_configuration['tracking_enabled'])
$res = api_sql_query($qry,__FILE__,__LINE__);
$tot = mysql_result($res,0,'tot');
$totquery = "update `$TBL_TRACK_EXERCICES` set exe_result = $tot where exe_Id=$id";
$totquery = "update $TBL_TRACK_EXERCICES set exe_result = $tot where exe_Id=$id";
api_sql_query($totquery, __FILE__, __LINE__);
}
@ -741,7 +741,7 @@ if($_configuration['tracking_enabled'])
$tot += $row ['marks'];
}
$totquery = "update `$TBL_TRACK_EXERCICES` set exe_result = $tot where exe_Id=$id";
$totquery = "update $TBL_TRACK_EXERCICES set exe_result = $tot where exe_Id=$id";
api_sql_query($totquery, __FILE__, __LINE__);
$subject = "Examsheet viewed/corrected/commented by teacher";
@ -825,7 +825,7 @@ $message = "<p>You attempt for the test #test# has been viewed/commented/correct
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql="SELECT CONCAT(`lastname`,' ',`firstname`),`ce`.`title`, `te`.`exe_result` ,
`te`.`exe_weighting`, UNIX_TIMESTAMP(`te`.`exe_date`),`te`.`exe_Id`,email
FROM $TBL_EXERCICES AS ce , `$TBL_TRACK_EXERCICES` AS te, $TBL_USER AS user
FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user
WHERE `te`.`exe_exo_id` = `ce`.`id` AND `user_id`=`te`.`exe_user_id` AND `te`.`exe_cours_id`='$_cid'
ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC";
@ -839,7 +839,7 @@ $message = "<p>You attempt for the test #test# has been viewed/commented/correct
else
{ // get only this user's results
$sql="SELECT '',`ce`.`title`, `te`.`exe_result` , `te`.`exe_weighting`, UNIX_TIMESTAMP(`te`.`exe_date`),`te`.`exe_Id`
FROM $TBL_EXERCICES AS ce , `$TBL_TRACK_EXERCICES` AS te
FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te
WHERE `te`.`exe_exo_id` = `ce`.`id` AND `te`.`exe_user_id`='".$_user['user_id']."' AND `te`.`exe_cours_id`='$_cid'
ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC";

@ -22,7 +22,7 @@
* File containing the Question class.
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question.class.php 10791 2007-01-19 09:02:48Z elixir_inter $
* @version $Id: question.class.php 10793 2007-01-19 09:17:15Z elixir_inter $
*/
@ -120,7 +120,7 @@ abstract class Question
$objQuestion->type=$object->type;
$objQuestion->picture=$object->picture;
$sql="SELECT exercice_id FROM `$TBL_EXERCICE_QUESTION` WHERE question_id='".intval($id)."'";
$sql="SELECT exercice_id FROM $TBL_EXERCICE_QUESTION WHERE question_id='".intval($id)."'";
$result=api_sql_query($sql,__FILE__,__LINE__);
// fills the array with the exercises which this question is in
@ -299,7 +299,7 @@ abstract class Question
if(!in_array($this->type,array(UNIQUE_ANSWER,MULTIPLE_ANSWER)) || !in_array($type,array(UNIQUE_ANSWER,MULTIPLE_ANSWER)))
{
// removes old answers
$sql="DELETE FROM `$TBL_REPONSES` WHERE question_id='".$this->id."'";
$sql="DELETE FROM $TBL_REPONSES WHERE question_id='".$this->id."'";
api_sql_query($sql,__FILE__,__LINE__);
}
@ -592,7 +592,7 @@ abstract class Question
{
$this->exerciseList[]=$exerciseId;
$sql="INSERT INTO `$TBL_EXERCICE_QUESTION`(question_id,exercice_id) VALUES('$id','$exerciseId')";
$sql="INSERT INTO $TBL_EXERCICE_QUESTION(question_id,exercice_id) VALUES('$id','$exerciseId')";
api_sql_query($sql,__FILE__,__LINE__);
}
@ -624,7 +624,7 @@ abstract class Question
// deletes the position in the array containing the wanted exercise ID
unset($this->exerciseList[$pos]);
$sql="DELETE FROM `$TBL_EXERCICE_QUESTION` WHERE question_id='$id' AND exercice_id='$exerciseId'";
$sql="DELETE FROM $TBL_EXERCICE_QUESTION WHERE question_id='$id' AND exercice_id='$exerciseId'";
api_sql_query($sql,__FILE__,__LINE__);
return true;
@ -648,13 +648,13 @@ abstract class Question
// if the question must be removed from all exercises
if(!$deleteFromEx)
{
$sql="DELETE FROM `$TBL_EXERCICE_QUESTION` WHERE question_id='$id'";
$sql="DELETE FROM $TBL_EXERCICE_QUESTION WHERE question_id='$id'";
api_sql_query($sql,__FILE__,__LINE__);
$sql="DELETE FROM $TBL_QUESTIONS WHERE id='$id'";
api_sql_query($sql,__FILE__,__LINE__);
$sql="DELETE FROM `$TBL_REPONSES` WHERE question_id='$id'";
$sql="DELETE FROM $TBL_REPONSES WHERE question_id='$id'";
api_sql_query($sql,__FILE__,__LINE__);
$this->removePicture();

@ -24,7 +24,7 @@
* One question can be in several exercises
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question_pool.php 10791 2007-01-19 09:02:48Z elixir_inter $
* @version $Id: question_pool.php 10793 2007-01-19 09:17:15Z elixir_inter $
*/
// name of the language file that needs to be included
@ -152,19 +152,19 @@ if($is_allowedToEdit)
// if we have selected an exercise in the list-box 'Filter'
if($exerciseId > 0)
{
$sql="SELECT id,question,type FROM `$TBL_EXERCICE_QUESTION`,$TBL_QUESTIONS WHERE question_id=id AND exercice_id='$exerciseId' ORDER BY position LIMIT $from,".($limitQuestPage+1);
$sql="SELECT id,question,type FROM $TBL_EXERCICE_QUESTION,$TBL_QUESTIONS WHERE question_id=id AND exercice_id='$exerciseId' ORDER BY position LIMIT $from,".($limitQuestPage+1);
$result=api_sql_query($sql,__FILE__,__LINE__);
}
// if we have selected the option 'Orphan questions' in the list-box 'Filter'
elseif($exerciseId == -1)
{
$sql="SELECT id,question,type FROM $TBL_QUESTIONS LEFT JOIN `$TBL_EXERCICE_QUESTION` ON question_id=id WHERE exercice_id IS NULL ORDER BY question LIMIT $from,".($limitQuestPage+1);
$sql="SELECT id,question,type FROM $TBL_QUESTIONS LEFT JOIN $TBL_EXERCICE_QUESTION ON question_id=id WHERE exercice_id IS NULL ORDER BY question LIMIT $from,".($limitQuestPage+1);
$result=api_sql_query($sql,__FILE__,__LINE__);
}
// if we have not selected any option in the list-box 'Filter'
else
{
$sql="SELECT id,question,type FROM $TBL_QUESTIONS LEFT JOIN `$TBL_EXERCICE_QUESTION` ON question_id=id WHERE exercice_id IS NULL OR exercice_id<>'$fromExercise' GROUP BY id ORDER BY question LIMIT $from,".($limitQuestPage+1);
$sql="SELECT id,question,type FROM $TBL_QUESTIONS LEFT JOIN $TBL_EXERCICE_QUESTION ON question_id=id WHERE exercice_id IS NULL OR exercice_id<>'$fromExercise' GROUP BY id ORDER BY question LIMIT $from,".($limitQuestPage+1);
$result=api_sql_query($sql,__FILE__,__LINE__);
// forces the value to 0

Loading…
Cancel
Save