public function groupInit() { $group = null; $abbr = $this->groupValues["abbr"]; try { $group = $this->groupService->getSportGroupAbbr($abbr); } catch (Exceptions\NoResultException $ex) { $this->logger->addDebug($ex); } if ($group === null) { $this->logger->addInfo("System module initializer - Sport Group - no group with abbr {$abbr} found. New one is gonna be created."); $g = new SportGroup((array) $this->getGroupValues()); $this->groupService->createSportGroup($g); } }
/** * Action for displaying list of playes positions within given group * @param string $gid */ public function actionDefault($gid = self::ROOT_GROUP) { $data = false; try { if (is_numeric($gid)) { $group = $this->sportGroupService->getSportGroup($gid); } else { $group = $this->sportGroupService->getSportGroupAbbr($gid); } $data = $this->positionService->getPositionsWithinGroup($group); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($gid, "default", $ex); } $this->template->group = $group; $this->template->data = $data; }
public function positionsInit() { $pos = null; try { $user = $this->userService->getUserEmail($this->getDefaultUserEmail()); $role = $this->roleService->getRoleName("admin"); $group = $this->groupService->getSportGroupAbbr("root"); } catch (Exceptions\NoResultException $ex) { return null; } try { $pos = $this->positionService->getUniquePosition($user, $group, $role); } catch (Exceptions\NoResultException $ex) { $this->logger->addDebug($ex->getMessage()); } if ($pos === null) { $this->logger->addInfo("Security module initializer - Position - no position with user {$user}, role {$role} and group {$group} found. New one is gonna be created."); $pos = new Position(); $pos->setGroup($group); $pos->setOwner($user); $pos->setRole($role); $pos->setName("Webmaster"); $pos->setComment("System created"); $this->positionService->createPosition($pos); } }
/** * @Secured(resource="showThread") */ public function actionShowThread($id, $abbr) { $thread = $sg = null; try { if (is_numeric($abbr)) { $sg = $this->sportGroupService->getSportGroup($abbr); } elseif (is_string($abbr)) { $sg = $this->sportGroupService->getSportGroupAbbr($abbr); } if (is_numeric($id)) { $thread = $this->forumService->getForumThread($id); } elseif (is_string($id)) { $thread = $this->forumService->getForumThreadAlias($id); } } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($id, "default", $ex); } $type = $sg->getSportType(); if ($type !== null) { $type = " ({$type->getName()})"; } else { $type = ""; } $groupLabel = $sg->getName() . $type; $this->template->groupLabel = $groupLabel; $this->template->abbr = $sg->getAbbr(); $forum = $thread->getForum(); $this->template->forumTitle = $forum->getTitle(); $this->template->forumAlias = $forum->getAlias(); $this->template->thread = $thread; $this->setEntity($thread); }
protected function createComponentWebProfileMenu($name) { $c = new \App\Components\MenuControl($this, $name); $group = $data = null; $gid = $this->getParameter("gid"); try { if (is_numeric($gid)) { $group = $this->sportGroupService->getSportGroup($gid); } else { $group = $this->sportGroupService->getSportGroupAbbr($gid); } $raw = $this->positionService->getPositionsWithinGroup($group); $data = array_filter($raw, function ($e) { if ($e->getRole()->getName() == $this->defaultPlayerRoleName) { return true; } return false; }); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($gid, "default", $ex); } $c->setLabel("{$group->getName()} ({$group->getSportType()->getName()})"); $user = $this->getEntity(); foreach ($data as $p) { $owner = $p->getOwner(); $node = $c->addNode("{$owner->getName()} {$owner->getSurName()}", ":Users:Public:showWebProfile"); if ($owner->getId() == $user->getId()) { $c->setCurrentNode($node); } } return $c; }
/** * @Secured(resource="default") */ public function actionDefault($abbr = self::ROOT_GROUP) { $data = null; try { if (is_string($abbr)) { $sg = $this->sportGroupService->getSportGroupAbbr($abbr); } elseif (is_numeric($abbr)) { $sg = $this->sportGroupService->getSportGroup($abbr); } $data = $this->eventService->getEvents($sg); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($abbr, "default", $ex); } $this->template->data = $data; $this->template->commentable = true; }
/** * Action for displaying list of Articles within given group. * @param string $abbr */ public function actionDefault($abbr = self::ROOT_GROUP) { $data = null; $sg = null; try { if (is_string($abbr)) { $sg = $this->sportGroupService->getSportGroupAbbr($abbr); } elseif (is_numeric($abbr)) { $sg = $this->sportGroupService->getSportGroup($abbr); } $data = $this->articleService->getArticles($sg); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($abbr, ":System:Homepage:default", $ex); } $this->template->data = $data; $this->template->abbr = $abbr; }
public function actionShowGroupPages($id) { $group = null; try { if (is_numeric($id)) { $group = $this->sportGroupService->getSportGroup($id); } else { $group = $this->sportGroupService->getSportGroupAbbr($id); } $this->setEntity($group); } catch (Exceptions\DataErrorException $ex) { $this->handleDataLoad($id, "default", $ex); } $this->template->pages = $this->getPagesCollection(); $this->template->group = $group; }
protected function createComponentWallHistoryControl($name) { $c = new WallHistoryControl($this, $name); $data = $group = null; try { $abbr = $this->getParameter("abbr"); $gid = empty($abbr) ? self::ROOT_GROUP : $abbr; if (is_numeric($gid)) { $group = $this->sportGroupService->getSportGroup($gid); } else { $group = $this->sportGroupService->getSportGroupAbbr($gid); } $data = $this->wallService->getOldWallPosts($group); } catch (Exceptions\DataErrorException $ex) { $this->presenter->handleDataLoad(null, ":System:Default:clubRoot", $ex); } $c->setData($data); $c->setParam($gid); return $c; }