function getList($pagina = 1, $orden = "", $nrpp = Configuracion::NRPP, $condicion = "1=1", $parametros = array()) { $ordenPredeterminado = "{$orden}, idprestamo"; if (trim($orden) === "" || trim($orden) === NULL) { $ordenPredeterminado = "idprestamo"; } $registroInicial = ($pagina - 1) * $nrpp; $this->bd->select($this->tabla, "*", $condicion, $parametros, $ordenPredeterminado, "{$registroInicial}, {$nrpp}"); $r = array(); while ($fila = $this->bd->getRow()) { $prestamo = new Prestamo(); $prestamo->set($fila); $r[] = $prestamo; } return $r; //Devuelve un array de ciudades; }
function getListJuegosPrestamo($condicion = NULL, $parametros = array()) { if ($condicion === NULL) { $condicion = ""; } else { $condicion = "where {$condicion}"; } $sql = "select prestamo.*, ludoteca.*, usuario.* from prestamo " . "left join ludoteca on prestamo.idjuego = ludoteca.id " . "left join usuario on prestamo.dni = usuario.dni"; $this->bd->send($sql, $parametros); $r = array(); $contador = 0; while ($fila = $this->bd->getRow()) { $prestamo = new Prestamo(); $prestamo->set($fila); $ludoteca = new Ludoteca(); $ludoteca->set($fila, 5); $usuario = new Usuario(); $usuario->set($fila, 12); $r[] = new PrestamoJuegoUSuario($prestamo, $ludoteca, $usuario); } return $r; }