X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fnotifs.inc.php;h=fd952cb6012cab29b0bc296cdcb7317a38e04980;hb=a19178e9a93c4eb3eb750845e85f87f2294ed1e4;hp=6601c1e689aff780cf0dd791e71002cb52334f1a;hpb=89274a92006f2e3d3124667cd77525f7d01f8012;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 6601c1e..fd952cb 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -1,6 +1,6 @@ date = $date; - if (!$user->watch($this->flag)) { - return new UFC_False(); + if (!$user->watchType($this->flag)) { + return new PFC_False(); } else { return $this->buildCondition($user); } @@ -69,14 +69,14 @@ class WatchProfileUpdate extends WatchOperation public static function register(Profile &$profile, $field) { - XDB::execute('REPLACE INTO watch_profile (uid, ts, field) + XDB::execute('REPLACE INTO watch_profile (pid, ts, field) VALUES ({?}, NOW(), {?})', $profile->id(), $field); } protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_ProfileUpdated('>', $this->date), + return new PFC_And(new UFC_ProfileUpdated('>', $this->date), new UFC_WatchContact($user)); } @@ -109,11 +109,11 @@ class WatchProfileUpdate extends WatchOperation 'photo' => 'Sa photographie'); public function getData(PlUser &$user) { - $data = XDB::fetchColumn('SELECT field + $data = XDB::fetchColumn("SELECT field FROM watch_profile - WHERE uid = {?} AND ts > FROM_UNIXTIME({?}) AND field != \'\' - ORDER BY ts', - $user->id(), $this->date); + WHERE pid = {?} AND ts > FROM_UNIXTIME({?}) AND field != '' + ORDER BY ts", + $user->profile()->id(), $this->date); if (count($data) == 0) { return null; } else { @@ -133,8 +133,8 @@ class WatchRegistration extends WatchOperation protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_Registered(false, '>', $this->date), - new UFC_Or(new UFC_WatchContact($user), + return new PFC_And(new UFC_Registered(false, '>', $this->date), + new PFC_Or(new UFC_WatchContact($user), new UFC_WatchPromo($user))); } @@ -156,8 +156,8 @@ class WatchDeath extends WatchOperation protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_Dead('>', $this->date, true), - new UFC_Or(new UFC_WatchPromo($user), + return new PFC_And(new UFC_Dead('>', $this->date, true), + new PFC_Or(new UFC_WatchPromo($user), new UFC_WatchContact($user))); } @@ -191,10 +191,10 @@ class WatchBirthday extends WatchOperation protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_OR(new UFC_Birthday('=', time()), - new UFC_And(new UFC_Birthday('<=', time() + self::WATCH_LIMIT), + return new PFC_And(new PFC_OR(new UFC_Birthday('=', time()), + new PFC_And(new UFC_Birthday('<=', time() + self::WATCH_LIMIT), new UFC_Birthday('>', $this->date + self::WATCH_LIMIT))), - new UFC_Or(new UFC_WatchPromo($user), + new PFC_Or(new UFC_WatchPromo($user), new UFC_WatchContact($user))); } @@ -252,12 +252,13 @@ class Watch { $obj = new $class(); $uf = new UserFilter($obj->getCondition($user, $date), - array($obj->getOrder(), new UFO_Name(UserFilter::DN_SORT))); + array($obj->getOrder(), new UFO_Name(Profile::DN_SORT))); $users = $uf->getUsers(); if (count($users) == 0) { return null; } else { - return array('operation' => $obj, + return array('type' => $obj->flag, + 'operation' => $obj, 'title' => $obj->getTitle(count($users)), 'users' => $users); }