1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| public function collectPoemDataAction() {
/* Collector collects all the data inputs */
$collector = $this->get('yop.poem.datacollector');
/* selector selects which raw verses will be used */
$selector = $this->get('yop.poem.verseSelector');
/* customizer customizes the raw poem with data
* input by the visitor to make the real poem
*/
$customizer = $this->get('yop.poem.poemcustomizer');
/* customizedPoem contains the customized poems lines :
* 5 intro, 5 msg and 5 trait lines
*/
$customizedPoem = new CustomizedPoem();
$request = $this->get('request');
$flow = $this->get('yop.form.flow.poemDataCollector');
$formHandler = new PoemDataCollectorHandler(
$flow,
$request,
$collector,
$selector,
$customizer,
$customizedPoem
);
$process = $formHandler->process();
switch ($process)
{
case 1:
return $this->render('YOPYourOwnPoetBundle:thePoet:collectPoemData.html.twig',array(
'form' => $flow->createForm($collector)->createView(),
'flow' => $flow,
));
break;
case 2:
return $this->render('YOPYourOwnPoetBundle:thePoet:showPoem.html.twig',array(
'poem' => $customizedPoem,
'city' => $collector->getCityNbSlb(),
'name' => $collector->getNameNbSlb(),
'relationship' => $collector->getRelationshipNbSlb(),
));
break;
default:
$url = $this->get('router')->generate('poem_generator');
$url_test = $this->get('router')->generate('test_link');
return $this->render('YOPYourOwnPoetBundle:Default:index.html.twig', array(
'link' => $url,
'test_link' => $url_test,
));
break;
}
} |
Partager