@@ 2136-2165 (lines=30) @@ | ||
2133 | * @param array $data |
|
2134 | * @return \PlaygroundGame\Entity\Game |
|
2135 | */ |
|
2136 | public function createForm(array $data, $game, $form = null) |
|
2137 | { |
|
2138 | $title = ''; |
|
2139 | $description = ''; |
|
2140 | ||
2141 | if ($data['form_jsonified']) { |
|
2142 | $jsonPV = json_decode($data['form_jsonified']); |
|
2143 | foreach ($jsonPV as $element) { |
|
2144 | if ($element->form_properties) { |
|
2145 | $attributes = $element->form_properties[0]; |
|
2146 | $title = $attributes->title; |
|
2147 | $description = $attributes->description; |
|
2148 | ||
2149 | break; |
|
2150 | } |
|
2151 | } |
|
2152 | } |
|
2153 | if (! $form) { |
|
2154 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
2155 | } |
|
2156 | $form->setGame($game); |
|
2157 | $form->setTitle($title); |
|
2158 | $form->setDescription($description); |
|
2159 | $form->setForm($data['form_jsonified']); |
|
2160 | $form->setFormTemplate($data['form_template']); |
|
2161 | ||
2162 | $form = $this->getPlayerFormMapper()->insert($form); |
|
2163 | ||
2164 | return $form; |
|
2165 | } |
|
2166 | ||
2167 | /** |
|
2168 | * getCSV creates lines of CSV and returns it. |
@@ 359-388 (lines=30) @@ | ||
356 | * @param array $data |
|
357 | * @return \PlaygroundGame\Entity\Game |
|
358 | */ |
|
359 | public function createForm(array $data, $game, $form = null) |
|
360 | { |
|
361 | $title =''; |
|
362 | $description = ''; |
|
363 | ||
364 | if ($data['form_jsonified']) { |
|
365 | $jsonPV = json_decode($data['form_jsonified']); |
|
366 | foreach ($jsonPV as $element) { |
|
367 | if ($element->form_properties) { |
|
368 | $attributes = $element->form_properties[0]; |
|
369 | $title = $attributes->title; |
|
370 | $description = $attributes->description; |
|
371 | ||
372 | break; |
|
373 | } |
|
374 | } |
|
375 | } |
|
376 | if (!$form) { |
|
377 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
378 | } |
|
379 | $form->setPostvote($game); |
|
380 | $form->setTitle($title); |
|
381 | $form->setDescription($description); |
|
382 | $form->setForm($data['form_jsonified']); |
|
383 | $form->setFormTemplate($data['form_template']); |
|
384 | ||
385 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
386 | ||
387 | return $form; |
|
388 | } |
|
389 | ||
390 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
391 | { |