예제 #1
0
파일: Usuario.php 프로젝트: villapilla/PHP
 public function persist()
 {
     $conexion = BD::getConexion();
     $update = "Update usuario SET id_liga = :id_liga where id_user = :id_user";
     $query = $conexion->prepare($update);
     $query->execute(array(":id_liga" => $this->id_liga, ":id_user" => $this->id_user));
 }
예제 #2
0
파일: Libro.php 프로젝트: villapilla/PHP
 function delete()
 {
     $conexion = BD::getConexion();
     $insert = "delete from libro where id_libro = :id_libro";
     $query = $conexion->prepare($insert);
     $query->execute([":id_libro" => $this->getId_libro()]);
 }
예제 #3
0
파일: Usuario.php 프로젝트: villapilla/PHP
 public function delete()
 {
     $conexion = BD::getConexion();
     $query = "DELETE FROM usuario WHERE id_user = :id_user";
     $delete = $conexion->prepare($query);
     $delete->execute(array(":id_user" => $this->getId()));
 }
예제 #4
0
파일: Usuario.php 프로젝트: jortiz-el/PhP
 public function persist()
 {
     $bd = BD::getConexion();
     $sql = "UPDATE login set estado = 1 WHERE id = :id";
     $stmt = $bd->prepare($sql);
     $stmt->execute([":id" => $this->id]);
 }
예제 #5
0
 public function persist()
 {
     $bd = BD::getConexion();
     $sqlInsertUsuario = "insert into usuarios (nomUsuario, clave) values (:nomUsuario, :clave)";
     $sthSqlInsertUsuario = $bd->prepare($sqlInsertUsuario);
     $result = $sthSqlInsertUsuario->execute([":nomUsuario" => $this->nomUsuario, ":clave" => $this->clave]);
     $this->id = (int) $bd->lastInsertId();
 }
예제 #6
0
 public function persist()
 {
     $conexion = BD::getConexion();
     $query = "INSERT INTO contactos SET nombre=:nombre, apellidos=:apellidos, telefono1=:telefono1,telefono2=:telefono2, direccion=:direccion, user_id_fk=:user_id_fk";
     $result = $conexion->prepare($query);
     $result->execute(array(":nombre" => $this->getNombre(), ":apellidos" => $this->getApellidos(), ":telefono1" => $this->getTelefono1(), ":telefono2" => $this->getTelefono2(), ":direccion" => $this->getDireccion(), ":user_id_fk" => $this->getUser_id_fk()));
     $this->id = $conexion->lastInsertId();
 }
예제 #7
0
파일: Productos.php 프로젝트: jortiz-el/PhP
 public function delete()
 {
     $bd = BD::getConexion();
     $sql = "DELETE FROM producto WHERE nombre = :nombre";
     $stmt = $bd->prepare($sql);
     $valido = $stmt->execute([":nombre" => $this->nombre]);
     return $valido;
 }
예제 #8
0
 static function getEquipos()
 {
     $conexion = BD::getConexion();
     $query = "SELECT * from equipos";
     $prepara = $conexion->prepare($query);
     $prepara->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Equipo");
     $prepara->execute();
     return $prepara->fetchAll();
 }
예제 #9
0
파일: Usuario.php 프로젝트: jortiz-el/PhP
 public static function validar($usuario, $clave)
 {
     $bd = BD::getConexion();
     $sql = "select * from usuario where usuario = :usuario and clave = :clave";
     $stmt = $bd->prepare($sql);
     $stmt->execute([":usuario" => $usuario, ":clave" => $clave]);
     $valido = $stmt->fetch();
     return $valido;
 }
예제 #10
0
파일: Usuario.php 프로젝트: sergiasenjo/PHP
 public static function getByCredential($user, $pass)
 {
     $bd = BD::getConexion();
     $sqlSelect = 'select * from usuarios where user=:user and pass=:pass';
     $sthSqlSelect = $bd->prepare($sqlSelect);
     $sthSqlSelect->execute([":user" => $user, ":pass" => $pass]);
     $sthSqlSelect->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Usuario');
     $userObj = $sthSqlSelect->fetch();
     return $userObj;
 }
