Created
January 20, 2015 20:21
-
-
Save AndrianD/42c2951b1222d82349ab to your computer and use it in GitHub Desktop.
MembreModel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MembreModel extends RequetePDO | |
| { | |
| //+------------------------------------------------------------------------ | |
| public function chargementDeTousLesMembres($classement = false, $ordre = false) | |
| { | |
| if (!empty($classement) || !empty($ordre)) { | |
| $order = array($classement, $ordre); | |
| } else { | |
| $order = false; | |
| } | |
| $resultat = $this->selectBDD('MEMBRE', '*', false, $order); | |
| if (!empty($resultat)) { | |
| foreach ($resultat as $k => $v) { | |
| $result[$v->getId_membre()] = $v->validate(); | |
| } | |
| return $result; | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+--------------------------------------- | |
| public function membreParPseudo($pseudo) | |
| { | |
| $resultat = $this->selectBDD('MEMBRE', '*', "pseudo=$pseudo"); | |
| if (!empty($resultat[0])) { | |
| $result = $resultat[0]->validate(); | |
| return $result; | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+------------------------------- | |
| public function membreParId($id) | |
| { | |
| $resultat = $this->selectBDD('MEMBRE', '*', "id_membre=$id"); | |
| if (!empty($resultat[0])) { | |
| $result = $resultat[0]->validate(); | |
| return $result; | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+------------------------------------- | |
| public function membreExistant($id) | |
| { | |
| $membreExistant = $this->selectBDD('MEMBRE', '*', "id_membre=$id"); | |
| if (!empty($membreExistant[0])) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+------------------------------------- | |
| public function membreEstVousMeme($idMembre) | |
| { | |
| if (!empty($_SESSION['utilisateur']['pseudo'])) { | |
| $you = $_SESSION['utilisateur']['pseudo']; | |
| $membreEstVousMeme = $this->selectBDD('MEMBRE', '*', "id_membre=$idMembre, pseudo=$you"); | |
| if (empty($membreEstVousMeme[0])) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+------------------------------------- | |
| public function updateMembre($donnees, $idMembre) | |
| { | |
| $updateMembre = $this->updateBDD('MEMBRE', $donnees, "id_membre=$idMembre"); | |
| if (!empty($updateMembre)) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| //+------------------------------------- | |
| public function membrePseudoExistantEtDifferentDuPseudoActuel($idMembre, $pseudo) | |
| { | |
| $membrePseudoERREUR = $this->req("SELECT * FROM MEMBRE WHERE id_membre<>'$idMembre' AND pseudo='$pseudo'"); | |
| if (!empty($membrePseudoERREUR[0])) { | |
| // erreur | |
| return true; | |
| } else { | |
| // ok | |
| return false; | |
| } | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment