Ejemplo n.º 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;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 public function doDeletePosition($id)
 {
     try {
         $this->positionService->deletePosition((int) $id);
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataDelete($id, "this", $ex);
     }
 }