X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fcarnet%2Ffeed.inc.php;h=ea4f52c2cd8c9888a0f2e69282c32744d400e8bd;hb=bbc7476ed266ed900cc53d2a6623bb05eba64b47;hp=fad227c74f709db24d747311e3ac2b0703536805;hpb=ea74d2785d9c1ff5571ebf2f73c89cbf19c8dd07;p=platal.git diff --git a/modules/carnet/feed.inc.php b/modules/carnet/feed.inc.php index fad227c..ea4f52c 100644 --- a/modules/carnet/feed.inc.php +++ b/modules/carnet/feed.inc.php @@ -1,6 +1,6 @@ notifs =& $notifs; - $this->it = PlIteratorUtils::fromArray($notifs->_data, 3); + $notifs = Watch::getEvents($owner); + $infos = array(); + foreach ($notifs as $n) { + foreach ($n['users'] as $user) { + $op = $n['operation']; + $date = $op->getDate($user); + @$datetext = new Date($date); + @$datetext = $datetext->format('%e %B %Y'); + $profile = $user->profile(); + $infos[] = array('operation' => $op, + 'title' => '[' . $op->getTitle(1) . '] - ' . $user->fullName() . ' le ' . $datetext, + 'author' => $user->fullName(), + 'publication' => $op->publicationDate($user), + 'date' => strtotime($date), + 'id' => $op->flag . '-' . $user->id() . '-' . strtotime($date), + 'data' => $op->getData($user), + 'hruid' => $user->login(), + 'dead' => $user->deathdate, + 'profile' => $user->profile()->hrid(), + 'link' => Platal::globals()->baseurl . '/profile/' . $profile->hrid(), + 'user' => $user, + 'contact' => $owner->isContact($profile)); + } + } + $this->it = PlIteratorUtils::fromArray($infos); } public function next() { $data = $this->it->next(); - if (is_null($data)) { - return null; - } - $cid = $data['keys'][0]; - $x = $data['value']; - - global $globals; - @require_once 'Date.php'; - @$date = new Date($x['date']); - @$date = $date->format('%e %B %Y'); - $author = $x['prenom'] . ' ' . $x['nom'] . ' (X' . $x['promo'] . ')'; - return array_merge($x, - array('author' => $author, - 'publication' => $x['known'], - 'id' => 'carnet' . $x['known'] . $cid . $x['bestalias'], - 'link' => $globals->baseurl . '/profile/private/' - . $x['bestalias'], - 'title' => '[' . $this->notifs->_cats[$cid]['short'] . '] ' - . $author . ' - le ' . $date)); + return $data['value']; } public function total() @@ -84,9 +90,9 @@ class CarnetFeed extends PlFeed 'carnet/rss.tpl'); } - protected function fetch($user) + protected function fetch(PlUser &$user) { - return new CarnetFeedIterator(new Notifs($user, false)); + return new CarnetFeedIterator($user); } }