コード例 #1
0
ファイル: ClubPresenter.php プロジェクト: fuca/sportsclub
 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
ファイル: EventService.php プロジェクト: fuca/sportsclub
 private function ownerTypeHandle(EventParticipation $e)
 {
     try {
         $editor = null;
         if ($this->getUserService() !== null) {
             $id = $this->getMixId($e->getOwner());
             if ($id !== null) {
                 $editor = $this->getUserService()->getUser($id, false);
             }
         }
         $e->setOwner($editor);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
コード例 #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
     }
 }