@@ 2104-2133 (lines=30) @@ | ||
2101 | * @param array $data |
|
2102 | * @return \PlaygroundGame\Entity\Game |
|
2103 | */ |
|
2104 | public function createForm(array $data, $game, $form = null) |
|
2105 | { |
|
2106 | $title = ''; |
|
2107 | $description = ''; |
|
2108 | ||
2109 | if ($data['form_jsonified']) { |
|
2110 | $jsonPV = json_decode($data['form_jsonified']); |
|
2111 | foreach ($jsonPV as $element) { |
|
2112 | if ($element->form_properties) { |
|
2113 | $attributes = $element->form_properties[0]; |
|
2114 | $title = $attributes->title; |
|
2115 | $description = $attributes->description; |
|
2116 | ||
2117 | break; |
|
2118 | } |
|
2119 | } |
|
2120 | } |
|
2121 | if (! $form) { |
|
2122 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
2123 | } |
|
2124 | $form->setGame($game); |
|
2125 | $form->setTitle($title); |
|
2126 | $form->setDescription($description); |
|
2127 | $form->setForm($data['form_jsonified']); |
|
2128 | $form->setFormTemplate($data['form_template']); |
|
2129 | ||
2130 | $form = $this->getPlayerFormMapper()->insert($form); |
|
2131 | ||
2132 | return $form; |
|
2133 | } |
|
2134 | ||
2135 | /** |
|
2136 | * getCSV creates lines of CSV and returns it. |
@@ 324-353 (lines=30) @@ | ||
321 | * @param array $data |
|
322 | * @return \PlaygroundGame\Entity\Game |
|
323 | */ |
|
324 | public function createForm(array $data, $game, $form = null) |
|
325 | { |
|
326 | $title =''; |
|
327 | $description = ''; |
|
328 | ||
329 | if ($data['form_jsonified']) { |
|
330 | $jsonPV = json_decode($data['form_jsonified']); |
|
331 | foreach ($jsonPV as $element) { |
|
332 | if ($element->form_properties) { |
|
333 | $attributes = $element->form_properties[0]; |
|
334 | $title = $attributes->title; |
|
335 | $description = $attributes->description; |
|
336 | ||
337 | break; |
|
338 | } |
|
339 | } |
|
340 | } |
|
341 | if (!$form) { |
|
342 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
343 | } |
|
344 | $form->setPostvote($game); |
|
345 | $form->setTitle($title); |
|
346 | $form->setDescription($description); |
|
347 | $form->setForm($data['form_jsonified']); |
|
348 | $form->setFormTemplate($data['form_template']); |
|
349 | ||
350 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
351 | ||
352 | return $form; |
|
353 | } |
|
354 | ||
355 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
356 | { |