@@ 2026-2055 (lines=30) @@ | ||
2023 | * @param array $data |
|
2024 | * @return \PlaygroundGame\Entity\Game |
|
2025 | */ |
|
2026 | public function createForm(array $data, $game, $form = null) |
|
2027 | { |
|
2028 | $title = ''; |
|
2029 | $description = ''; |
|
2030 | ||
2031 | if ($data['form_jsonified']) { |
|
2032 | $jsonPV = json_decode($data['form_jsonified']); |
|
2033 | foreach ($jsonPV as $element) { |
|
2034 | if ($element->form_properties) { |
|
2035 | $attributes = $element->form_properties[0]; |
|
2036 | $title = $attributes->title; |
|
2037 | $description = $attributes->description; |
|
2038 | ||
2039 | break; |
|
2040 | } |
|
2041 | } |
|
2042 | } |
|
2043 | if (! $form) { |
|
2044 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
2045 | } |
|
2046 | $form->setGame($game); |
|
2047 | $form->setTitle($title); |
|
2048 | $form->setDescription($description); |
|
2049 | $form->setForm($data['form_jsonified']); |
|
2050 | $form->setFormTemplate($data['form_template']); |
|
2051 | ||
2052 | $form = $this->getPlayerFormMapper()->insert($form); |
|
2053 | ||
2054 | return $form; |
|
2055 | } |
|
2056 | ||
2057 | /** |
|
2058 | * getCSV creates lines of CSV and returns it. |
@@ 280-309 (lines=30) @@ | ||
277 | * @param array $data |
|
278 | * @return \PlaygroundGame\Entity\Game |
|
279 | */ |
|
280 | public function createForm(array $data, $game, $form = null) |
|
281 | { |
|
282 | $title =''; |
|
283 | $description = ''; |
|
284 | ||
285 | if ($data['form_jsonified']) { |
|
286 | $jsonPV = json_decode($data['form_jsonified']); |
|
287 | foreach ($jsonPV as $element) { |
|
288 | if ($element->form_properties) { |
|
289 | $attributes = $element->form_properties[0]; |
|
290 | $title = $attributes->title; |
|
291 | $description = $attributes->description; |
|
292 | ||
293 | break; |
|
294 | } |
|
295 | } |
|
296 | } |
|
297 | if (!$form) { |
|
298 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
299 | } |
|
300 | $form->setPostvote($game); |
|
301 | $form->setTitle($title); |
|
302 | $form->setDescription($description); |
|
303 | $form->setForm($data['form_jsonified']); |
|
304 | $form->setFormTemplate($data['form_template']); |
|
305 | ||
306 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
307 | ||
308 | return $form; |
|
309 | } |
|
310 | ||
311 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
312 | { |