X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fnotifs.inc.php;h=fd952cb6012cab29b0bc296cdcb7317a38e04980;hb=01df65b50f91040bab6387a7e06ce8b9420f19c8;hp=ec9d8bf860a416aafdaba06a3af26bb73accf93d;hpb=fb813fb52d5ab65ca9a5b92b5cb9089523380d79;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index ec9d8bf..fd952cb 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -35,7 +35,7 @@ abstract class WatchOperation public function getCondition(PlUser &$user, $date) { $this->date = $date; - if (!$user->watch($this->flag)) { + if (!$user->watchType($this->flag)) { return new PFC_False(); } else { return $this->buildCondition($user); @@ -69,7 +69,7 @@ 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); } @@ -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 { @@ -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); }