$establishments = serialize($est->selectAll());
     $pinchos = serialize($pin->selectnAll());
     $popular = serialize($pop->selectAll());
     $professional = serialize($pro->selectAll());
     header("Location: ../views/management.php?establishments={$establishments}&pinchos={$pinchos}&popular={$popular}&professional={$professional}");
 } else {
     if ($action == "winner") {
         //Seleccion de ganador del concurso
         $p = new Pincho();
         $finalistas = $p->selectFinalists();
         if ($finalistas == false) {
             $msg = "Not finalists selected by professional jury yet.";
             header("Location: ../views/selectWinner.php?msg={$msg}");
         } else {
             $arrayD = array();
             $l = new PopularValorations();
             $v = new ProfessionalValorations();
             $i = 0;
             //variable auxiliar
             foreach ($finalistas as $finalista) {
                 $likes = $l->getRows($finalista["code"]);
                 //Likes recibidos
                 $valoration = $v->getVote($finalista["code"]);
                 $val = $valoration[0]["Calification"];
                 //Nota del profesional
                 $name = $finalista["name"];
                 $id = $finalista["code"];
                 $arrayD[$i][0] = $name;
                 $arrayD[$i][1] = $likes;
                 $arrayD[$i][2] = $val;
                 $arrayD[$i][3] = $id;
Beispiel #2
0
         $cod = new Codes();
         $bool = $cod->setUsed($code21);
         $bool = $cod->setUsed($code22);
         $bool = $cod->setUsed($code23);
         $msg = "Votation Done.";
         header("Location: ../views/popularVote.php?msg={$msg}");
     }
 } else {
     if (isset($_POST["idp3"])) {
         $idp3 = $_POST["idp3"];
         $ide3 = $_POST["ide3"];
         $idpop3 = $_POST["idpop3"];
         $code31 = $_POST["code31"];
         $code32 = $_POST["code32"];
         $code33 = $_POST["code33"];
         $pv = new PopularValorations();
         $boolean = $pv->insert($idp3, $ide3, $idpop3);
         if ($boolean == false) {
             echo "Database error: Try again";
         } else {
             $cod = new Codes();
             $bool = $cod->setUsed($code31);
             $bool = $cod->setUsed($code32);
             $bool = $cod->setUsed($code33);
             $msg = "Votation Done.";
             header("Location: ../views/popularVote.php?msg={$msg}");
         }
     } else {
         if (isset($_GET["idpincho"])) {
             //Código para leer comentarios
             $idpincho = $_GET["idpincho"];
Beispiel #3
0
<?php

require_once "../models/pincho.php";
require_once "../models/popularValorations.php";
require_once "../models/professionalValorations.php";
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $name = $_GET["name"];
    $description = $_GET["description"];
    $price = $_GET["price"];
    $ingredients = $_GET["ingredients"];
    $url = $_GET["url"];
    $p = new PopularValorations();
    $likes = $p->getRows($id);
    $pro = new ProfessionalValorations();
    $boolean = $pro->getVote($id);
    if ($boolean == false) {
        $msg = "Selected pincho havent a professional jury assigned yet.";
        header("Location: ../views/pinchoInfo.php?msg={$msg}");
    } else {
        $nota = $boolean[0]["Calification"];
        header("Location: ../views/pinchoInfo.php?name={$name}&description={$description}&price={$price}&ingredients={$ingredients}&url={$url}&likes={$likes}&nota={$nota}");
    }
} else {
    if ($_GET["action"]) {
        $action = $_GET["action"];
        if ($action == "finalists") {
            //Mostrar galeria de finalistas
            $p = new Pincho();
            $boolean = $p->selectFinalists();
            if ($boolean == false) {