executerRequete($sql, array($_SESSION['codeSociete'],$codeBureau,$libelle)); return $bureaux; } public function getBureau($id) { $sql = 'SELECT id, codeSociete, codeBureau, libelle, nomRespon, prenomRespon, telephoneFixe, telephonePortable, email FROM bureau A WHERE (A.codeSociete=?) AND (A.id=?)'; $bureau = $this->executerRequete($sql, array($_SESSION['codeSociete'], $id)); return $bureau->fetch(PDO::FETCH_ASSOC); } public function getNombreBureau() { $sql = 'select count(*) as nbBureau FROM bureau A WHERE (A.codeSociete=?)'; $resultat = $this->executerRequete($sql, array($_SESSION['codeSociete'])); $ligne = $resultat->fetch(PDO::FETCH_ASSOC); return $ligne['nbBureau']; } public function ajouter($codeSociete, $codeBureau, $libelle, $nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email) { $sql = 'INSERT INTO bureau (codeSociete, codeBureau, libelle, nomRespon, prenomRespon, telephoneFixe, telephonePortable, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)'; $this->executerRequete($sql, array($codeSociete, $codeBureau, $libelle, $nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email)); } public function modifier($id, $codeBureau, $libelle, $nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email) { $sql = 'UPDATE bureau SET codeBureau=?, libelle=?, nomRespon=?, prenomRespon=?, telephoneFixe=?, telephonePortable=?, email=? where (id=?)'; $this->executerRequete($sql, array($codeBureau, $libelle, $nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email, $id)); } public function supprimer($id) { $sql = 'DELETE FROM bureau WHERE (id=?)'; $this->executerRequete($sql, array($id)); } public function existeligne($codeBureau) { $sql = 'select id FROM bureau WHERE (codeSociete=?) and (codeBureau=?)'; $resultat = $this->executerRequete($sql, array($_SESSION['codeSociete'],$codeBureau)); return ($resultat->rowCount() > 0); } public function getListe() { $sql = 'SELECT codeBureau as `code`, libelle FROM bureau WHERE (codeSociete=?) order by libelle'; $liste = $this->executerRequete($sql, array($_SESSION['codeSociete'])); return $liste->fetchAll(PDO::FETCH_ASSOC); } }