@@ 2117-2146 (lines=30) @@ | ||
2114 | * @param array $data |
|
2115 | * @return \PlaygroundGame\Entity\Game |
|
2116 | */ |
|
2117 | public function createForm(array $data, $game, $form = null) |
|
2118 | { |
|
2119 | $title = ''; |
|
2120 | $description = ''; |
|
2121 | ||
2122 | if ($data['form_jsonified']) { |
|
2123 | $jsonPV = json_decode($data['form_jsonified']); |
|
2124 | foreach ($jsonPV as $element) { |
|
2125 | if ($element->form_properties) { |
|
2126 | $attributes = $element->form_properties[0]; |
|
2127 | $title = $attributes->title; |
|
2128 | $description = $attributes->description; |
|
2129 | ||
2130 | break; |
|
2131 | } |
|
2132 | } |
|
2133 | } |
|
2134 | if (! $form) { |
|
2135 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
2136 | } |
|
2137 | $form->setGame($game); |
|
2138 | $form->setTitle($title); |
|
2139 | $form->setDescription($description); |
|
2140 | $form->setForm($data['form_jsonified']); |
|
2141 | $form->setFormTemplate($data['form_template']); |
|
2142 | ||
2143 | $form = $this->getPlayerFormMapper()->insert($form); |
|
2144 | ||
2145 | return $form; |
|
2146 | } |
|
2147 | ||
2148 | /** |
|
2149 | * getCSV creates lines of CSV and returns it. |
@@ 332-361 (lines=30) @@ | ||
329 | * @param array $data |
|
330 | * @return \PlaygroundGame\Entity\Game |
|
331 | */ |
|
332 | public function createForm(array $data, $game, $form = null) |
|
333 | { |
|
334 | $title =''; |
|
335 | $description = ''; |
|
336 | ||
337 | if ($data['form_jsonified']) { |
|
338 | $jsonPV = json_decode($data['form_jsonified']); |
|
339 | foreach ($jsonPV as $element) { |
|
340 | if ($element->form_properties) { |
|
341 | $attributes = $element->form_properties[0]; |
|
342 | $title = $attributes->title; |
|
343 | $description = $attributes->description; |
|
344 | ||
345 | break; |
|
346 | } |
|
347 | } |
|
348 | } |
|
349 | if (!$form) { |
|
350 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
351 | } |
|
352 | $form->setPostvote($game); |
|
353 | $form->setTitle($title); |
|
354 | $form->setDescription($description); |
|
355 | $form->setForm($data['form_jsonified']); |
|
356 | $form->setFormTemplate($data['form_template']); |
|
357 | ||
358 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
359 | ||
360 | return $form; |
|
361 | } |
|
362 | ||
363 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
364 | { |