Example #1
0
 public function getSchedule()
 {
     return Date::getDateTime($this->date);
 }
 private function updatePAttr(PAttrForm $pattrForm, PlaygroundAttribute &$pattr)
 {
     $timeslotid = $pattrForm->getTimeslot();
     $pattr->setTimeslot($this->get('entity')->getTimeslotById($timeslotid));
     $dateformat = $this->get('translator')->trans('FORMAT.DATE');
     $matchdate = date_create_from_format($dateformat, $pattrForm->getDate());
     $pattr->setDate(Date::getDate($matchdate));
     $timeformat = $this->get('translator')->trans('FORMAT.TIME');
     $starttime = date_create_from_format($timeformat, $pattrForm->getStart());
     $pattr->setStart(Date::getTime($starttime));
     $endtime = date_create_from_format($timeformat, $pattrForm->getEnd());
     $pattr->setEnd(Date::getTime($endtime));
     $pattr->setFinals($pattrForm->isFinals());
 }
 public function getEndSchedule()
 {
     return Date::getDateTime($this->date, $this->end);
 }
 private function copyEventForm(Event $event)
 {
     $eventForm = new EventForm();
     $eventForm->setId($event->getId());
     $eventForm->setPid($event->getTournament()->getId());
     $eventForm->setEvent($event->getEvent());
     $dateformat = $this->get('translator')->trans('FORMAT.DATE');
     $eventdate = Date::getDateTime($event->getDate());
     $eventForm->setDate(date_format($eventdate, $dateformat));
     return $eventForm;
 }
 private function checkForm($form, ResultForm $resultForm)
 {
     if (!$form->isValid()) {
         return false;
     }
     /*
      * Check for blank fields
      */
     if ($resultForm->getMatchno() == null || trim($resultForm->getMatchno()) == '') {
         $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NONO', array(), 'tournament')));
     }
     if ($resultForm->getEvent() == ResultForm::$EVENT_MATCH_PLAYED) {
         if ($resultForm->getScoreA() == null || trim($resultForm->getScoreA()) == '') {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NOHOMESCORE', array(), 'tournament')));
         }
         if ($resultForm->getScoreB() == null || trim($resultForm->getScoreB()) == '') {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.NOAWAYSCORE', array(), 'tournament')));
         }
     }
     if (!$form->isValid()) {
         return false;
     }
     /*
      * Check for valid contents
      */
     if ($resultForm->getEvent() == ResultForm::$EVENT_MATCH_PLAYED) {
         if ($resultForm->getScoreA() > 100 || $resultForm->getScoreA() < 0) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDHOMESCORE', array(), 'tournament')));
         }
         if ($resultForm->getScoreB() > 100 || $resultForm->getScoreB() < 0) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDAWAYSCORE', array(), 'tournament')));
         }
     }
     /* @var $match Match */
     $match = $this->get('match')->getMatchByNo($resultForm->getTournament(), $resultForm->getMatchno());
     if ($match == null) {
         $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.INVALIDMATCHNO', array(), 'tournament')));
     } else {
         if (!$this->isMatchValid($match)) {
             $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.MATCHNOTREADY', array(), 'tournament')));
         } else {
             if ($this->get('match')->isMatchResultValid($match->getId())) {
                 $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.CANTCHANGE', array(), 'tournament')));
             } else {
                 $today = new DateTime();
                 $matchdate = Date::getDateTime($match->getDate(), $match->getTime());
                 if ($matchdate > $today) {
                     $form->addError(new FormError($this->get('translator')->trans('FORM.RESULTREPORT.TOOEARLY', array(), 'tournament')));
                 }
             }
         }
     }
     return $form->isValid();
 }
 public function listNewsByTournament($tournamentid)
 {
     $qb = $this->em->createQuery("select n.id as nid,n.date,n.newstype,n.newsno,n.language,n.title,n.context," . "t.id,t.name,t.division,c.name as club,c.country," . "m.id as mid,m.matchno,m.date as matchdate,m.time as matchtime " . "from " . $this->entity->getRepositoryPath('News') . " n " . "left outer join " . $this->entity->getRepositoryPath('Match') . " m " . "with n.match=m.id " . "left outer join " . $this->entity->getRepositoryPath('Team') . " t " . "with n.team=t.id " . "left outer join " . $this->entity->getRepositoryPath('Club') . " c " . "with t.club=c.id " . "where n.tournament=:tournament " . "order by n.newsno asc");
     $qb->setParameter('tournament', $tournamentid);
     $newsList = array();
     foreach ($qb->getResult() as $news) {
         $newsdate = Date::getDateTime($news['date']);
         $news['schedule'] = $newsdate;
         $newsList[] = $news;
     }
     return $newsList;
 }
 /**
  * @param PlanningResults $result
  * @param QMatchPlan $match
  * @param bool $replan
  * @return bool
  */
 private function replanMatch_1run(PlanningResults $result, QMatchPlan $match)
 {
     $result->mark(function (PlaygroundAttribute $ats1, PlaygroundAttribute $ats2) {
         $p1 = $ats2->getTimeleft() - $ats1->getTimeleft();
         $p2 = $ats1->getPA()->getStartSchedule()->getTimestamp() - $ats2->getPA()->getStartSchedule()->getTimestamp();
         $test = min(1, max(-1, $p1)) * 2 + min(1, max(-1, $p2));
         return min(1, max(-1, $test));
     });
     /*
            // Sort by playground asc, match start asc, time left desc,
             function (PlaygroundAttribute $ats1, PlaygroundAttribute $ats2) {
                $p1 = $ats1->getPA()->getStartSchedule()->getTimestamp() - $ats2->getPA()->getStartSchedule()->getTimestamp();
                $p2 = $ats2->getTimeleft() - $ats1->getTimeleft();
                $p3 = $ats1->getPlayground()->getNo() - $ats2->getPlayground()->getNo();
                $test = min(1, max(-1, $p1))*4 + min(1, max(-1, $p2))*2 + min(1, max(-1, $p3));
                return min(1, max(-1, $test));
            }
     */
     $matchtime = $match->getCategory()->getMatchtime();
     /* @var $pa PA */
     while ($pa = $result->cycleTimeslot()) {
         $slotschedule = $pa->getSchedule();
         $slot_time_left = $pa->getTimeleft();
         while ($matchtime <= $slot_time_left) {
             if ($result->isQScheduleAvailable($match, $slotschedule, $pa->getTimeslot())) {
                 $match->setDate(Date::getDate($slotschedule));
                 $match->setTime(Date::getTime($slotschedule));
                 $match->setPlayground($pa->getPlayground());
                 $slotschedule->add(new DateInterval('PT' . $matchtime . 'M'));
                 $pa->setSchedule($slotschedule);
                 $matchlist = $pa->getMatchlist();
                 $matchlist[] = $match;
                 $pa->setMatchlist($matchlist);
                 $result->setQSchedule($match, $match->getSchedule());
                 $result->rewind();
                 return true;
             }
             $slotschedule->add(new DateInterval('PT' . $matchtime . 'M'));
             $slot_time_left -= $matchtime;
         }
     }
     return false;
 }
 private function commitImport($parseObj, $date)
 {
     $matchdate = date_create_from_format($this->get('translator')->trans('FORMAT.DATE'), $date);
     $matchtime = date_create_from_format($this->get('translator')->trans('FORMAT.TIME'), $parseObj['time']);
     if ($matchdate === false || $matchtime === false) {
         throw new ValidationException("BADDATE", "date=" . $date . " time=" . $parseObj['time']);
     }
     $matchrec = new Match();
     $matchrec->setMatchno($parseObj['id']);
     $matchrec->setDate(Date::getDate($matchdate));
     $matchrec->setTime(Date::getTime($matchtime));
     $matchrec->setGroup($parseObj['group']);
     $matchrec->setPlayground($parseObj['playground']);
     $resultreqA = new MatchRelation();
     $resultreqA->setTeam($parseObj['teamA']);
     $resultreqA->setAwayteam(false);
     $resultreqA->setScorevalid(false);
     $resultreqA->setScore(0);
     $resultreqA->setPoints(0);
     $matchrec->addMatchRelation($resultreqA);
     $resultreqB = new MatchRelation();
     $resultreqB->setTeam($parseObj['teamB']);
     $resultreqB->setAwayteam(true);
     $resultreqB->setScorevalid(false);
     $resultreqB->setScore(0);
     $resultreqB->setPoints(0);
     $matchrec->addMatchRelation($resultreqB);
     $em = $this->getDoctrine()->getManager();
     $em->persist($matchrec);
     $em->flush();
 }
 private function copyNewsForm(News $news)
 {
     $newsForm = new NewsForm();
     $newsForm->setId($news->getId());
     $newsForm->setTournament($news->getTournament());
     $newsForm->setNewsno($news->getNewsno());
     $newsForm->setNewstype($news->getNewstype());
     $newsForm->setLanguage($news->getLanguage());
     $newsForm->setTitle($news->getTitle());
     $newsForm->setContext($news->getContext());
     $dateformat = $this->get('translator')->trans('FORMAT.DATE');
     $eventdate = Date::getDateTime($news->getDate());
     $newsForm->setDate(date_format($eventdate, $dateformat));
     $newsForm->setTeam($news->getTeam());
     $newsForm->setMatch($news->getMatch());
     return $newsForm;
 }
