public function affichageMatierePremiereAction(request $request) { $em = $this->getDoctrine()->getManager(); //Partie Recherche et trie des composants if ('POST' == $request->getMethod()) { //recheche basique par composant $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere($request->get('formComposantInterne')); } else { $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere(0); } $formComposant = $this->createForm(new AddComposantType($this->generateUrl('ic_administration_mp_add'))); return $this->render('ICAdministrationBundle:MP:affichage.html.twig', array('partie' => 'Administration', 'form' => $formComposant->createView(), 'composants' => $listComposant)); }
public function indexAction(request $request) { $session = $this->getRequest()->getSession(); if ($request->getMethod() == 'POST') { $session->clear(); $username = $request->get('usuario'); $password = $request->get('password'); //$em = $this->getDoctrine()->getManager(); $query = $this->getDoctrine()->getRepository('usuariosBundle:PerfilUsuario')->createQueryBuilder('perfil')->select('perfil', 'usuario', 'tipo_usuario')->innerJoin('usuariosBundle:Usuarios', 'usuario', 'WITH', 'perfil.usuario = usuario.id')->innerJoin('usuariosBundle:TipoUsuario', 'tipo_usuario', 'WITH', 'usuario.tipoUsuario = tipo_usuario.id')->where('perfil.nombreUsuario = :user')->setParameter('user', $username)->getQuery(); $user = $query->getArrayResult(); $passwords = $this->getDoctrine()->getRepository('usuariosBundle:Passwords')->findOneBy(array('perfil' => $user[0]['id'], 'activo' => true)); if ($user) { $factory = $this->get('security.encoder_factory'); $codificador = $factory->getEncoder($passwords); $validador = $codificador->isPasswordValid($passwords->getPassword(), $password, $passwords->getSalt()); if ($validador) { $session = $request->getSession(); $session->set("email", $user[0]['email']); $session->set("perfil_activo", $user[0]['activo']); $session->set("pass_activo", $passwords->getActivo()); if ($session->get('perfil_activo') == 1) { if ($session->get('pass_activo') == 1) { $session->set("usuario_id", $user[0]['id']); $session->set("autenticado", true); $session->set("nombre_usuario", $user[0]['nombreUsuario']); $session->set("nombres", $user[1]['nombres']); $session->set("tipo_usuario", $user[2]['nombre']); $session->set("id_tipo_usuario", $user[2]['id']); return $this->render('inicialBundle:Default:index.html.twig'); } else { $this->get('session')->getFlashBag()->add('warning', 'Clave Inactiva debe actualizar su clave'); } } else { $this->get('session')->getFlashBag()->add('danger', 'Usuario Inactivo Contactar con el administrador del sistema'); return $this->render('inicialBundle:Default:index.html.twig'); } } else { $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos'); return $this->render('inicialBundle:Default:index.html.twig'); } } else { $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos'); return $this->render('inicialBundle:Default:index.html.twig'); } } return $this->render('inicialBundle:Default:index.html.twig'); }
public function initSettings() { if ($this->_block !== null) { $this->_block->getSettings(); if (request::getMethod() === 'POST') { foreach ($this->_defaultSettings as $name => $a) { $title = $a['title']; $default = $a['default']; if (isset($_POST[$name])) { $this->_block->setOption($name, $_POST[$name], $default); } } $this->_block->save(); $this->back(); } } }
/** * @see http://php.net/manual/en/language.oop5.late-static-bindings.php * @return ModuleAbstract */ public function execute() { $response = null; switch (strtoupper($this->request->getMethod())) { case 'POST': $response = static::post(); break; case 'PUT': $response = static::put(); break; case 'DELETE': $response = static::delete(); break; case 'GET': $response = static::get(); break; default: throw new Http\NotImplemented(); break; } $this->response = $response; return $this; }
/** * Get $_SERVER['REQUEST_METHOD'] */ public function getHttpMethod() { return request::getMethod(); }
public static function redirect($location) { request::getMethod() == 'GET' ? self::movedPermanently($location) : self::seeOther($location); }