$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')";
// 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);