Subversion Repositories Applications.projet

Rev

Rev 363 | Rev 374 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 363 Rev 370
Line 9... Line 9...
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
11
* @link      /doc/projet_bp/
11
* @link      /doc/projet_bp/
12
*/
12
*/
Line 13... Line 13...
13
 
13
 
-
 
14
class ProjetService extends JRestService {
-
 
15
	
-
 
16
	public function __construct($config, $demarrer_session= true) {
-
 
17
		parent::__construct($config, $demarrer_session);
Line 14... Line 18...
14
abstract class ProjetService extends JRestService {
18
	}
Line 15... Line 19...
15
 
19
 
16
	protected function obtenirProjetsPourParticipant($id_utilisateur) {
20
	protected function obtenirProjetsPourParticipant($id_utilisateur) {
Line 36... Line 40...
36
			return array();
40
			return array();
37
		}
41
		}
Line 38... Line 42...
38
 
42
 
39
		return $projets;
43
		return $projets;
-
 
44
	}
-
 
45
	
-
 
46
	protected function obtenirInformationsProjet($id_projet) {
-
 
47
		
-
 
48
		$requete_informations_projet = 'SELECT DISTINCT *'.
-
 
49
						   	' FROM projet'.
-
 
50
						   	' WHERE p_id = '.$id_projet ;
-
 
51
		
-
 
52
		try {
-
 
53
			$projet = $this->bdd->query($requete_informations_projet)->fetchAll(PDO::FETCH_ASSOC);
-
 
54
		} catch (PDOException $e) {
-
 
55
			Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage());
-
 
56
			return false;
-
 
57
		}
-
 
58
 
-
 
59
		// pas de projets ? alors c'est fait !
-
 
60
		if(!$projet) {
-
 
61
			return false;
-
 
62
		}
-
 
63
 
-
 
64
		return $projet;
Line 40... Line 65...
40
	}
65
	}
Line 41... Line 66...
41
 
66
 
42
	protected function obtenirListesAssocieesAuProjet($id_projet) {
67
	protected function obtenirListesAssocieesAuProjet($id_projet) {
Line 58... Line 83...
58
			return array();
83
			return array();
59
		}
84
		}
Line 60... Line 85...
60
 
85
 
61
		return $listes_projets;
86
		return $listes_projets;
-
 
87
	}
-
 
88
	
-
 
89
	protected function supprimerInscriptionAListeProjet($id_utilisateur, $id_liste) {
-
 
90
	
-
 
91
		$requete_suppression_liste = 'DELETE FROM projet_inscription_liste '.
-
 
92
											   'WHERE pil_id_utilisateur='.$id_utilisateur.' and pil_id_liste='.$id_liste ;
-
 
93
 
-
 
94
		try {
-
 
95
			$requete_suppression_liste = $this->bdd->query($requete_suppression_liste);
-
 
96
		} catch (PDOException $e) {
-
 
97
			Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_liste);
-
 
98
			return false;
-
 
99
		}
-
 
100
	
Line 62... Line 101...
62
	}
101
	}
63
 
102
 
64
	protected function supprimerParticipantAProjet($id_utilisateur, $id_projet) {
103
	protected function supprimerParticipantAProjet($id_utilisateur, $id_projet) {
Line 69... Line 108...
69
			$requete_suppression_projets = $this->bdd->query($requete_suppression_projets);
108
			$requete_suppression_projets = $this->bdd->query($requete_suppression_projets);
70
		} catch (PDOException $e) {
109
		} catch (PDOException $e) {
71
			Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_projets);
110
			Log::getInstance()->ajouterEntree('projet','Fichier: '.$e->getFile().' Ligne: '.$e->getLine().' '.$e->getMessage().' '.$requete_suppression_projets);
72
			return false;
111
			return false;
73
		}
112
		}
74
 
113
		
75
		return true;
114
		return true;
76
	}
115
	}
Line 77... Line 116...
77
 
116
 
Line 78... Line 117...
78
	protected function estAbonneAListe($nom_liste, $mail) {
117
	protected function estAbonneAListe($nom_liste, $mail) {
79
 
118
 
80
		try {
119
		try {
81
			$est_abonne = '0' ;
120
			$est_abonne = '0' ;
82
			//$xml_abonne = new SimpleXMLElement(file_get_contents('http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail)) ;
-
 
83
			$est_abonne = 1;//$xml_abonne[0] ;
-
 
Line 84... Line 121...
84
 
121
			$xml_abonne = new SimpleXMLElement(file_get_contents('http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail)) ;
85
			Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/est_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);
122
			$est_abonne = $xml_abonne[0] ;
86
 
123
 
87
			if($est_abonne == '1') {
124
			if($est_abonne == '1') {
Line 100... Line 137...
100
	protected function modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail) {
137
	protected function modifierMailPourListe($nom_liste, $ancien_mail, $nouveau_mail) {
101
		return ($this->desinscriptionListe($nom_liste, $ancien_mail) && $this->inscriptionListe($nom_liste, $nouveau_mail));
138
		return ($this->desinscriptionListe($nom_liste, $ancien_mail) && $this->inscriptionListe($nom_liste, $nouveau_mail));
102
	}
139
	}
Line 103... Line 140...
103
 
140
 
104
	protected function inscriptionListe($nom_liste, $mail) {
-
 
105
 
-
 
106
		Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);
-
 
107
		return true;
141
	protected function inscriptionListe($nom_liste, $mail) {
108
		//return $inscription_abonne = file_get_contents('http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
142
		return $inscription_abonne = file_get_contents('http://vpopmail.tela-botanica.org/ajout_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
Line 109... Line 143...
109
	}
143
	}
110
 
-
 
111
	protected function desinscriptionListe($nom_liste, $mail) {
-
 
112
		Log::getInstance()->ajouterEntree('projet','appel de http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail);
144
 
113
		return true;
145
	protected function desinscriptionListe($nom_liste, $mail) {
114
		//return $suppression_abonne = file_get_contents('http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.mail) ;
146
		return $suppression_abonne = file_get_contents('http://vpopmail.tela-botanica.org/suppression_abonne.php?domaine=tela-botanica.org&liste='.$nom_liste.'&mail='.$mail) ;
115
	}
147
	}