private function makePlanForm(Tournament $tournament)
 {
     $options = new PlanningOptions();
     $options->setDoublematch($tournament->getOption()->isDrr());
     $formDef = $this->createFormBuilder($options);
     $formDef->add('doublematch', 'checkbox', array('label' => 'FORM.MATCHPLANNING.DOUBLEMATCH.PROMPT', 'help' => 'FORM.MATCHPLANNING.DOUBLEMATCH.HELP', 'required' => false, 'disabled' => false, 'translation_domain' => 'admin'));
     $formDef->add('preferpg', 'checkbox', array('label' => 'FORM.MATCHPLANNING.PREFERPG.PROMPT', 'help' => 'FORM.MATCHPLANNING.PREFERPG.HELP', 'required' => false, 'disabled' => false, 'translation_domain' => 'admin'));
     $formDef->add('save', 'submit', array('label' => 'FORM.MATCHPLANNING.SUBMIT', 'translation_domain' => 'admin', 'icon' => 'fa fa-check'));
     return $formDef->getForm();
 }
 private function importTournament(Tournament $source_tournament, Tournament $tournament)
 {
     $em = $this->getDoctrine()->getEntityManager();
     $em->beginTransaction();
     try {
         $tournament->setKey(uniqid());
         $tournament->setEdition($source_tournament->getEdition());
         $tournament->setName($source_tournament->getName() . ' ' . $this->get('translator')->trans('FORM.TOURNAMENTIMPORT.COPY', array(), 'admin'));
         $tournament->setDescription($source_tournament->getDescription());
         $tournament->getOption()->setDrr($source_tournament->getOption()->isDrr());
         $tournament->getOption()->setStrategy($source_tournament->getOption()->getStrategy());
         $tournament->getOption()->setWpoints($source_tournament->getOption()->getWpoints());
         $tournament->getOption()->setTpoints($source_tournament->getOption()->getTpoints());
         $tournament->getOption()->setLpoints($source_tournament->getOption()->getLpoints());
         $tournament->getOption()->setDscore($source_tournament->getOption()->getDscore());
         $em->persist($tournament);
         $em->flush();
         $this->importSites($source_tournament, $tournament);
         $em->commit();
     } catch (Exception $e) {
         $em->rollBack();
         throw $e;
     }
 }
Example #3
0
 public function updatePoints(Tournament $tournament, &$relA, &$relB)
 {
     $looserPoints = $tournament->getOption()->getLpoints();
     $tiePoints = $tournament->getOption()->getTpoints();
     $winnerPoints = $tournament->getOption()->getWpoints();
     if ($relA->getScore() > $relB->getScore()) {
         $relA->setPoints($winnerPoints);
         $relB->setPoints($looserPoints);
     } else {
         if ($relA->getScore() < $relB->getScore()) {
             $relA->setPoints($looserPoints);
             $relB->setPoints($winnerPoints);
         } else {
             $relA->setPoints($tiePoints);
             $relB->setPoints($tiePoints);
         }
     }
 }