--- /dev/null
+<?php
+
+ require_once('protected/required.php');
+
+ class PdoHistoriqueManager extends AbstractPdoManager implements HistoriqueManager {
+
+ public function createHistorique($historique) {
+
+ $query = $this -> pdo -> prepare(
+ 'INSERT INTO historiques (installation) VALUES (:installation)'
+ );
+ $query -> bindValue(':installation', $historique -> getInstallation());
+ $query -> execute();
+ $query -> closeCursor();
+
+ }
+
+ public function updateHistorique($historique) {
+
+ $query = $this -> pdo -> prepare(
+ 'UPDATE historiques SET installation = :installation WHERE id = :id'
+ );
+ $query -> bindValue(':id', $historique -> getId());
+ $query -> bindValue(':installation', $historique -> getInstallation());
+ $query -> execute();
+
+ }
+
+ public function getHistorique($id) {
+
+ $query = $this -> pdo -> prepare('SELECT * FROM historiques WHERE id = :id');
+ $query -> bindValue(':id', $id);
+ $query -> execute();
+
+ $result = $query -> fetch(PDO::FETCH_ASSOC);
+ $historique = new Historique($result['id'], $result['installation']);
+
+ $query->closeCursor();
+
+ return $historique;
+ }
+
+ public function getHistoriques() {
+
+ $query = $this -> pdo -> prepare('SELECT * FROM historiques');
+ $query -> execute();
+
+ $results = $query -> fetchAll(PDO::FETCH_ASSOC);
+ $historiques = array();
+ foreach ($results as $result) {
+ $historiques[] = new Historique($result['id'], $result['installation']);
+ }
+
+ $query->closeCursor();
+
+ return $historiques;
+ }
+
+ public function removeHistorique($historique) {
+
+ $query = $this -> pdo -> prepare('DELETE FROM historique WHERE id = :id');
+ $query -> bindValue('id', $historique -> getId());
+ $query -> execute();
+
+ }
+
+ }
+
+?>