Example #1
0
 public function addCmsAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $name = $this->get('request')->request->get('name');
         $url = $this->get('request')->request->get('url');
         $content = $this->get('request')->request->get('content');
         $cms = new CMS();
         $cms->setName($name);
         $cms->setUrl($url);
         $cms->setContent($content);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($cms);
         $em->flush();
         return $this->redirect($this->generateUrl('RARAdminBundle_manageCms'));
     }
     return $this->render('RARAdminBundle:Cms:addCms.html.twig');
 }
Example #2
0
 public function addCmsAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $file = $_FILES['image']['name'];
         $file1 = $_FILES['image']['tmp_name'];
         move_uploaded_file($_FILES["image"]["tmp_name"], "uploads" . $_FILES["image"]["name"]);
         $type = $this->get('request')->request->get('type');
         $name = $this->get('request')->request->get('name');
         $url = $this->get('request')->request->get('url');
         $content = $this->get('request')->request->get('content');
         $cms = new CMS();
         $cms->setName($name);
         $cms->setUrl($url);
         $cms->setType($type);
         $cms->setImage($file);
         $cms->setContent($content);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($cms);
         $em->flush();
         return $this->redirect($this->generateUrl('RARAdminBundle_manageCms'));
     }
     return $this->render('RARAdminBundle:Cms:addCms.html.twig');
 }