| @@ 1631-1660 (lines=30) @@ | ||
| 1628 | * @param array $data |
|
| 1629 | * @return \PlaygroundGame\Entity\Game |
|
| 1630 | */ |
|
| 1631 | public function createForm(array $data, $game, $form = null) |
|
| 1632 | { |
|
| 1633 | $title = ''; |
|
| 1634 | $description = ''; |
|
| 1635 | ||
| 1636 | if ($data['form_jsonified']) { |
|
| 1637 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 1638 | foreach ($jsonPV as $element) { |
|
| 1639 | if ($element->form_properties) { |
|
| 1640 | $attributes = $element->form_properties[0]; |
|
| 1641 | $title = $attributes->title; |
|
| 1642 | $description = $attributes->description; |
|
| 1643 | ||
| 1644 | break; |
|
| 1645 | } |
|
| 1646 | } |
|
| 1647 | } |
|
| 1648 | if (! $form) { |
|
| 1649 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 1650 | } |
|
| 1651 | $form->setGame($game); |
|
| 1652 | $form->setTitle($title); |
|
| 1653 | $form->setDescription($description); |
|
| 1654 | $form->setForm($data['form_jsonified']); |
|
| 1655 | $form->setFormTemplate($data['form_template']); |
|
| 1656 | ||
| 1657 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 1658 | ||
| 1659 | return $form; |
|
| 1660 | } |
|
| 1661 | ||
| 1662 | /** |
|
| 1663 | * getCSV creates lines of CSV and returns it. |
|
| @@ 265-294 (lines=30) @@ | ||
| 262 | * @param array $data |
|
| 263 | * @return \PlaygroundGame\Entity\Game |
|
| 264 | */ |
|
| 265 | public function createForm(array $data, $game, $form = null) |
|
| 266 | { |
|
| 267 | $title =''; |
|
| 268 | $description = ''; |
|
| 269 | ||
| 270 | if ($data['form_jsonified']) { |
|
| 271 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 272 | foreach ($jsonPV as $element) { |
|
| 273 | if ($element->form_properties) { |
|
| 274 | $attributes = $element->form_properties[0]; |
|
| 275 | $title = $attributes->title; |
|
| 276 | $description = $attributes->description; |
|
| 277 | ||
| 278 | break; |
|
| 279 | } |
|
| 280 | } |
|
| 281 | } |
|
| 282 | if (!$form) { |
|
| 283 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 284 | } |
|
| 285 | $form->setPostvote($game); |
|
| 286 | $form->setTitle($title); |
|
| 287 | $form->setDescription($description); |
|
| 288 | $form->setForm($data['form_jsonified']); |
|
| 289 | $form->setFormTemplate($data['form_template']); |
|
| 290 | ||
| 291 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 292 | ||
| 293 | return $form; |
|
| 294 | } |
|
| 295 | ||
| 296 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 297 | { |
|