X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fnotifs.inc.php;h=ec9d8bf860a416aafdaba06a3af26bb73accf93d;hb=6c07cfc151bddfba6737e60dc00152483717ac2a;hp=0f313fc5010dfeb79f991b62631dde0cfc8504ee;hpb=009b8ab7a296ce9ad4ee41c5e6716ae451a7ddd7;p=platal.git diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 0f313fc..ec9d8bf 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(); + return new PFC_False(); } else { - return $this->buildCondition($user, $date); + return $this->buildCondition($user); } } - abstract protected function buildCondition(PlUser &$user, $date); + abstract protected function buildCondition(PlUser &$user); abstract public function getOrder(); abstract public function getDate(PlUser &$user); + public function publicationDate(PlUser &$user) + { + return $this->getDate($user); + } + public function seen(PlUser &$user, $last) { return strtotime($this->getDate($user)) > $last; } + + public function getData(PlUser &$user) + { + return null; + } } class WatchProfileUpdate extends WatchOperation @@ -61,9 +74,9 @@ class WatchProfileUpdate extends WatchOperation $profile->id(), $field); } - protected function buildCondition(PlUser &$user, $date) + protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_ProfileUpdated('>', $date), + return new PFC_And(new UFC_ProfileUpdated('>', $this->date), new UFC_WatchContact($user)); } @@ -76,6 +89,41 @@ class WatchProfileUpdate extends WatchOperation { return $user->profile()->last_change; } + + static private $descriptions = array('search_names' => 'L\'un de ses noms', + 'freetext' => 'Le texte libre', + 'mobile' => 'Son numéro de téléphone portable', + 'nationalite' => 'Sa nationalité', + 'nationalite2' => 'Sa seconde nationalité', + 'nationalite3' => 'Sa troisième nationalité', + 'nick' => 'Son surnom', + 'networking' => 'La liste de ses adresses de networking', + 'edus' => 'Ses formations', + 'addresses' => 'Ses adresses', + 'section' => 'Sa section sportive', + 'binets' => 'La liste de ses binets', + 'medals' => 'Ses décorations', + 'cv' => 'Son Curriculum Vitae', + 'corps' => 'Son Corps d\'État', + 'jobs' => 'Ses informations professionnelles', + 'photo' => 'Sa photographie'); + public function getData(PlUser &$user) + { + $data = XDB::fetchColumn('SELECT field + FROM watch_profile + WHERE uid = {?} AND ts > FROM_UNIXTIME({?}) AND field != \'\' + ORDER BY ts', + $user->id(), $this->date); + if (count($data) == 0) { + return null; + } else { + $text = array(); + foreach ($data as $f) { + $text[] = self::$descriptions[$f]; + } + return $text; + } + } } class WatchRegistration extends WatchOperation @@ -83,10 +131,10 @@ class WatchRegistration extends WatchOperation public $flag = 'registration'; public $title = 'Inscription$s'; - protected function buildCondition(PlUser &$user, $date) + protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_Registered(false, '>', $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))); } @@ -106,10 +154,10 @@ class WatchDeath extends WatchOperation public $flag = 'death'; public $title = 'Décès'; - protected function buildCondition(PlUser &$user, $date) + protected function buildCondition(PlUser &$user) { - return new UFC_And(new UFC_Dead('>', $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))); } @@ -123,6 +171,11 @@ class WatchDeath extends WatchOperation return $user->profile()->deathdate; } + public function publicationDate(PlUser &$user) + { + return $user->profile()->deathdate_rec; + } + public function seen(PlUser &$user, $last) { return strtotime($user->profile()->deathdate_rec) > $last; @@ -136,12 +189,12 @@ class WatchBirthday extends WatchOperation public $flag = 'birthday'; public $title = 'Anniversaire$s'; - protected function buildCondition(PlUser &$user, $date) + 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), - new UFC_Birthday('>', $date + self::WATCH_LIMIT))), - new UFC_Or(new UFC_WatchPromo($user), + 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 PFC_Or(new UFC_WatchPromo($user), new UFC_WatchContact($user))); } @@ -155,6 +208,11 @@ class WatchBirthday extends WatchOperation return $user->profile()->next_birthday; } + public function publicationDate(PlUser &$user) + { + return date('Y-m-d', strtotime($user->profile()->next_birthday) - self::WATCH_LIMIT); + } + public function seen(PlUser &$user, $last) { $birthday = strtotime($user->profile()->next_birthday);