public function commit() { $mail = new FrankizMailer(); $sub = $this->type_mail == 'promo' ? 'promo' : $this->formation->label(); $mail->subject('[Mail ' . $sub . '] ' . $this->subject); if ($this->origin) { global $globals; $mail->setFrom($this->origin->name() . '@' . $globals->mails->group_suffix, 'Frankiz - ' . $this->origin->label() . ''); } else { $mail->setFrom($this->writer->bestEmail(), $this->writer->fullName()); } if ($this->type_mail == 'promo' && !$this->targets) { $uf = new UserFilter(new PFC_AND(new UFC_Group($this->formation), new UFC_Group(Group::from('on_platal')))); } else { if ($this->type_mail == 'promo') { $uf = new UserFilter(new PFC_AND(new UFC_Group($this->formation), new UFC_Caste($this->targets), new UFC_Group(Group::from('on_platal')))); } else { $uf = new UserFilter(new PFC_AND(new UFC_Caste($this->targets->first()), new UFC_Group(Group::from('on_platal')))); } } if (!$this->nowiki) { $mail->body(MiniWiki::wikiToHTML($this->body, false)); } else { $mail->body(MiniWiki::wikiToText($this->body, false, 0, 80)); } $mail->ToUserFilter($uf); $mail->sendLater(!$this->nowiki); return true; }
function handler_participants($page, $id) { $act = new ActivityInstanceFilter(new PFC_AND(new AIFC_CanBeSeen(S::user()), new AIFC_Id($id))); $act = $act->get(true); if ($act === false) { throw new Exception("Invalid credentials"); } $act->select(ActivityInstanceSelect::all()); if (Env::has('mail')) { S::assert_xsrf_token(); if (Env::t('mail_body') != '' && s::user()->id() == $act->writer()->id()) { $mail = new FrankizMailer(); $mail->subject('[Mail groupé] Activité ' . $act->title() . ' du ' . $act->date() . ' à ' . $act->hour_begin()); $mail->body(Env::t('mail_body')); $mail->setFrom(S::user()->bestEmail(), S::user()->displayName()); $mail->toUserFilter(new UserFilter(new UFC_ActivityInstance($act->id()))); $mail->sendLater(false); } else { $page->assign('msg', 'Votre mail n\'est pas rempli.'); } } $page->assign('user', s::user()); $page->assign('id', $id); $page->assign('activity', $act); $page->assign('title', 'Participants à une activité'); $page->addCssLink('activity.css'); $page->changeTpl('activity/participants.tpl'); }