Example #1
0
 } 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;
                 $i++;
             }
             $data = serialize($arrayD);
             header("Location: ../views/selectWinner.php?data={$data}");
         }
Example #2
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) {