public function comentar() { if (isset($_POST["submit"])) { if (isset($_POST["coment"])) { $juradoPopular = $this->juradoPopularMapper->findById($_POST["usuario"]); $pinchos = $this->juradoPopularMapper->getPinchosProbados($_POST["usuario"]); $this->juradoPopularMapper->comentar($_POST["usuario"], $_POST["pincho"], $_POST["coment"]); $this->view->setVariable("juradoPop", $juradoPopular); $this->view->setVariable("pinchos", $pinchos); $this->view->render("juradoPopular", "comentar"); } else { $juradoPopular = $this->juradoPopularMapper->findById($_POST["usuario"]); $pincho = Pincho::find($_POST["pincho"]); $comentario = $this->juradoPopularMapper->getComentario($_POST["usuario"], $_POST["pincho"]); $this->view->setVariable("juradoPop", $juradoPopular); $this->view->setVariable("pincho", $pincho); $this->view->setVariable("comentario", $comentario); $this->view->render("juradoPopular", "comentarPincho"); } } else { $currentuser = $this->view->getVariable("currentusername"); $juradoPopular = $this->juradoPopularMapper->findById($currentuser); $pinchos = $this->juradoPopularMapper->getPinchosProbados($currentuser); $this->view->setVariable("juradoPop", $juradoPopular); $this->view->setVariable("pinchos", $pinchos); $this->view->render("juradoPopular", "comentar"); } }
public function pinchoEspecifico() { $id = $_GET['id']; $pincho = Pincho::find($id); $comentarios = Pincho::getComentario($id); $this->view->setVariable("pincho", $pincho); $this->view->setVariable("comentarios", $comentarios); $this->view->render("pinchos", "pincho"); }
public function getPosiciones() { $list = array(); $db = PDOConnection::getInstance(); $req = $db->prepare('SELECT posicion as posicion, FK_pincho_prem as id_pincho FROM premiados WHERE FK_premio_prem =?'); $req->execute(array($this->getId())); foreach ($req->fetchAll() as $posicion) { $list[] = array($posicion['posicion'], Pincho::find($posicion['id_pincho'])->getNombre()); } return $list; }
public function votacionPro($ronda) { $stmt = $this->db->prepare("SELECT *, SUM(votacion) as total FROM vota_pro WHERE ronda=? GROUP BY FK_pincho_vota ORDER BY votacion ASC "); $stmt->execute(array($ronda)); $list = []; foreach ($stmt->fetchAll() as $info) { $pincho = Pincho::find($info['FK_pincho_vota']); $pincho->setVotos($info['total']); $list[] = $pincho; } return $list; }
public function asignarPinchos() { $jpopid = $_REQUEST["usuario"]; $jpop = $this->juradoProfesionalMapper->findById($jpopid); $currentuser = $this->view->getVariable("currentusername"); $organizador = $this->organizadorMapper->findById($currentuser); $this->view->setVariable("jurado", $jpop); $pincha = array(); if (isset($_REQUEST["selectedPinchos"])) { $pinchos = $_REQUEST["selectedPinchos"]; for ($i = 0; $i < count($pinchos); $i++) { $pincha[$i] = Pincho::find($pinchos[$i]); } $this->organizadorMapper->asignar($jpop, $pincha, $organizador); } $this->view->setVariable("pinchos", $pincha); $this->view->render("organizador", "asignados"); }
public function eliminar($id) { $pincho = Pincho::find($id); if ($pincho == NULL) { throw new Exception("No existe el pincho " . $id); } // Delete the Jurado Popular object from the database $db = PDOConnection::getInstance(); $stmt = $db->prepare("DELETE from pincho WHERE id_pincho=?"); $stmt->execute(array($pincho->getId())); }
public function asignarPinchoPro() { $premioid = $_POST["id_premio"]; $premio = $this->premioMapper->findById($premioid); $idpinchos = $this->organizadorMapper->getPinchosPremios(); $pinchos = array(); foreach ($idpinchos as $pincho) { $new = Pincho::find($pincho); $new->setVotPro(); array_push($pinchos, $new); } $this->view->setVariable("pinchos", $pinchos); $this->view->setVariable("premio", $premio); $this->view->render("premios", "asignarPinchosPro"); }