/**
  * Template : Finds and displays a Contact entity.
  * 
  * @Cache(maxage="86400")
  * @return \Symfony\Component\HttpFoundation\Response
  *
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**> 
  */
 public function _template_showAction($id, $template = '_tmp_show.html.twig', $lang = "")
 {
     $em = $this->getDoctrine()->getManager();
     if (empty($lang)) {
         $lang = $this->container->get('request')->getLocale();
     }
     $entity = $em->getRepository("PiAppGedmoBundle:Contact")->findOneByEntity($lang, $id, 'object', false);
     if (!$entity) {
         throw ControllerException::NotFoundEntity('Contact');
     }
     if (method_exists($entity, "getTemplate") && $entity->getTemplate() != "") {
         $template = $entity->getTemplate();
     }
     return $this->render("PiAppGedmoBundle:Contact:{$template}", array('entity' => $entity, 'locale' => $lang));
 }
 /**
  * Deletes a Layout entity.
  * 
  * @Secure(roles="ROLE_SUPER_ADMIN")
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * 
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function deleteAction($id)
 {
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $entity = $em->getRepository('SfynxAuthBundle:Layout')->find($id);
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Layout');
         }
         $em->remove($entity);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('admin_layout'));
 }
 /**
  * Deletes a Langue entity.
  * 
  * @Secure(roles="ROLE_ADMIN")
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * 
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function deleteAction($id)
 {
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $entity = $em->getRepository('SfynxAuthBundle:Langue')->find($id);
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Langue');
         }
         try {
             $em->remove($entity);
             $em->flush();
         } catch (\Exception $e) {
             $this->container->get('request')->getSession()->getFlashBag()->clear();
             $this->container->get('request')->getSession()->getFlashBag()->add('notice', 'pi.session.flash.wrong.undelete');
         }
     }
     return $this->redirect($this->generateUrl('admin_langue'));
 }
 /**
  * Deletes a Word entity.
  *
  * @Secure(roles="ROLE_EDITOR")
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * @access public
  * @author Riad HELLAL <*****@*****.**>     
  */
 public function deleteAction($id)
 {
     $em = $this->getDoctrine()->getManager();
     $locale = $this->container->get('request')->getLocale();
     $NoLayout = $this->container->get('request')->query->get('NoLayout');
     //
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $entity = $em->getRepository("SfynxTranslatorBundle:Word")->findOneByEntity($locale, $id, 'object');
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Word');
         }
         $em->remove($entity);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('admin_word', array('NoLayout' => $NoLayout)));
 }
 /**
  * Deletes a Block entity.
  * 
  * @Secure(roles="ROLE_SUPER_ADMIN")
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * 
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function deleteAction($id)
 {
     $NoLayout = $this->container->get('request')->query->get('NoLayout');
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $entity = $em->getRepository('SfynxCmfBundle:Block')->find($id);
         $id_page = $entity->getPage()->getId();
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Block');
         }
         try {
             $em->remove($entity);
             $em->flush();
         } catch (\Exception $e) {
             $this->container->get('request')->getSession()->getFlashBag()->clear();
             $this->container->get('request')->getSession()->getFlashBag()->add('notice', 'pi.session.flash.wrong.undelete');
         }
     }
     return $this->redirect($this->generateUrl('admin_pagebyblock_show', array('id' => $id_page, 'NoLayout' => $NoLayout)));
 }
 /**
  * Deletes a Slider entity.
  *
  * @Secure(roles="ROLE_EDITOR")
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**>     
  */
 public function deleteAction($id)
 {
     $em = $this->getDoctrine()->getManager();
     $locale = $this->container->get('request')->getLocale();
     $NoLayout = $this->container->get('request')->query->get('NoLayout');
     $category = $this->container->get('request')->query->get('category');
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $entity = $em->getRepository("PiAppGedmoBundle:Slider")->findOneByEntity($locale, $id, 'object');
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Slider');
         }
         try {
             $em->remove($entity);
             $em->flush();
         } catch (\Exception $e) {
             $this->container->get('request')->getSession()->getFlashBag()->clear();
             $this->container->get('request')->getSession()->getFlashBag()->add('notice', 'pi.session.flash.wrong.undelete');
         }
     }
     return $this->redirect($this->generateUrl('admin_gedmo_slider', array('NoLayout' => $NoLayout, 'category' => $category)));
 }
 /**
  * Finds and displays a Page entity.
  * 
  * @param integer $id Id value
  * 
  * @Secure(roles="ROLE_EDITOR")
  * @return Response
  * @access public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function showAction($id)
 {
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('SfynxCmfBundle:Page')->find($id);
     $NoLayout = $this->container->get('request')->query->get('NoLayout');
     if (!$entity) {
         throw ControllerException::NotFoundEntity('Page');
     }
     $deleteForm = $this->createDeleteForm($id);
     return $this->render("SfynxCmfBundle:PageByTrans:show.html.twig", array('entity' => $entity, 'delete_form' => $deleteForm->createView(), 'NoLayout' => $NoLayout));
 }
 /**
  * Template : Finds and displays a Media entity.
  * 
  * @Cache(maxage="86400")
  * @return Response
  * @access public
  * @author Etienne de Longeaux <*****@*****.**> 
  */
 public function _template_showAction($id, $template = '_tmp_show.html.twig', $lang = "")
 {
     $em = $this->getDoctrine()->getManager();
     if (empty($lang)) {
         $lang = $this->container->get('request')->getLocale();
     }
     $entity = $em->getRepository("SfynxMediaBundle:Mediatheque")->findOneByEntity($lang, $id, 'object', false);
     if (!$entity) {
         throw ControllerException::NotFoundEntity('Media');
     }
     return $this->render("SfynxMediaBundle:Mediatheque:{$template}", array('entity' => $entity, 'locale' => $lang, 'lang' => $lang));
 }
 /**
  * Deletes a Widget entity.
  * 
  * @Secure(roles="ROLE_EDITOR")
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  * 
  * @access    public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public function deleteAction($id)
 {
     $NoLayout = $this->container->get('request')->query->get('NoLayout');
     $form = $this->createDeleteForm($id);
     $request = $this->getRequest();
     $form->bind($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $entity = $em->getRepository('SfynxCmfBundle:Widget')->find($id);
         if (!$entity) {
             throw ControllerException::NotFoundEntity('Widget');
         }
         $idBlock = $entity->getBlock()->getId();
         $em->remove($entity);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('admin_blockbywidget_show', array('id' => $idBlock, 'NoLayout' => $NoLayout)));
 }