private function makeMatchForm($matchForm, Category $category, $noofgroups) { $groupnames = array(); /* @var $group Group */ foreach ($category->getGroups() as $group) { $groupnames[$group->getId()] = $group->getName(); } $show = true; $formDef = $this->createFormBuilder($matchForm); switch ($noofgroups) { case 1: $formDef->add('strategy', 'choice', array('label' => 'FORM.QMATCHPLANNING.GROUP.ONE', 'placeholder' => false, 'choices' => array('option1' => 'FORM.QMATCHPLANNING.RADIO.GROUP1.OPTION1', 'option2' => 'FORM.QMATCHPLANNING.RADIO.GROUP1.OPTION2'), 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin', 'expanded' => true, 'multiple' => false)); break; case 2: $formDef->add('strategy', 'choice', array('label' => 'FORM.QMATCHPLANNING.GROUP.TWO', 'placeholder' => false, 'choices' => array('option1' => 'FORM.QMATCHPLANNING.RADIO.GROUP2.OPTION1', 'option2' => 'FORM.QMATCHPLANNING.RADIO.GROUP2.OPTION2', 'option3' => 'FORM.QMATCHPLANNING.RADIO.GROUP2.OPTION3'), 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin', 'expanded' => true, 'multiple' => false)); break; case 3: $formDef->add('strategy', 'choice', array('label' => 'FORM.QMATCHPLANNING.GROUP.THREE', 'placeholder' => false, 'choices' => array('option1' => 'FORM.QMATCHPLANNING.RADIO.GROUP3.OPTION1', 'option2' => 'FORM.QMATCHPLANNING.RADIO.GROUP3.OPTION2'), 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin', 'expanded' => true, 'multiple' => false)); break; case 4: $formDef->add('strategy', 'choice', array('label' => 'FORM.QMATCHPLANNING.GROUP.FOUR', 'placeholder' => false, 'choices' => array('option1' => 'FORM.QMATCHPLANNING.RADIO.GROUP4.OPTION1', 'option2' => 'FORM.QMATCHPLANNING.RADIO.GROUP4.OPTION2'), 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin', 'expanded' => true, 'multiple' => false)); break; } $formDef->add('cancel', 'submit', array('label' => 'FORM.MATCH.CANCEL.CHG', 'translation_domain' => 'admin', 'buttontype' => 'btn btn-default', 'icon' => 'fa fa-times')); $formDef->add('save', 'submit', array('label' => 'FORM.MATCH.SUBMIT.CHG', 'translation_domain' => 'admin', 'icon' => 'fa fa-check')); return $formDef->getForm(); }
private function makeMatchForm(MatchForm $matchForm, Category $category, $classification, $action) { $groupnames = array(); foreach ($category->getGroups() as $group) { if ($group->getClassification() < $classification && $group->getClassification() < Group::$BRONZE) { $groupnames[$group->getId()] = $this->get('translator')->trans('GROUP', array(), 'tournament') . " " . $group->getName(); } } $show = $action != 'del'; $formDef = $this->createFormBuilder($matchForm); $formDef->add('groupA', 'choice', array('label' => 'FORM.MATCH.QHOME.GROUP', 'choices' => $groupnames, 'empty_value' => 'FORM.MATCH.DEFAULT', 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin')); $formDef->add('rankA', 'text', array('label' => 'FORM.MATCH.QHOME.RANK', 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin')); $formDef->add('groupB', 'choice', array('label' => 'FORM.MATCH.QAWAY.GROUP', 'choices' => $groupnames, 'empty_value' => 'FORM.MATCH.DEFAULT', 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin')); $formDef->add('rankB', 'text', array('label' => 'FORM.MATCH.QAWAY.RANK', 'required' => false, 'disabled' => !$show, 'translation_domain' => 'admin')); $formDef->add('cancel', 'submit', array('label' => 'FORM.MATCH.CANCEL.' . strtoupper($action), 'translation_domain' => 'admin', 'buttontype' => 'btn btn-default', 'icon' => 'fa fa-times')); $formDef->add('save', 'submit', array('label' => 'FORM.MATCH.SUBMIT.' . strtoupper($action), 'translation_domain' => 'admin', 'icon' => 'fa fa-check')); return $formDef->getForm(); }