function getListJSON($idplato) { $sql = "select * from {$this->tabla} where idplato=:idplato"; $param['idplato'] = $idplato; $this->bd->setConsulta($sql, $param); $r = "[ "; while ($fila = $this->bd->getFila()) { $foto = new Foto(); $foto->set($fila); $r .= $foto->getJSON() . ","; } $r = substr($r, 0, -1) . "]"; return $r; }
function getLeftList() { $sql = "select p.*, f.* from producto p left join foto f on p.id = f.idproducto"; $r = $this->bd->setConsulta($sql); $respuesta = array(); while ($fila = $this->bd->getFila()) { $obj1 = new Producto(); $obj1->set($fila); $obj2 = new Foto(); $obj2->set($fila, 6); $objeto = new InnerProductoFoto($obj1, $obj2); $respuesta[] = $objeto; } return $respuesta; }
function getListUserById($usuario, $pagina = 1, $nrpp = Constants::NRPP) { $registroinicial = ($pagina - 1) * $nrpp; $parametros = array(); $parametros["idautor"] = $usuario; $this->bd->select($this->tabla, "*", "idautor=:idautor", $parametros, "fecha", " {$registroinicial} , {$nrpp}"); $r = array(); while ($fila = $this->bd->getRow()) { $foto = new Foto(); $foto->set($fila); $r[] = $foto; } return $r; }
/** * A este merodo le pasamos una lista de ids y nos devuelve los objeto foto de todas las fotos correspondientes a ese id * partiendo de que las fotos estan en una tabla distita. * @param type $ids * @return \Foto */ function getListDe($ids = array()) { $list = array(); $parametros = array(); $numeracion = 0; for ($i = 0; $i < sizeof($ids); $i++) { if ($i == sizeof($ids) - 1) { $numeracion = $ids[$i]; } else { $numeracion = $ids[$i] . ", "; } } $condicion = 'idinmueble in (' . $numeracion . ')'; $sql = "select * from {$this->tabla} WHERE {$condicion}"; $r = $this->bd->setConsulta($sql, $parametros); if (!$r) { return null; } else { while ($fila = $this->bd->getFila()) { $foto = new Foto(); $foto->set($fila); $list[] = $foto; } return $list; } }