Example #10
0
 private function addSchedules(Tournament $tournament, Timeslot $timeslot, DateTime $start, DateTime $end, $final)
 {
     /* @var $site Site */
     foreach ($tournament->getSites() as $site) {
         /* @var $playground Playground */
         foreach ($site->getPlaygrounds() as $playground) {
             $pattr = new PlaygroundAttribute();
             $pattr->setTimeslot($timeslot);
             $pattr->setPlayground($playground);
             $pattr->setDate(Date::getDate($start));
             $pattr->setStart(Date::getTime($start));
             $pattr->setEnd(Date::getTime($end));
             $pattr->setFinals($final);
             $playground->getPlaygroundAttributes()->add($pattr);
             $timeslot->getPlaygroundattributes()->add($pattr);
         }
     }
 }
Example #11
0
 /**
  * Return planned tournament schedule
  * The planTournament function must have been called to generate the match schedule
  * @param $tournament
  * @return array
  */
 public function getSchedule(Tournament $tournament)
 {
     $matches = array();
     $unassigned = array();
     $ts = $this->makeTimeslotTable($tournament);
     $catcnt = array();
     $advice = array();
     $matchschedules = $this->logic->listMatchSchedules($tournament);
     /* @var $ms MatchSchedule */
     foreach ($matchschedules as $ms) {
         $match = new MatchPlan();
         $this->buildMatchPlan($ms, $match);
         if ($ms->getPlan()) {
             $this->prepareMatch($match, $ms->getPlan(), $ts);
             $matches[] = $match;
         } else {
             $match->setMatchno(0);
             $advice[] = $this->prepareUnassignedMatch($match, $ms->getId(), $ts, $catcnt);
             $unassigned[] = $match;
         }
     }
     $qmatchschedules = $this->logic->listQMatchSchedules($tournament);
     /* @var $qms QMatchSchedule */
     foreach ($qmatchschedules as $qms) {
         $match = new QMatchPlan();
         $this->buildQMatchPlan($qms, $match);
         if ($qms->getPlan()) {
             $this->prepareMatch($match, $qms->getPlan(), $ts);
             $matches[] = $match;
         } else {
             $match->setMatchno(0);
             $advice[] = $this->prepareUnassignedMatch($match, $qms->getId(), $ts, $catcnt);
             $unassigned[] = $match;
         }
     }
     usort($matches, function (MatchPlan $match1, MatchPlan $match2) {
         $p1 = $match1->getDate() - $match2->getDate();
         $p2 = $match1->getPlayground()->getNo() - $match2->getPlayground()->getNo();
         $p3 = $match1->getTime() - $match2->getTime();
         $test = min(1, max(-1, $p1)) * 4 + min(1, max(-1, $p2)) * 2 + min(1, max(-1, $p3));
         return min(1, max(-1, $test));
     });
     $mno = 1;
     /* @var $match MatchPlan */
     foreach ($matches as $match) {
         $match->setMatchno($mno);
         $mno++;
     }
     usort($ts, function (PA $ats1, PA $ats2) {
         $p1 = Date::getDate($ats1->getSchedule()) - Date::getDate($ats2->getSchedule());
         $p2 = $ats1->getPlayground()->getNo() - $ats2->getPlayground()->getNo();
         $p3 = $ats1->getTimeslot()->getId() - $ats2->getTimeslot()->getId();
         $test = min(1, max(-1, $p1)) * 4 + min(1, max(-1, $p2)) * 2 + min(1, max(-1, $p3));
         return min(1, max(-1, $test));
     });
     return array('matches' => $matches, 'unassigned' => $unassigned, 'timeslots' => $ts, 'advices' => $advice, 'unassigned_by_category' => $catcnt);
 }
 private function getOverviewResponse($tournament, $date, Request $request)
 {
     /* @var $utilService Util */
     $utilService = $this->get('util');
     $utilService->setTournamentKey($tournament);
     $tournament = $utilService->getTournament();
     if ($tournament == null) {
         return $this->redirect($this->generateUrl('_tournament_select'));
     }
     /* @var $matchDate DateTime */
     $matchDate = $this->get('match')->getMatchDate($tournament->getId(), $date);
     if (!$matchDate) {
         // No match dates have been defined - use currect date to avoid exception
         $matchDate = new DateTime();
     }
     $pattrs = $this->get('logic')->listPlaygroundAttributesByTournament($tournament->getId());
     $pattrList = array();
     /* @var $pattr PlaygroundAttribute */
     foreach ($pattrs as $pattr) {
         $pattrList[$pattr->getPlayground()->getId()][] = $pattr;
     }
     $newsStream = $this->get('tmnt')->listNewsByTournament($tournament->getId());
     $newsRef = array();
     $newsRefTeam = array();
     $newsGeneral = array();
     $today = new DateTime();
     foreach ($newsStream as $news) {
         $news['newsdate'] = Date::getDateTime($news['date']);
         if ($news['id'] > 0) {
             $newsRefTeam[$news['id']][$news['newsno']][$news['language']] = $news;
             continue;
         }
         if ($news['mid'] > 0) {
             $newsRef[$news['mid']][$news['newsno']][$news['language']] = $news;
             continue;
         }
         /* @var $diff \DateInterval */
         $diff = $today->diff($news['newsdate']);
         if ($news['newstype'] == News::$TYPE_PERMANENT || $diff->days < 2) {
             $newsGeneral[$news['newsno']][$news['language']] = $news;
         }
     }
     $matches = $this->get('match')->listMatchesByDate($tournament->getId(), $matchDate);
     $matchList = array();
     foreach ($matches as $match) {
         $matchNews = array();
         if (array_key_exists($match['id'], $newsRef)) {
             $matchNews = array_merge($matchNews, $this->getNews($newsRef[$match['id']], $request));
         }
         if (array_key_exists($match['home']['id'], $newsRefTeam)) {
             $matchNews = array_merge($matchNews, $this->getNews($newsRefTeam[$match['home']['id']], $request));
         }
         if (array_key_exists($match['away']['id'], $newsRefTeam)) {
             $matchNews = array_merge($matchNews, $this->getNews($newsRefTeam[$match['away']['id']], $request));
         }
         $match['news'] = $matchNews;
         $slotid = 0;
         foreach ($pattrList[$match['playground']['id']] as $pattr) {
             $diffstart = $pattr->getStartSchedule()->getTimestamp() - $match['schedule']->getTimestamp();
             $diffend = $pattr->getEndSchedule()->getTimestamp() - $match['schedule']->getTimestamp();
             if ($diffend >= 0 && $diffstart <= 0) {
                 $match['timeslot'] = $pattr->getTimeslot();
                 $matchList[] = $match;
                 $slotid = $pattr->getTimeslot()->getId();
                 break;
             }
         }
         if (!$slotid) {
             $match['timeslot'] = new Timeslot();
             $matchList[] = $match;
         }
     }
     usort($matchList, function ($match1, $match2) {
         $p1 = $match2['timeslot']->getId() - $match1['timeslot']->getId();
         $p2 = $match2['playground']['no'] - $match1['playground']['no'];
         $p3 = $match2['schedule']->getTimestamp() - $match1['schedule']->getTimestamp();
         $p4 = 0;
         if ($p1 == 0 && $p2 == 0 && $p3 == 0 && $p4 == 0) {
             return 0;
         } elseif ($p1 < 0 || $p1 == 0 && $p2 < 0 || $p1 == 0 && $p2 == 0 && $p3 < 0 || $p1 == 0 && $p2 == 0 && $p3 == 0 && $p4 < 0) {
             return 1;
         } else {
             return -1;
         }
     });
     $teaserList = array(array('titletext' => 'FORM.TEASER.TOURNAMENT.GROUPS.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.GROUPS.DESC', 'path' => $this->generateUrl('_tournament_categories', array('tournament' => $tournament->getKey()))), array('titletext' => 'FORM.TEASER.TOURNAMENT.PLAYGROUNDS.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.PLAYGROUNDS.DESC', 'path' => $this->generateUrl('_tournament_playgrounds', array('tournament' => $tournament->getKey()))), array('titletext' => 'FORM.TEASER.TOURNAMENT.TEAMS.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.TEAMS.DESC', 'path' => $this->generateUrl('_tournament_clubs', array('tournament' => $tournament->getKey()))), array('titletext' => 'FORM.TEASER.TOURNAMENT.WINNERS.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.WINNERS.DESC', 'path' => $this->generateUrl('_tournament_winners', array('tournament' => $tournament->getKey()))), array('titletext' => 'FORM.TEASER.TOURNAMENT.STATISTICS.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.STATISTICS.DESC', 'path' => $this->generateUrl('_tournament_statistics', array('tournament' => $tournament->getKey()))));
     $thisDate = DateTime::createFromFormat(DateTime::ATOM, $matchDate->format(DateTime::ATOM));
     $nextDate = $thisDate->add(new DateInterval("P1D"));
     $nextMatchDate = $this->get('match')->getMatchDate($tournament->getId(), $nextDate);
     if ($nextMatchDate) {
         /* @var $diff DateInterval */
         $diff = $nextMatchDate->diff($matchDate);
         if ($diff->days > 0) {
             array_unshift($teaserList, array('titletext' => 'FORM.TEASER.TOURNAMENT.MOREMATCHES.TITLE', 'text' => 'FORM.TEASER.TOURNAMENT.MOREMATCHES.DESC', 'path' => $this->generateUrl('_tournament_overview_date', array('tournament' => $tournament->getKey(), 'date' => date_format($nextMatchDate, "d-m-Y")))));
         }
     }
     $host = $tournament->getHost();
     return array('host' => $host, 'tournament' => $tournament, 'matchdate' => $matchDate, 'newsstream' => $newsStream, 'newsgeneral' => $this->getNews($newsGeneral, $request), 'matchlist' => $matchList, 'teaserlist' => $teaserList);
 }
