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); }
protected function fetch(PlUser $user) { global $globals; $events = XDB::iterator('SELECT e.id, e.titre AS title, e.texte, e.creation_date AS publication, e.post_id, p.attachmime IS NOT NULL AS photo, FIND_IN_SET(\'wiki\', e.flags) AS wiki, e.uid, e.promo_min, e.promo_max FROM announces AS e LEFT JOIN announce_photos AS p ON (p.eid = e.id) WHERE FIND_IN_SET("valide", e.flags) AND expiration >= NOW()'); $data = array(); while ($e = self::nextEvent($events, $user)) { $author = User::getWithUID($e['uid']); $promo = $author->promo(); $e['author'] = $author->fullName() . ($promo ? ' (' . $promo . ')' : ''); $e['link'] = $globals->baseurl . '/events#newsid' . $e['id']; $data[] = $e; } return PlIteratorUtils::fromArray($data, 1, true); }
protected function fetch(User $user) { global $globals; $nf = new NewsFilter(new PFC_And(new NFC_Current(), new NFC_Target($user->targetCastes())), new NFO_Begin(true)); $all_news = $nf->get(); $all_news->select(NewsSelect::news()); $data = array(); foreach ($all_news as $item) { $e = array(); $e['id'] = $item->id(); $e['title'] = '[' . $item->target()->group()->label() . '] ' . $item->title(); $e['news'] = $item; $e['publication'] = $item->begin()->format(); $auth = $item->origin() != false ? '[' . $item->origin()->label() . '] ' : ''; $e['author'] = $auth . $item->writer()->displayName(); $e['link'] = $globals->baseurl . '/news'; $data[] = $e; } return PlIteratorUtils::fromArray($data, 1, true); }
protected function fetch(User $user) { global $globals; $activities = new ActivityInstanceFilter(new PFC_Or(new PFC_And(new AIFC_END(new FrankizDateTime(), AIFC_End::AFTER), new AIFC_User($user, 'restricted')), new PFC_And(new AIFC_END(new FrankizDateTime(), AIFC_End::AFTER), new AIFC_User($user, 'everybody')))); $activities = $activities->get(); $activities->select(ActivityInstanceSelect::base()); $data = array(); foreach ($activities as $item) { $e = array(); $e['id'] = $item->id(); $e['title'] = '[' . $item->target_group()->label() . '] ' . $item->title(); $e['activity'] = $item; $e['publication'] = $item->begin()->format(); $auth = $item->origin() != false ? '[' . $item->origin() . '] ' : ''; $e['author'] = $auth . $item->writer()->displayName(); $e['link'] = $globals->baseurl . '/activity'; $data[] = $e; } return PlIteratorUtils::fromArray($data, 1, true); }
protected function fetch() { return PlIteratorUtils::fromArray($this->profile_list); }
public function iterAddresses($flags, $limit = null) { return PlIteratorUtils::fromArray($this->getAddresses($flags, $limit), 1, true); }
public function getOptionsIter($subid = null) { return PlIteratorUtils::fromArray(self::expandArray($this->getOptions($subid)), 1, true); }