[svn r10791] repair the test tool

skala
Eric Marguin 19 years ago
parent d12fe4e503
commit 90a51672ec
  1. 3
      main/exercice/admin.php
  2. 14
      main/exercice/question.class.php
  3. 8
      main/exercice/question_pool.php

@ -60,7 +60,7 @@
* *
* @package dokeos.exercise * @package dokeos.exercise
* @author Olivier Brouckaert * @author Olivier Brouckaert
* @version $Id: admin.php 10789 2007-01-18 19:18:27Z pcool $ * @version $Id: admin.php 10791 2007-01-19 09:02:48Z elixir_inter $
*/ */
@ -416,7 +416,6 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
} }
// --> // -->
</script>"; </script>";
$interbreadcrumb[] = array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
Display::display_header($nameTools,"Exercise"); Display::display_header($nameTools,"Exercise");
?> ?>

@ -22,7 +22,7 @@
* File containing the Question class. * File containing the Question class.
* @package dokeos.exercise * @package dokeos.exercise
* @author Olivier Brouckaert * @author Olivier Brouckaert
* @version $Id: question.class.php 10789 2007-01-18 19:18:27Z pcool $ * @version $Id: question.class.php 10791 2007-01-19 09:02:48Z elixir_inter $
*/ */
@ -104,7 +104,7 @@ abstract class Question
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$sql="SELECT question,description,ponderation,position,type,picture FROM `$TBL_QUESTIONS` WHERE id='$id'"; $sql="SELECT question,description,ponderation,position,type,picture FROM $TBL_QUESTIONS WHERE id='$id'";
$result=api_sql_query($sql,__FILE__,__LINE__); $result=api_sql_query($sql,__FILE__,__LINE__);
@ -460,7 +460,7 @@ abstract class Question
$Extension=$picture[sizeof($picture)-1]; $Extension=$picture[sizeof($picture)-1];
$picture='quiz-'.$questionId.'.'.$Extension; $picture='quiz-'.$questionId.'.'.$Extension;
$sql="UPDATE `$TBL_QUESTIONS` SET picture='$picture' WHERE id='$questionId'"; $sql="UPDATE $TBL_QUESTIONS SET picture='$picture' WHERE id='$questionId'";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
return @copy($picturePath.'/'.$this->picture,$picturePath.'/'.$picture)?true:false; return @copy($picturePath.'/'.$this->picture,$picturePath.'/'.$picture)?true:false;
@ -547,13 +547,13 @@ abstract class Question
// question already exists // question already exists
if($id) if($id)
{ {
$sql="UPDATE `$TBL_QUESTIONS` SET question='$question',description='$description',ponderation='$weighting',position='$position',type='$type',picture='$picture' WHERE id='$id'"; $sql="UPDATE $TBL_QUESTIONS SET question='$question',description='$description',ponderation='$weighting',position='$position',type='$type',picture='$picture' WHERE id='$id'";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
} }
// creates a new question // creates a new question
else else
{ {
$sql="INSERT INTO `$TBL_QUESTIONS`(question,description,ponderation,position,type,picture) VALUES('$question','$description','$weighting','$position','$type','$picture')"; $sql="INSERT INTO $TBL_QUESTIONS(question,description,ponderation,position,type,picture) VALUES('$question','$description','$weighting','$position','$type','$picture')";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
$this->id=mysql_insert_id(); $this->id=mysql_insert_id();
@ -651,7 +651,7 @@ abstract class Question
$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__); api_sql_query($sql,__FILE__,__LINE__);
$sql="DELETE FROM `$TBL_QUESTIONS` WHERE id='$id'"; $sql="DELETE FROM $TBL_QUESTIONS WHERE id='$id'";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
$sql="DELETE FROM `$TBL_REPONSES` WHERE question_id='$id'"; $sql="DELETE FROM `$TBL_REPONSES` WHERE question_id='$id'";
@ -685,7 +685,7 @@ abstract class Question
$position=$this->position; $position=$this->position;
$type=$this->type; $type=$this->type;
$sql="INSERT INTO `$TBL_QUESTIONS`(question,description,ponderation,position,type) VALUES('$question','$description','$weighting','$position','$type')"; $sql="INSERT INTO $TBL_QUESTIONS(question,description,ponderation,position,type) VALUES('$question','$description','$weighting','$position','$type')";
api_sql_query($sql,__FILE__,__LINE__); api_sql_query($sql,__FILE__,__LINE__);
$id=mysql_insert_id(); $id=mysql_insert_id();

@ -24,7 +24,7 @@
* One question can be in several exercises * One question can be in several exercises
* @package dokeos.exercise * @package dokeos.exercise
* @author Olivier Brouckaert * @author Olivier Brouckaert
* @version $Id: question_pool.php 10789 2007-01-18 19:18:27Z pcool $ * @version $Id: question_pool.php 10791 2007-01-19 09:02:48Z elixir_inter $
*/ */
// name of the language file that needs to be included // 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 we have selected an exercise in the list-box 'Filter'
if($exerciseId > 0) 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__); $result=api_sql_query($sql,__FILE__,__LINE__);
} }
// if we have selected the option 'Orphan questions' in the list-box 'Filter' // if we have selected the option 'Orphan questions' in the list-box 'Filter'
elseif($exerciseId == -1) 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__); $result=api_sql_query($sql,__FILE__,__LINE__);
} }
// if we have not selected any option in the list-box 'Filter' // if we have not selected any option in the list-box 'Filter'
else 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__); $result=api_sql_query($sql,__FILE__,__LINE__);
// forces the value to 0 // forces the value to 0

Loading…
Cancel
Save