예제 #11
0
 public static function creaCuadros($idPintor)
 {
     $conexion = BD::getConexion();
     $query = "SELECT * from cuadros where pintor_fk = :user_fk_pintor";
     $prepara = $conexion->prepare($query);
     $prepara->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Cuadros");
     $prepara->execute(array(":user_fk_pintor" => $idPintor));
     $cuadros = $prepara->fetchAll();
     return $cuadros;
 }
예제 #12
0
파일: Liga.php 프로젝트: jortiz-el/PhP
 public function persit()
 {
     $bd = BD::getConexion();
     $sql = "INSERT INTO liga (nombre) VALUES (:nombre)";
     $stmt = $bd->prepare($sql);
     $obj = $stmt->execute([":nombre" => $this->nombre]);
     if ($obj) {
         $this->setId($bd->lastInsertId());
     }
 }
예제 #13
0
파일: Usuario.php 프로젝트: jortiz-el/PhP
 public function modifyAlumno($id, $nombre, $apellido1, $apellido2, $edad, $sexo)
 {
     $bd = BD::getConexion();
     $sql = "UPDATE alumno SET nombre =:nombre,apellido1=:apellido1,apellido2=:apellido2,edad=:edad,sexo=:sexo WHERE id=:id ";
     $stmt = $bd->prepare($sql);
     $valido = $stmt->execute([":id" => $id, ":nombre" => $nombre, ":apellido1" => $apellido1, ":apellido2" => $apellido2, ":edad" => $edad, ":sexo" => $sexo]);
     if ($valido) {
         $this->setGrupos(Grupo::obtenerGrupo($this->getId()));
     }
     return $valido;
 }
예제 #14
0
파일: Jugada.php 프로젝트: villapilla/PHP
 public function persist()
 {
     $conexion = BD::getConexion();
     $insert = "Insert into jugada (letra, palabraDescubierta, id_partida, id_jugada) values (:letra, :palabraDescubierta, :id_partida, :id_jugada)";
     $insercion = $conexion->prepare($insert);
     try {
         $checkProcess = $insercion->execute(array(":letra" => $this->getLetra(), ":palabraDescubierta" => $this->getPalabraDescubierta(), ":id_partida" => $this->getId_partida(), ":id_jugada" => $this->getId_jugada()));
     } catch (Exception $ex) {
         $checkProcess = null;
     }
 }
예제 #15
0
파일: Alumno.php 프로젝트: jortiz-el/PhP
 public function persist()
 {
     $bd = BD::getConexion();
     $sql = "INSERT INTO alumno(n_grupo, nombre, apellido1, apellido2, edad, sexo)" . " VALUES (:n_grupo, :nombre, :apellido1, :apellido2, :edad, :sexo)";
     $stmt = $bd->prepare($sql);
     $valido = $stmt->execute([":n_grupo" => $this->n_grupo, ":nombre" => $this->nombre, ":apellido1" => $this->apellido1, ":apellido2" => $this->apellido2, ":edad" => $this->edad, ":sexo" => $this->sexo]);
     if ($valido) {
         $this->setId($bd->lastInsertId());
     }
     return $valido;
 }
예제 #16
0
 public function persist()
 {
     $conexion = BD::getConexion();
     $query = "INSERT INTO jugada (letrausada,id_partida_fk) " . "VALUES(:letrausada, :id_partida_fk)";
     $inserta = $conexion->prepare($query);
     //ASSOC trae array asociativo,
     //(por defecto numérico y asociativo)
     $inserta->setFetchMode(PDO::FETCH_ASSOC);
     //Devuelve las líneas afectadas(0 no ha agregado, 1 si)
     return $inserta->execute(array(":letrausada" => $this->getLetra(), ":id_partida_fk" => $this->getId_partida_fk()));
     $this->id = (int) $conexion->lastInsertId();
 }
예제 #17
0
파일: Usuario.php 프로젝트: jortiz-el/PhP
 public static function persist($usuario, $clave)
 {
     $bd = BD::getConexion();
     $sql = "INSERT INTO usuario (usuario, clave) VALUES (:usuario, :clave)";
     $stmt = $bd->prepare($sql);
     try {
         $valido = $stmt->execute([":usuario" => $usuario, ":clave" => $clave]);
     } catch (PDOException $ex) {
         $valido = 0;
     }
     return $valido;
 }
