public function __construct(PlUser $owner) { $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); }
function handler_panel($page) { $page->changeTpl('carnet/panel.tpl'); if (Get::has('read')) { XDB::execute('UPDATE watch SET last = FROM_UNIXTIME({?}) WHERE uid = {?}', Get::i('read'), S::i('uid')); S::user()->invalidWatchCache(); Platal::session()->updateNbNotifs(); pl_redirect('carnet/panel'); } require_once 'notifs.inc.php'; $page->assign('now', time()); $user = S::user(); $notifs = Watch::getEvents($user, time() - 7 * 86400); $page->assign('notifs', $notifs); $page->assign('today', date('Y-m-d')); $this->_add_rss_link($page); }