Пример #1
0
 public function createEventParticipation($values)
 {
     try {
         $p = new EventParticipation((array) $values);
         $p->setEvent($this->getEntity());
         $p->setOwner($this->getUser()->getIdentity());
         $this->eventService->createEventParticipation($p);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave(null, "this", $ex);
     }
 }
Пример #2
0
 public function getUserEventsDatasource(User $u)
 {
     $model = new Doctrine($this->participationDao->createQueryBuilder()->select("ep, ev.title AS title, ev.takePlaceSince as takePlaceSince, ev.takePlaceTill AS takePlaceTill, ev.eventType AS eventType")->add("from", EventParticipation::getClassName() . " ep LEFT JOIN ep.event ev")->where("ep.owner = :owner")->setParameter("owner", $u->getId()));
     return $model;
 }
Пример #3
0
 public function participationFormSuccess(EventParticipationForm $form)
 {
     $values = $form->getValues();
     switch ($form->getMode()) {
         case FormMode::UPDATE_MODE:
             foreach ($values->owners as $owner) {
                 $ep = new EventParticipation();
                 $ep->setOwner($owner);
                 $ep->setType($values->type);
                 $ep->setEvent($this->getEvent());
                 $ep->setContent($values->content);
                 try {
                     $this->eventService->createEventParticipation($ep);
                 } catch (Exceptions\DuplicateEntryException $ex) {
                     $this->presenter->flashMessage($this->presenter->tt("eventsModule.partForm.errorDupl", null, ["user" => $owner, "event" => $this->getEvent()->getId()]), \App\SystemModule\Presenters\BasePresenter::FM_ERROR);
                 } catch (Exceptions\DataErrorException $ex) {
                     $this->presenter->flashMessage($this->presenter->tt("eventsModule.partForm.errorSave", null, ["user" => $owner, "event" => $this->getEvent()->getId()]), \App\SystemModule\Presenters\BasePresenter::FM_ERROR);
                 }
             }
             break;
     }
     if (!$this->presenter->isAjax()) {
         $this->presenter->redirect("this");
     } else {
         // invalidate control
     }
 }