/** * @Secured(resource="addForumThread") */ public function actionAddForumThread($f, $abbr = self::ROOT_GROUP) { $forum = $sg = null; try { if (is_numeric($abbr)) { $sg = $this->sportGroupService->getSportGroup($abbr); } elseif (is_string($abbr)) { $sg = $this->sportGroupService->getSportGroupAbbr($abbr); } if (is_numeric($f)) { $forum = $this->forumService->getForum($f); } elseif (is_string($f)) { $forum = $this->forumService->getForumAlias($f); } } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($abbr, "default", $ex); } if ($forum === null || $sg === null) { $this->redirect("default", [$g]); } $type = $sg->getSportType(); if ($type !== null) { $type = " ({$type->getName()})"; } else { $type = ""; } $groupLabel = $sg->getName() . $type; $this->setEntity($forum); $this->template->groupLabel = $groupLabel; $this->template->forumTitle = $forum->getTitle(); $this->template->forumAlias = $forum->getAlias(); $this->template->abbr = $abbr; $form = $this->getComponent("addThreadForm"); $form->setDefaults(["forum" => $forum->getId()]); }
/** * @Secured(resource="updateForum") */ public function actionUpdateForum($id) { if (!is_numeric($id)) { $this->handleBadArgument($id); } try { $fDb = $this->forumService->getForum($id); if ($fDb !== null) { $form = $this->getComponent("updateForumForm"); $grArr = $fDb->getGroups()->map(function ($e) { return $e->getId(); })->toArray(); $fDb->setGroups($grArr); $form->setDefaults($fDb->toArray()); $this->template->forumTitle = $fDb->getTitle(); } } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($id, "default", $ex); } }