Beispiel #1
0
 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;
 }