示例#1
0
 /**
  * @param	Reservas $reservas The reservas object to add.
  */
 protected function doAddReservas($reservas)
 {
     $this->collReservass[] = $reservas;
     $reservas->setPelicula($this);
 }
示例#2
0
 /**
  * Filter the query by a related Reservas object
  *
  * @param     Reservas $reservas  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    SocioQuery The current query, for fluid interface
  */
 public function filterByReservas($reservas, $comparison = null)
 {
     if ($reservas instanceof Reservas) {
         return $this->addUsingAlias(SocioPeer::ID, $reservas->getSocioId(), $comparison);
     } elseif ($reservas instanceof PropelCollection) {
         return $this->useReservasQuery()->filterByPrimaryKeys($reservas->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByReservas() only accepts arguments of type Reservas or PropelCollection');
     }
 }
示例#3
0
 public function executeReservarPelicula(sfWebRequest $request)
 {
     if ($request->hasParameter('id')) {
         //$this->corroborarHorario();
         $peli = $request->getParameter('id');
         if (!empty($peli) && $this->peliculaLibre($peli)) {
             $Socio_id = $this->getUser()->getAttribute('id');
             //consulto si ya tiene reservas hechas
             $ver = ReservasQuery::create();
             $ver->filterBySocioId($Socio_id)->filterByExpiroReserva(false)->filterByAlquilada(false)->find();
             $cant = $ver->count() + 1;
             $this->cant = $cant;
             //si tiene menos de 3 peliculas reservadas sin alquilar
             if ($cant <= 4) {
                 //creo la nueva reserva y le ingreso los datos
                 $reserva = new Reservas();
                 $reserva->setSocioId($Socio_id);
                 $reserva->setPeliculaId($peli);
                 $reserva->setFechaReserva(date('d-m-Y'));
                 $reserva->setHoraReserva(time('H:i:s'));
                 $reserva->setExpiroReserva(false);
                 $reserva->setAlquilada(false);
                 $reserva->save();
                 //guardo la reserva y mando mje
                 $this->mje = "Pelicula Reservada con exito!";
                 //creo un objeto Pelicula
                 $act_peli = new Pelicula();
                 //busco la pelicula reservada para cambiar el estado
                 $consulta = PeliculaQuery::create()->filterById($peli)->find();
                 //obtengo la pelicula buscada
                 $act_peli = $consulta->getFirst();
                 //le cambio el estado
                 $act_peli->setEstado(2);
                 //guardo el cambio
                 $act_peli->save();
                 if ($cant == 4) {
                     $this->mje = "Pelicula reservada con Exito!\n                        Alcanzó el limite de reservas por favor alquile\n                        o cancele las reservas para poder reservar \n                        nuevas peliculas, gracias.";
                 }
             } else {
                 $this->mje = "Pelicula No Reservada, superó\n                        el maximo de reservas posibles!";
                 return sfView::ERROR;
             }
         } else {
             //Si el id que viene es null o vacio o erroneo
             $this->mje = "Error de identificacion de pelicula!\n                No existe o ya esta reservada o alquilada!";
             return sfView::ERROR;
         }
     } else {
         return $this->redirect('@homepage');
         //vuelvo a cargar el home
     }
 }
示例#4
0
 /**
  * Exclude object from result
  *
  * @param     Reservas $reservas Object to remove from the list of results
  *
  * @return    ReservasQuery The current query, for fluid interface
  */
 public function prune($reservas = null)
 {
     if ($reservas) {
         $this->addUsingAlias(ReservasPeer::ID, $reservas->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
示例#5
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Reservas::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#6
0
 /**
  * @param	Reservas $reservas The reservas object to add.
  */
 protected function doAddReservas($reservas)
 {
     $this->collReservass[] = $reservas;
     $reservas->setSocio($this);
 }