Example #13
0
 /**
  * List qualifying match schedules ordered by match time ascending
  * Unassigned match schedules are sorted at the end of the list
  * @param Tournament $tournament
  * @return array sorted match schedule list
  */
 public function listQMatchSchedules(Tournament $tournament)
 {
     $qmatchschedules = $this->entity->getQMatchScheduleRepo()->findBy(array('tournament' => $tournament->getId()));
     usort($qmatchschedules, function (QMatchSchedule $ms1, QMatchSchedule $ms2) {
         if ($ms1->getPlan() && $ms2->getPlan()) {
             $schedule1 = Date::getDateTime($ms1->getPlan()->getPlaygroundAttribute()->getDate(), $ms1->getPlan()->getMatchstart());
             $schedule2 = Date::getDateTime($ms2->getPlan()->getPlaygroundAttribute()->getDate(), $ms2->getPlan()->getMatchstart());
             return min(1, max(-1, $schedule1->getTimestamp() - $schedule2->getTimestamp()));
         }
         return (!$ms2->getPlan() ? 0 : 1) - (!$ms1->getPlan() ? 0 : 1);
     });
     return $qmatchschedules;
 }
Example #14
0
 /**
  * @param PlanningResults $result
  * @param MatchPlan $match
  * @return boolean
  */
 private function replanMatch_1run(PlanningResults $result, MatchPlan $match)
 {
     // Sort playground attributes and prepare for inspection
     $result->mark(function (PlaygroundAttribute $ats1, PlaygroundAttribute $ats2) {
         $p1 = $ats2->getTimeleft() - $ats1->getTimeleft();
         $p2 = $ats1->getPA()->getStartSchedule()->getTimestamp() - $ats2->getPA()->getStartSchedule()->getTimestamp();
         $test = min(1, max(-1, $p1)) * 2 + min(1, max(-1, $p2));
         return min(1, max(-1, $test));
     });
     $matchtime = $match->getCategory()->getMatchtime();
     while ($pa = $result->cycleTimeslot()) {
         /* @var $slotschedule DateTime */
         $slotschedule = $pa->getSchedule();
         $date = Date::getDate($slotschedule);
         $time = Date::getTime($slotschedule);
         $slot_time_left = $pa->getTimeleft();
         if ($matchtime <= $slot_time_left) {
             /* Both teams must be allowed to play now */
             if ($result->getTeamCheck()->isCapacity($match, $slotschedule, $pa->getPlayground(), $pa->getTimeslot())) {
                 $match->setDate($date);
                 $match->setTime($time);
                 $match->setPlayground($pa->getPlayground());
                 $slotschedule->add(new DateInterval('PT' . $matchtime . 'M'));
                 $pa->setSchedule($slotschedule);
                 $matchlist = $pa->getMatchlist();
                 $matchlist[] = $match;
                 $pa->setMatchlist($matchlist);
                 $result->getTeamCheck()->reserveCapacity($match, $pa->getTimeslot());
                 $result->rewind();
                 return true;
             }
         }
     }
     return false;
 }
 private function copyMatchForm(Match $match)
 {
     $matchForm = new MatchForm();
     $matchForm->setId($match->getId());
     $matchForm->setGroup($match->getGroup());
     $matchForm->setMatchno($match->getMatchno());
     $matchdate = Date::getDateTime($match->getDate(), $match->getTime());
     $dateformat = $this->get('translator')->trans('FORMAT.DATE');
     $matchForm->setDate(date_format($matchdate, $dateformat));
     $timeformat = $this->get('translator')->trans('FORMAT.TIME');
     $matchForm->setTime(date_format($matchdate, $timeformat));
     $matchForm->setPlayground($match->getPlayground());
     $matchForm->setTeamA($this->get('match')->getMatchHomeTeam($match->getId()));
     $matchForm->setTeamB($this->get('match')->getMatchAwayTeam($match->getId()));
     return $matchForm;
 }
