X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fnotifs.inc.php;h=3899308601486eec9c6401758682f60120e0eecf;hb=517ecea1229f166ce51fe443f428381ad5912f83;hp=d79de449accbefcb28691146aaf3c44a5664a3b4;hpb=1a074f459b77d69e5ad3a61f0fc4781b8ea50d74;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index d79de44..3899308 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -1,6 +1,6 @@ ', $watch->date()), new PFC_Or($watch->contactCondition(), - $watch->promoCondition())); + $watch->promoCondition(), + $watch->groupCondition())); } public function getOrder() @@ -158,7 +159,8 @@ class WatchDeath extends WatchOperation { return new PFC_And(new UFC_Dead('>', $watch->date(), true), new PFC_Or($watch->contactCondition(), - $watch->promoCondition())); + $watch->promoCondition(), + $watch->groupCondition())); } public function getOrder() @@ -196,6 +198,7 @@ class WatchBirthday extends WatchOperation protected function buildCondition(Watch $watch) { + $not_dead = new PFC_Not(new UFC_Dead()); $select_date = new PFC_OR(new UFC_Birthday('=', time()), new PFC_And(new UFC_Birthday('<=', time() + self::WATCH_LIMIT), new UFC_Birthday('>', $watch->date() + self::WATCH_LIMIT))); @@ -205,9 +208,10 @@ class WatchBirthday extends WatchOperation $cond = new PFC_Or($cond, new PFC_And($watch->promoCondition(), new UFC_Promo('>=', $profile->mainGrade(), $profile->yearpromo() - 1), - new UFC_Promo('<=', $profile->mainGrade(), $profile->yearpromo() + 1))); + new UFC_Promo('<=', $profile->mainGrade(), $profile->yearpromo() + 1)), + $watch->groupCondition()); } - return new PFC_And($select_date, $cond); + return new PFC_And($not_dead, $select_date, $cond); } public function getOrder() @@ -248,6 +252,7 @@ class Watch private $date = null; private $contactCond = null; private $promoCond = null; + private $groupCond = null; private $filters = array(); @@ -288,6 +293,14 @@ class Watch return $this->promoCond; } + public function groupCondition() + { + if (!$this->groupCond) { + $this->groupCond = new UFC_WatchGroup($this->user); + } + return $this->groupCond; + } + private function fetchEventWatch($class) { if (!isset(self::$events[$class])) {