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; }
public function export($bits = null) { $a = parent::export($bits); $a['aid'] = $this->activity->id(); $a['writer'] = array('displayName' => $this->writer->displayName(), 'id' => $this->writer->id(), 'login' => $this->writer->login(), 'photo' => $this->writer->image()->src('micro')); $a['target'] = array('name' => $this->activity->target_group()->name(), 'label' => $this->activity->target_group()->label()); if ($this->activity->origin() != false) { $a['origin'] = array('name' => $this->activity->origin()->name(), 'label' => $this->activity->origin()->label()); if ($this->activity->origin()->image() != false) { $a['origin']['image'] = $this->activity->origin()->image()->src('micro'); } } $a['title'] = $this->activity->title(); $a['description'] = MiniWiki::wikiToHTML($this->activity->description(), false); $a['comment'] = MiniWiki::wikiToHTML($this->comment, false); $a['begin'] = $this->begin->format("m/d/Y H:i"); $a['end'] = $this->end->format("m/d/Y H:i"); $a['participants'] = array(); foreach ($this->participants as $user) { $a['participants'][$user->id()] = array('displayName' => $user->displayName(), 'id' => $user->id()); if ($user->id() == s::user()->id()) { $a['participate'] = true; } } if (!isset($a['participate'])) { $a['participate'] = false; } $a['regular'] = $this->regular(); $a['canEdit'] = S::user()->hasRights($this->activity->target()->group(), Rights::admin()); $a['isWriter'] = S::user()->id() == $this->writer->id(); return $a; }