Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 /**
  * @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);
 }
Exemple #3
0
 /**
  * @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;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 /**
  * 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;
 }
 private function taxSportGroupTypeHandle(MotivationTax $t)
 {
     if ($t == null) {
         throw new Exceptions\NullPointerException("Argument MotivationTax cannot be null");
     }
     try {
         $group = $this->getMixId($t->getSportGroup());
         $sportGroup = $this->sportGroupService->getSportGroup((int) $group, false);
         $t->setSportGroup($sportGroup);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
     return $t;
 }
 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;
 }
Exemple #8
0
 /**
  * @Secured(resource="updateSportGroup")
  */
 public function actionUpdateSportGroup($id)
 {
     if (!is_numeric($id)) {
         $this->handleBadArgument($id);
     }
     try {
         $dbGroup = $this->sportGroupService->getSportGroup($id);
         if ($dbGroup !== null) {
             $form = $this->getComponent('updateSportGroupForm');
             $dbGroup->setPriority($dbGroup->getPriority() - 1);
             $form->setDefaults($dbGroup->toArray());
             $this->template->title = $dbGroup->getName();
         }
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataLoad($id, "default", $ex);
     }
 }
Exemple #9
0
 private function posGroupTypeHandle(Position $p)
 {
     if ($p === null) {
         throw new Exceptions\NullPointerException("Argument Position was null");
     }
     try {
         $group = null;
         $id = $this->getMixId($p->getGroup());
         if ($id !== null) {
             $group = $this->sportGroupService->getSportGroup($id, false);
         }
         $p->setGroup($group);
     } catch (\Exception $e) {
         $this->logError($e);
         throw new Exceptions\DataErrorException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
     return $p;
 }
Exemple #10
0
 private function sportGroupsTypeHandle(WallPost $wp)
 {
     if ($wp === null) {
         throw new Exceptions\NullPointerException("Argument event was null");
     }
     try {
         $coll = new ArrayCollection();
         foreach ($wp->getGroups() as $wpg) {
             $dbG = $this->sportGroupService->getSportGroup($wpg, false);
             if ($dbG !== null) {
                 $coll->add($dbG);
             }
         }
         $wp->setGroups($coll);
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
     return $wp;
 }
 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;
 }