Brendan Abolivier 9 years ago
parent
commit
4b2c67cbb1

+ 1
- 1
web/model/class.connector.php View File

11
 		$pass = "chabat";
11
 		$pass = "chabat";
12
 
12
 
13
 		$this->bdd = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
13
 		$this->bdd = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
14
-		$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
14
+		$this->bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
15
 	}
15
 	}
16
 
16
 
17
 	/*
17
 	/*

+ 1
- 1
web/model/class.question.php View File

8
 
8
 
9
 	function __construct($intitule) {
9
 	function __construct($intitule) {
10
 		try{
10
 		try{
11
-			$this->intitule;
11
+			$this->intitule = $intitule;
12
 
12
 
13
 			$bdd = new Connector();
13
 			$bdd = new Connector();
14
 
14
 

+ 7
- 6
web/model/class.questset.php View File

8
 
8
 
9
 	function __construct($reponses) {
9
 	function __construct($reponses) {
10
 		if(is_array($reponses)) {
10
 		if(is_array($reponses)) {
11
-			$this->intitules = array();
12
-			$this->reponse1 = $reponse[0];
13
-			$this->reponse2 = $reponse[1];
11
+			$this->questions = array();
12
+			$this->reponse1 = $reponses[0];
13
+			$this->reponse2 = $reponses[1];
14
 			try {
14
 			try {
15
 				$bdd = new Connector();
15
 				$bdd = new Connector();
16
 
16
 
17
 				$options = array(
17
 				$options = array(
18
 					"where" => array(
18
 					"where" => array(
19
-						array("reponse1", "=", $reponse1),
20
-						array("reponse2", "=", $reponse2)
19
+						array("reponse1", "=", $this->reponse1),
20
+						array("reponse2", "=", $this->reponse2)
21
 					)
21
 					)
22
 				);
22
 				);
23
 
23
 
27
 					array_push($this->questions, new Question($question['intitule']));
27
 					array_push($this->questions, new Question($question['intitule']));
28
 				}
28
 				}
29
 
29
 
30
-				$this->categorie = $bdd->Select('*', 'reponses', $options)['nom_cat'];
30
+				$this->categorie = $bdd->Select('*', 'reponses', $options)[0]['nom_cat'];
31
 			} catch(Exception $e) {
31
 			} catch(Exception $e) {
32
 				throw $e;
32
 				throw $e;
33
 			}
33
 			}
34
+			echo "Initialized\n";
34
 		} else {
35
 		} else {
35
 			throw new Exception('Un tableau de réponses est attendu dans le constructeur.');
36
 			throw new Exception('Un tableau de réponses est attendu dans le constructeur.');
36
 		}
37
 		}

+ 1
- 1
web/model/classes.php View File

2
 
2
 
3
 // Call this file from the root folder
3
 // Call this file from the root folder
4
 require_once('model/class.connector.php');
4
 require_once('model/class.connector.php');
5
-require_once('model/class.questions.php');
5
+require_once('model/class.question.php');
6
 require_once('model/class.questset.php');
6
 require_once('model/class.questset.php');