/**
  * Constructor
  * @param {integer} $prueba Prueba ID
  * @param {integer} $jornada Jornada ID
  * @throws Exception
  */
 function __construct($prueba, $jornada)
 {
     date_default_timezone_set('Europe/Madrid');
     parent::__construct('Portrait', "print_ordenTandas", $prueba, $jornada);
     if ($prueba <= 0 || $jornada <= 0) {
         $this->errormsg = "printTandas: either prueba or jornada data are invalid";
         throw new Exception($this->errormsg);
     }
     // Datos del orden de tandas
     $o = new Tandas("PrintTandas", $prueba, $jornada);
     $ot = $o->getTandas(0);
     // 0: any tanda
     $this->orden = $ot['rows'];
 }
Beispiel #2
0
 /** deploy a contest->journeys->series->rounds tree */
 function publicweb_deploy()
 {
     $result = array();
     // retrieve contest data
     $result['Prueba'] = $this->prueba;
     // retrieve journeys for this contest
     $result['Jornadas'] = $this->myDBObject->__select("*", "Jornadas", "(Prueba={$this->prueba['ID']}) AND (Nombre != '-- Sin asignar --') ", "", "")['rows'];
     foreach ($result['Jornadas'] as &$jornada) {
         // retrieve rounds for each series
         $jornada['Mangas'] = Jornadas::enumerateMangasByJornada($jornada['ID'])['rows'];
         // retrieve series for each journey
         $tnd = new Tandas("publicweb_deploy", $this->prueba['ID'], $jornada['ID']);
         $jornada['Tandas'] = $tnd->getTandas(0)['rows'];
         // incluye user defined rounds ( to display timetable )
         // retrieve final results index for each series
         $jornada['Series'] = Jornadas::enumerateRondasByJornada($jornada['ID'])['rows'];
     }
     return $result;
 }
Beispiel #3
0
 /**
  * Delete jornada with provided ID
  * @param {integer} jornada name primary key
  * @return "" on success ; otherwise null
  */
 function delete($jornadaid)
 {
     $this->myLogger->enter();
     if ($jornadaid <= 0) {
         return $this->error("Invalid Jornada ID");
     }
     // borramos cada una de las mangas de esta jornada
     $mng = new Mangas("deleteJornada", $jornadaid);
     $res = $mng->selectByJornada();
     if (!is_array($res)) {
         return $res;
     }
     // error
     foreach ($res['rows'] as $manga) {
         $mng->deleteByID($manga['ID']);
     }
     // borramos cada una de las tandas de la jornada
     $tnd = new Tandas("jornadas::delete()", $this->prueba, $jornadaid);
     $tnd->removeJornada();
     // Borramos equipos de esta prueba/jornada
     $res = $this->query("DELETE FROM Equipos WHERE ( Jornada = {$jornadaid} );");
     if (!$res) {
         return $this->error($this->conn->error);
     }
     // y borramos la propia jornada
     $res = $this->query("DELETE FROM Jornadas WHERE ( ID = {$jornadaid} );");
     if (!$res) {
         return $this->error($this->conn->error);
     }
     $this->myLogger->leave();
     return "";
 }
require_once __DIR__ . "/../auth/AuthManager.php";
require_once __DIR__ . "/classes/DBConnection.php";
require_once __DIR__ . "/classes/Tandas.php";
$file = "tandasFunctions";
try {
    $result = null;
    $am = new AuthManager($file);
    // retrieve variables
    $operation = http_request("Operation", "s", null);
    if ($operation === null) {
        throw new Exception("Call to tandasFunctions without 'Operation' requested");
    }
    // request prueba and jornada. invoke constructor
    $p = http_request("Prueba", "i", 0);
    $j = http_request("Jornada", "i", 0);
    $ot = new Tandas($file, $p, $j);
    // datos para listados, altas y bajas
    $id = http_request("ID", "i", 0);
    // tanda ID
    $d = http_request("Dorsal", "i", 0);
    $s = http_request("Sesion", "i", 0);
    // default is no session
    $a = http_request("Pendientes", "i", 0);
    // los siguiente campos se usan para drag and drop
    $f = http_request("From", "i", 0);
    $t = http_request("To", "i", 0);
    $w = http_request("Where", "i", 0);
    // 0:up 1:down
    if ($p <= 0 || $j <= 0) {
        throw new Exception("Call to tandasFunctions with Invalid Prueba:{$p} or Jornada:{$j} ID");
    }
Beispiel #5
0
 function videowall_llamada($pendientes)
 {
     // array ("Orden","Logo","Dorsal","Licencia","Nombre","Raza","Categoria","Grado","NombreGuia","NombreClub","Celo");
     $lastTanda = "";
     $lastTeam = 0;
     $otmgr = new Tandas("Llamada a pista", $this->prueba['ID'], $this->jornada['ID']);
     $lista = $otmgr->getData($this->sessionid, $this->tanda['ID'], $pendientes)['rows'];
     // obtiene los $pendientes primeros perros
     $orden = 0;
     $data = array();
     foreach ($lista as $participante) {
         if ($lastTanda !== $participante['Tanda']) {
             $lastTanda = $participante['Tanda'];
             $lastTeam = 0;
             // make sure team's name is shown
             // Orden=-1 means Tanda info
             $item = array("Orden" => -1, "Logo" => "empty.png", "Dorsal" => "&nbsp", "Licencia" => "&nbsp;", "Nombre" => "&nbsp;", "Raza", "Categoria" => "&nbsp", "Grado" => "---", "NombreGuia" => $lastTanda, "NombreClub" => "---", "Celo" => 0);
             array_push($data, $item);
         }
         if ($this->isTeam() && $lastTeam !== $participante['Equipo']) {
             $lastTeam = $participante['Equipo'];
             $team = $this->myDBObject->__getObject("Equipos", $lastTeam);
             // orden 0 means new team
             $item = array("Orden" => 0, "Logo" => "empty.png", "Dorsal" => "&nbsp", "Licencia" => "Equipo:", "Nombre" => $team->Nombre, "Raza", "Categoria" => "&nbsp", "Grado" => "&nbsp;", "NombreGuia" => "&nbsp;", "NombreClub" => "&nbsp;", "Celo" => 0);
             array_push($data, $item);
         }
         $orden++;
         $item = array("Orden" => $orden, "Logo" => $participante['Logo'], "Dorsal" => $participante['Dorsal'], "Licencia" => $participante['Licencia'], "Nombre" => $participante['Nombre'], "Raza" => $participante['Raza'], "Categoria" => $participante['Categoria'], "Grado" => $participante['Grado'], "NombreGuia" => $participante['NombreGuia'], "NombreClub" => $participante['NombreClub'], "Celo" => $participante['Celo'], "Observaciones" => $participante['Observaciones']);
         array_push($data, $item);
     }
     //
     $res = array('rows' => $data, 'total' => count($data));
     echo json_encode($res);
     return 0;
 }