Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1621 Rev 1650
Line 67... Line 67...
67
		$commentaires = $this->conteneur->getBdd()->recupererTous($requete);
67
		$commentaires = $this->conteneur->getBdd()->recupererTous($requete);
68
		return $commentaires;
68
		return $commentaires;
69
	}
69
	}
Line 70... Line 70...
70
 
70
 
-
 
71
	protected function chargerObservationsCommentees() {
71
	protected function chargerObservationsCommentees() {
72
		// Seuls les utilisateurs ayant explicitement refusé le mail sont ignorés
72
		$preferences = $this->conteneur->getBdd()->proteger('%"mail_notification_mes_obs":"0"%');
73
		$preferences = $this->conteneur->getBdd()->proteger('%"mail_notification_mes_obs":"0"%');
73
		//TODO: optimiser la requête si beaucoup de mails sont envoyés
74
		//TODO: optimiser la requête si beaucoup de mails sont envoyés
74
		$requete = "SELECT * FROM del_observation AS do ".
75
		$requete = "SELECT * FROM del_observation AS do ".
75
			"WHERE do.id_observation IN ".
76
			"WHERE do.id_observation IN ".
Line 83... Line 84...
83
					"	FROM del_commentaire AS dc, del_observation AS dob".
84
					"	FROM del_commentaire AS dc, del_observation AS dob".
84
					"	WHERE dc.nom_sel = dob.nom_sel ".
85
					"	WHERE dc.nom_sel = dob.nom_sel ".
85
					"		AND dc.ce_utilisateur = dob.ce_utilisateur ".
86
					"		AND dc.ce_utilisateur = dob.ce_utilisateur ".
86
					"		AND dc.ce_observation = dob.id_observation ".
87
					"		AND dc.ce_observation = dob.id_observation ".
87
					") ".
88
					") ".
88
					"AND dc.ce_utilisateur NOT IN ".
-
 
89
						"( ".
-
 
90
						"	SELECT id_utilisateur ".
-
 
91
						"	FROM del_utilisateur_infos ".
-
 
92
						"	WHERE preferences LIKE $preferences ".
-
 
93
						") ".
-
 
94
					"AND TO_DAYS(NOW()) - TO_DAYS(dc.date) <= 1 ".
89
					"AND TO_DAYS(NOW()) - TO_DAYS(dc.date) <= 1 ".
95
				") ".
90
				") ".
-
 
91
				"AND do.ce_utilisateur NOT IN ".
-
 
92
					"( ".
-
 
93
					"	SELECT id_utilisateur ".
-
 
94
					"	FROM del_utilisateur_infos ".
-
 
95
					"	WHERE preferences LIKE $preferences ".
-
 
96
					") ".
96
			"ORDER BY do.ce_utilisateur, do.id_observation ";
97
			"ORDER BY do.ce_utilisateur, do.id_observation ";
97
		$observations = $this->conteneur->getBdd()->recupererTous($requete);
98
		$observations = $this->conteneur->getBdd()->recupererTous($requete);
98
		return $observations;
99
		return $observations;
99
	}
100
	}