예제 #18
0
파일: Pintor.php 프로젝트: villapilla/PHP
 function generaColeccion()
 {
     $conexion = BD::getConexion();
     $select = "SELECT * FROM cuadros WHERE id_pintor = :id";
     $query = $conexion->prepare($select);
     $query->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Cuadro");
     $query->execute(array(":id" => $this->id_pintor));
     $coleccion = $query->fetchAll();
     foreach ($coleccion as $cuadro) {
         $this->cuadros->add($cuadro);
     }
 }
예제 #19
0
 public function getCuadroAleatorio()
 {
     $conexion = BD::getConexion();
     $query = "SELECT imagen from cuadros where pintor_fk = :pintorId";
     $prepara = $conexion->prepare($query);
     //No hace falta porque lo voy a recoger todo
     /* $prepara->setFetchMode(PDO::FETCH_ASSOC); */
     //No hace falta porque no hemos metido variables
     $prepara->execute(array(":pintorId" => $this->getId()));
     $cuadro = $prepara->fetchAll();
     return $cuadro[rand(0, count($cuadro) - 1)]['imagen'];
 }
예제 #20
0
파일: Liga.php 프로젝트: villapilla/PHP
 public function persist()
 {
     if ($this->id_liga === null) {
         $conexion = BD::getConexion();
         $insert = "Insert into liga (nombre) VALUES (:nombre)";
         $query = $conexion->prepare($insert);
         $checkout = $query->execute(array(":nombre" => $this->getNombre()));
         if ($checkout) {
             $this->setId_liga($conexion->lastInsertId());
         }
     }
 }
예제 #21
0
 function get_one_product($valor)
 {
     $bd = BD::getConexion();
     $sql = "select * from products where name ='" . $valor . "'";
     $stmt = $bd->prepare($sql);
     try {
         $stmt->execute();
         $productos = $stmt->fetchAll(PDO::FETCH_ASSOC);
     } catch (Exception $ex) {
         $productos = [];
     }
     return $productos;
 }
예제 #22
0
 public function getCategoria()
 {
     $bd = BD::getConexion();
     $sql = "select * from producto where nombre_categ = :nombre";
     $stmt = $bd->prepare($sql);
     $stmt->execute([":nombre" => $this->nombre]);
     $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "productos");
     $productos = $stmt->fetchAll();
     $this->productos->removeAll();
     foreach ($productos as $producto) {
         $this->productos->add($producto);
     }
 }
예제 #23
0
파일: Usuario.php 프로젝트: villapilla/PHP
 public function persist()
 {
     $conexion = BD::getConexion();
     if ($this->id_usuario === null) {
         $insert = "insert into usuario (nombre, password) VALUES (:nombre, :password)";
         $query = $conexion->prepare($insert);
         $checkout = $query->execute([":nombre" => $this->getNombre(), ":password" => $this->getPassword()]);
         if ($checkout) {
             $this->setId_usuario($conexion->lastInsertId());
         }
     }
     return $checkout;
 }
예제 #24
0
파일: Apuntes.php 프로젝트: jortiz-el/PhP
 public static function getDetalle($id, $tipo, $fecha1, $fecha2)
 {
     $bd = BD::getConexion();
     $sql = "SELECT * FROM apuntes where id_usuario = :id_usuario and tipo = :tipo and fecha BETWEEN :fecha1 AND :fecha2 ";
     $stmt = $bd->prepare($sql);
     $stmt->execute([":id_usuario" => $id, ":tipo" => $tipo, ":fecha1" => $fecha1, ":fecha2" => $fecha2]);
     $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Apuntes");
     $apuntes = $stmt->fetchAll();
     $listado = new Collection();
     foreach ($apuntes as $apunte) {
         $listado->add($apunte);
     }
     return $listado;
 }
예제 #25
0
 function persist()
 {
     if ($this->id === null) {
         $conexion = BD::getConexion();
         $query = "INSERT INTO jornadas (fecha) VALUES(:fecha)";
         $prepara = $conexion->prepare($query);
         $prepara->execute(array(":fecha" => $this->fecha));
         $this->id = $conexion->lastInsertId();
     } else {
         $conexion = BD::getConexion();
         $query = "UPDATE jornadas SET state = :state where id=:id";
         $prepara = $conexion->prepare($query);
         $prepara->execute(array(":state" => $this->getState(), ":id" => $this->getId()));
     }
 }
