You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
<?php
|
|
//require_once ('Question.php');
|
|
class QuestionsGateway {
|
|
private $db;
|
|
|
|
|
|
function __construct(SqliteDb $db) {
|
|
$this->db=$db;
|
|
}
|
|
|
|
public function afficherQuestions() {
|
|
$i = 0;
|
|
$query = 'SELECT numTp,numquestion,question,reponse FROM Correct UNION SELECT numTp,numquestion,question,reponse FROM FunctionCorrect';
|
|
$query = $this->db->prepare($query);
|
|
$result = $query->execute();
|
|
//$resultats = $this->db->query('SELECT found_rows()');
|
|
while($q = $result->fetchArray()){
|
|
$i= $i+1;
|
|
$tabQuestions[] = new Question($q['numTp'],$q['numquestion'],$q['question'],$q['reponse']);
|
|
}
|
|
return $tabQuestions;
|
|
}
|
|
|
|
public function afficherDemonstrations() {
|
|
$i = 0;
|
|
$query = 'SELECT * FROM Demonstration ORDER BY numDemo ASC';
|
|
$query = $this->db->prepare($query);
|
|
$result = $query->execute();
|
|
//$resultats = $this->db->query('SELECT found_rows()');
|
|
while($q = $result->fetchArray()){
|
|
$i= $i+1;
|
|
$tabDemo[] = new Question(1,$q['numDemo'],$q['description'],$q['reponse']);
|
|
}
|
|
return $tabDemo;
|
|
}
|
|
}
|