Rev 374 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/*** PHP Version 5** @category PHP* @package projet_bp* @author aurelien <aurelien@tela-botanica.org>* @copyright 2010 Tela-Botanica* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL* @version SVN: <svn_id>* @link /doc/projet_bp/*/abstract class ProjetService extends JRestService {protected function obtenirProjetsPourParticipant($id_utilisateur) {// on selectionne la liste des projets auxquel on est inscrit$requete_projets = 'SELECT DISTINCT *'.' FROM projet'.' WHERE p_id'.' IN '.'(SELECT psu_id_projet FROM projet_statut_utilisateurs'.' WHERE psu_id_utilisateur = '.$id_utilisateur.')'.' GROUP BY p_id';try {$projets = $this->bdd->query($requete_projets)->fetchAll(PDO::FETCH_ASSOC);} catch (PDOException $e) {Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());return array();}// pas de projets ? alors c'est fait !if(!$projets || count($projets) <= 0) {return array();}return $projets;}protected function obtenirListesAssocieesAuProjet($id_projet) {$requete_liste_projets = 'SELECT * FROM projet_liste '.'WHERE pl_id_liste IN '.'(SELECT pl_id_liste from projet_lien_liste '.'WHERE pl_id_projet='.$id_projet.')' ;try {$listes_projets = $this->bdd->query($requete_liste_projets)->fetchAll(PDO::FETCH_ASSOC);} catch (PDOException $e) {Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());return array();}if(!$listes_projets || count($listes_projets) <= 0) {return array();}return $listes_projets;}protected function supprimerParticipantAProjet($id_utilisateur, $id_projet) {$requete_suppression_projets = 'DELETE FROM projet_statut_utilisateurs '.'WHERE psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$id_projet ;try {$requete_suppression_projets = $this->bdd->query($requete_suppression_projets);} catch (PDOException $e) {Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_projets);return false;}return true;}protected function estAbonneAListe($nom_liste, $mail) {try {$est_abonne = '0' ;//$xml_abonne = new SimpleXMLElement(file_get_contents('http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail)) ;$est_abonne = 1;//$xml_abonne[0] ;Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);if($est_abonne == '1') {return true;} else {return false;}}catch(Exception $e) {trigger_error($e->getMessage()) ;return false;}}protected function modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail) {return ($this->desinscriptionListe($nom_liste, $ancien_mail) && $this->inscriptionListe($nom_liste, $nouveau_mail));}protected function inscriptionListe($nom_liste, $mail) {Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);return true;//return $inscription_abonne = file_get_contents('http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;}protected function desinscriptionListe($nom_liste, $mail) {Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);return true;//return $suppression_abonne = file_get_contents('http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.mail) ;}}?>