예제 #26
0
 public function persist()
 {
     if ($this->id !== null) {
         $conexion = BD::getConexion();
         $query = "UPDATE usuarios SET user=:user, pass=:pass WHERE id=:id";
         $result = $conexion->prepare($query);
         $result->execute(array(":user" => $this->getUser(), ":pass" => $this->getPass(), ":id" => $this->getId()));
     } else {
         $conexion = BD::getConexion();
         $query = "INSERT INTO usuarios (user,pass) VALUES (:user, :pass)";
         $result = $conexion->prepare($query);
         $result->execute(array(":user" => $this->getUser(), ":pass" => $this->getPass()));
         $this->id = (int) $conexion->lastInsertId();
     }
 }
예제 #27
0
 function persist()
 {
     if ($this->id === null) {
         $conexion = BD::getConexion();
         $query = "INSERT INTO partidos (equipoL,equipoV,id_jornada) VALUES(:equipoL,:equipoV,:id_jornada)";
         $prepara = $conexion->prepare($query);
         $prepara->execute(array(":equipoL" => $this->equipoL, ":equipoV" => $this->equipoV, ":id_jornada" => $this->id_jornada));
         $this->id = $conexion->lastInsertId();
     } else {
         $conexion = BD::getConexion();
         $query = "UPDATE partidos SET golL = :golL, golV=:golV where id = :id";
         $prepara = $conexion->prepare($query);
         $prepara->execute(array(":golL" => $this->golL, ":golV" => $this->golV, ":id" => $this->id));
     }
 }
예제 #28
0
파일: Grupo.php 프로젝트: jortiz-el/PhP
 public static function obtenerGrupo($id)
 {
     $bd = BD::getConexion();
     $sql = "select * from grupo where id_usuario = :id_usuario";
     $stmt = $bd->prepare($sql);
     $stmt->execute([":id_usuario" => $id]);
     $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Grupo");
     $grupo = $stmt->fetchAll();
     $grupos = new Collection();
     foreach ($grupo as $alumnos) {
         $alumnos->setAlumnos(Alumno::obtenerAlumno($alumnos->getNombre()));
         $grupos->add($alumnos);
     }
     return $grupos;
 }
예제 #29
0
파일: Partidos.php 프로젝트: jortiz-el/PhP
 public function persit()
 {
     $bd = BD::getConexion();
     if ($this->id !== null) {
         $sql = "update partido SET gol_L = :gol_L, gol_V = :gol_V where id = :id";
         $stmt = $bd->prepare($sql);
         $stmt->execute([":gol_L" => $this->gol_L, ":gol_V" => $this->gol_V, ":id" => $this->id]);
     } else {
         $sql = "INSERT INTO partido (id_jornada,equipo_L,equipo_V,gol_L,gol_V)" . " VALUES (:id_jornada,:equipo_L,:equipo_V,:gol_L,:gol_V)";
         $stmt = $bd->prepare($sql);
         $obj = $stmt->execute([":id_jornada" => $this->id_jornada, ":equipo_L" => $this->equipo_L, ":equipo_V" => $this->equipo_V, ":gol_L" => $this->gol_L, ":gol_V" => $this->gol_V]);
         if ($obj) {
             $this->setId($bd->lastInsertId());
         }
     }
 }
예제 #30
0
파일: Jornada.php 프로젝트: villapilla/PHP
 public function persist()
 {
     $conexion = BD::getConexion();
     if ($this->id_jornada === null) {
         $insert = "Insert into jornada (fecha, estado, id_liga) VALUES (:fecha, :estado, :id_liga)";
         $query = $conexion->prepare($insert);
         $checkout = $query->execute(array(":fecha" => $this->fecha, ":estado" => $this->estado, ":id_liga" => $this->id_liga));
         if ($checkout) {
             $this->setId_jornada($conexion->lastInsertId());
         }
     } else {
         $update = "update jornada SET estado = :estado where id_jornada = :id_jornada";
         $query = $conexion->prepare($update);
         $query->execute([":estado" => $this->estado, ":id_jornada" => $this->id_jornada]);
     }
 }