HomeController.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Muzich\HomeBundle\Controller;
  3. use Muzich\CoreBundle\lib\Controller;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  5. use Doctrine\ORM\Query;
  6. use Muzich\CoreBundle\Form\Search\ElementSearchForm;
  7. use Muzich\CoreBundle\Form\Element\ElementAddForm;
  8. class HomeController extends Controller
  9. {
  10. /**
  11. * Page d'accueil ("home") de l'utilisateur. Cette page regroupe le fil
  12. * d'éléments général et personalisable et de quoi ajouter un élément.
  13. *
  14. * @Template()
  15. */
  16. public function indexAction()
  17. {
  18. $search_object = $this->getElementSearcher();
  19. $search_form = $this->createForm(
  20. new ElementSearchForm(),
  21. $search_object->getParams(),
  22. array(
  23. 'tags' => $tags = $this->getTagsArray()
  24. )
  25. );
  26. $add_form = $this->createForm(
  27. new ElementAddForm(),
  28. array(),
  29. array(
  30. 'tags' => $tags,
  31. 'groups' => $this->getGroupsArray(),
  32. )
  33. );
  34. return array(
  35. 'user' => $this->getUser(),
  36. 'add_form' => $add_form->createView(),
  37. 'search_form' => $search_form->createView(),
  38. 'elements' => $search_object->getElements($this->getDoctrine(), $this->getUserId())
  39. );
  40. }
  41. }