Example #16
0
 public function listMatchesByDate($tournamentid, DateTime $date, $club_list = array())
 {
     $matchList = $this->queryMatchListWithTournament($tournamentid, Date::getDate($date));
     $qmatchList = $this->queryQMatchListWithTournament($tournamentid, Date::getDate($date));
     return $this->prepareAndSort($matchList, $qmatchList, $club_list);
 }
 private function copyMatchForm(Match $match)
 {
     $matchForm = new MatchForm();
     $matchForm->setId($match->getId());
     $matchForm->setPid($match->getGroup()->getId());
     $matchForm->setMatchno($match->getMatchno());
     $matchdate = Date::getDateTime($match->getDate(), $match->getTime());
     $dateformat = $this->get('translator')->trans('FORMAT.DATE');
     $matchForm->setDate(date_format($matchdate, $dateformat));
     $timeformat = $this->get('translator')->trans('FORMAT.TIME');
     $matchForm->setTime(date_format($matchdate, $timeformat));
     $matchForm->setPlayground($match->getPlayground());
     /* @var $homeRel QMatchRelation */
     $homeRel = $this->get('match')->getQMatchRelationByMatch($match->getId(), false);
     if ($homeRel != null) {
         $matchForm->setGroupA($homeRel->getGroup()->getId());
         $matchForm->setRankA($homeRel->getRank());
     }
     /* @var $awayRel QMatchRelation */
     $awayRel = $this->get('match')->getQMatchRelationByMatch($match->getId(), true);
     if ($awayRel != null) {
         $matchForm->setGroupB($awayRel->getGroup()->getId());
         $matchForm->setRankB($awayRel->getRank());
     }
     return $matchForm;
 }
 private function getResponses($result)
 {
     $outputar = array("matchno;date;time;category;group;playground;teamA;teamB");
     /* @var $match MatchPlan */
     foreach ($result['matches'] as $match) {
         $schedule = Date::getDateTime($match->getDate(), $match->getTime());
         $date = date_format($schedule, "j-n-Y");
         $time = date_format($schedule, "G.i");
         $outputstr = $match->getMatchno() . ';' . $date . ';' . $time . ';"' . $match->getCategory()->getName() . '";"' . $match->getGroup()->getName() . '";"' . $match->getPlayground()->getNo() . '";"' . str_replace('"', "'", $match->getTeamA()->getName()) . " (" . $match->getTeamA()->getCountry() . ")" . '";"' . str_replace('"', "'", $match->getTeamB()->getName()) . " (" . $match->getTeamB()->getCountry() . ")" . '"';
         $outputar[] = $outputstr;
     }
     if (count($result['unassigned']) > 0) {
         $outputar[] = ";;;;;;;";
         foreach ($result['unassigned'] as $match) {
             $outputstr = ';;;"' . $match->getCategory()->getName() . '";"' . $match->getGroup()->getName() . '";;"' . str_replace('"', "'", $match->getTeamA()->getName()) . " (" . $match->getTeamA()->getCountry() . ")" . '";"' . str_replace('"', "'", $match->getTeamB()->getName()) . " (" . $match->getTeamB()->getCountry() . ")" . '"';
             $outputar[] = $outputstr;
         }
     }
     $outputar[] = ";;;;;;;";
     $tid = array();
     foreach ($result['matches'] as $match) {
         if (!isset($tid[$match->getTeamA()->getId()])) {
             $outputstr = '"' . $match->getCategory()->getName() . '";"' . $match->getGroup()->getName() . '";"' . str_replace('"', "'", $match->getTeamA()->getName()) . " (" . $match->getTeamA()->getCountry() . ")" . '"';
             $tid[$match->getTeamA()->getId()] = $match->getTeamA()->getName();
             $outputar[] = $outputstr;
         }
     }
     return $outputar;
 }
Example #19
0
 private function freeTeamCapacity(Team $team, MatchPlan $match, Timeslot $timeslot)
 {
     $date = Date::getDate($match->getSchedule());
     $time = Date::getTime($match->getSchedule());
     $key = $this->makeKey($team, $date, $timeslot);
     unset($this->teams[$key][$time]);
 }