Ejemplo n.º 1
0
 /**
  * Constructor
  * @throws Exception
  */
 function __construct($federation)
 {
     date_default_timezone_set('Europe/Madrid');
     parent::__construct('Portrait', "print_listaPerros", 1, 0);
     // use default prueba. not really needed
     $d = new Dogs("print_listaPerros");
     $res = $d->select();
     if (!is_array($res)) {
         $this->errormsg = "print_listaPerros: select() failed";
         throw new Exception($this->errormsg);
     }
     $this->lista = $res['rows'];
     // rework federation handling as parent got it from senseless prueba ID
     $this->federation = Federations::getFederation(intval($federation));
     $this->strClub = $this->federation->isInternational() ? _('Country') : _('Club');
     $this->icon = getIconPath($this->federation->get('Name'), "agilitycontest.png");
     $this->icon2 = getIconPath($this->federation->get('Name'), $this->federation->get('Logo'));
     $this->cols[8] = $this->strClub;
     // use "country" or "club" according federation
     if ($this->federation->get('WideLicense') == true) {
         // on wide license hide loe/rrc
         $this->pos[3] += $this->pos[4];
         $this->pos[4] = 0;
         $this->pos[3] += 5;
         // decrease handler name
         $this->pos[7] -= 5;
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  * @param {string} Name for this object
  * @param {integer} $manga Manga ID
  * @throws Exception when
  * - cannot contact database
  * - invalid manga ID
  */
 function __construct($file, $manga)
 {
     parent::__construct($file);
     if ($manga <= 0) {
         $this->errormsg = "Resultados::Construct invalid Manga ID: {$manga}";
         throw new Exception($this->errormsg);
     }
     $this->manga = $this->__getArray("Mangas", $manga);
     if (!is_array($this->manga)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get info on manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->jornada = $this->__getArray("Jornadas", $this->manga['Jornada']);
     if (!is_array($this->jornada)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get jornada info on jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->prueba = $this->__getArray("Pruebas", $this->jornada['Prueba']);
     if (!is_array($this->prueba)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get prueba info on prueba:{$this->jornada['Prueba']} jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->federation = Federations::getFederation(intval($this->prueba['RSCE']));
     if ($this->federation == null) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get federation info on prueba:{$this->jornada['Prueba']} jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
 }
Ejemplo n.º 3
0
 function createInfoPage($title, $federation = -1)
 {
     $infopage = $this->myWriter->getCurrentSheet();
     $name = _utf("Information");
     $infopage->setName($this->normalizeSheetName($name));
     // titulo
     $this->myWriter->addRowsWithStyle([[$title], [""]], $this->titleStyle);
     // en caso de estar definido, informacion de Prueba, jornada, y en su caso federacion
     if ($this->prueba != null) {
         $this->myWriter->addRowWithStyle([_utf("Contest") . ":", $this->prueba['Nombre']], $this->rowHeaderStyle);
     }
     if ($this->jornada != null) {
         $this->myWriter->addRowWithStyle([_utf("Journey") . ":", $this->jornada['Nombre']], $this->rowHeaderStyle);
     }
     if ($federation >= 0) {
         $fed = Federations::getFederation(intval($federation));
         if ($fed == null) {
             $this->myLogger->trace("Invalid federation ID:{$federation}");
         } else {
             $this->myWriter->addRowWithStyle([_utf("Federation") . ":", $fed->get('Name')], $this->rowHeaderStyle);
             $this->federation = $fed;
         }
     }
     // informacion de la aplicacion
     $this->myWriter->addRows([[""], [_utf("Program info")], ["Application: ", $this->myConfig->getEnv("program_name")], ["Version:", $this->myConfig->getEnv("version_name")], ["Revision:", $this->myConfig->getEnv("version_date")]]);
     // informacion de licencia
     $am = new AuthManager($this->myFile);
     $ainfo = $am->getRegistrationInfo();
     $this->myWriter->addRows([[""], [_utf("License Info")], ["Serial Number:", $ainfo["Serial"]], ["User:"******"User"]], ["Club:", $ainfo["Club"]]]);
 }
Ejemplo n.º 4
0
 /**
  * inserta una manga en la jornada
  * @param {integer} $tipo ID del tipo manga (tabla 'Mangas::Tipo_Manga')
  * @param {string} $grado valor asociado al grado de la manga de la ID dada
  * @return {string} empty on success, else error 
  */
 function insert($tipo, $grado)
 {
     $this->myLogger->enter();
     $j = $this->jornada;
     // si la manga existe no hacer nada; si no existe crear manga
     $res = $this->__selectObject("count(*) AS Result", "Mangas", "( Jornada={$j} ) AND  ( Tipo={$tipo} ) AND ( Grado='{$grado}' )");
     if (!is_object($res)) {
         return $this->error("Cannot get info on Mangas for Jornada:{$j}");
     }
     if ($res->Result > 0) {
         $this->myLogger->info("Jornada:{$j} Manga:{$tipo} already exists");
     } else {
         // buscamos el equipo por defecto de la jornada y lo insertamos
         $res = $this->__selectObject("*", "Equipos", "(Jornada={$j}) AND (DefaultTeam=1)");
         if (!is_object($res)) {
             return $this->error("Cannot get default Team for Jornada:{$j}");
         }
         $team = $res->ID;
         $observaciones = http_request("Observaciones", "s", "");
         $str = "INSERT INTO Mangas ( Jornada,Tipo,Grado,Observaciones,Orden_Salida,Orden_Equipos ) VALUES ( {$j},{$tipo},'{$grado}','{$observaciones}','BEGIN,END','BEGIN,{$team},END' )";
         $rs = $this->query($str);
         if (!$rs) {
             return $this->error($this->conn->error);
         }
     }
     /* si la prueba es selectiva forzamos tipo de recorrido, y TRS */
     if ($this->pruebaObj->Selectiva != 0) {
         $fed = Federations::getFederation(intval($this->pruebaObj->RSCE));
         $grades = $fed->get('Grades');
         $doSelectiva = false;
         if ($grades == 3 && $tipo == 6) {
             $doSelectiva = true;
         }
         // 3-grades Agility Grado III
         if ($grades == 3 && $tipo == 11) {
             $doSelectiva = true;
         }
         // 3-grades Jumping Grado III
         if ($grades == 2 && $tipo == 5) {
             $doSelectiva = true;
         }
         // 3-grades Jumping Grado II
         if ($grades == 2 && $tipo == 10) {
             $doSelectiva = true;
         }
         // 2-grades Jumping Grado II
         if ($doSelectiva) {
             $str = "UPDATE Mangas\n\t\t\t\tSET Recorrido=0,\n\t\t\t\tTRS_L_Tipo=1, TRS_M_Tipo=1, TRS_S_Tipo=1, TRS_T_Tipo=1,\n\t\t\t\tTRS_L_Factor=0, TRS_M_Factor=0, TRS_S_Factor=0, TRS_T_Factor=0,\n\t\t\t\tTRS_L_Unit='%', TRS_M_Unit='%', TRS_S_Unit='%', TRS_T_Unit='%'\n\t\t\t\tWHERE ( Jornada={$j} ) AND  ( Tipo={$tipo} ) AND ( Grado='{$grado}' )";
             $rs = $this->query($str);
             if (!$rs) {
                 return $this->error($this->conn->error);
             }
         }
     }
     $this->myLogger->leave();
     return "";
 }
Ejemplo n.º 5
0
 function __construct($file, $federation = -1)
 {
     parent::__construct($file);
     if ($federation == -1) {
         return;
     }
     // do not initialize federation info
     $this->curFederation = Federations::getFederation(intval($federation));
     if ($this->curFederation == null) {
         throw new Exception("Jueces::construct() Federation ID:{$federation} does not exist");
     }
 }
Ejemplo n.º 6
0
 public function __construct($fed)
 {
     $this->federation = Federations::getFederation($fed);
     $this->myConfig = Config::getInstance();
     $this->myLogger = new Logger("importExcel(dogs)", $this->myConfig->getEnv("debug_level"));
     if (php_sapi_name() != "cli") {
         $this->myAuthMgr = new AuthManager("importExcel(dogs)");
         if (!$this->myAuthMgr->allowed(ENABLE_IMPORT)) {
             throw new Exception("ImportExcel(dogs): Feature disabled: program not registered");
         }
     }
     $this->tablename = TABLE_NAME;
     $this->myDBObject = new DBObject("ImportExcel(dogs)");
     $this->fieldList = array('DogID' => array(-2, 0, "i", "DogID", " `DogID` int(4) NOT NULL DEFAULT 0, "), 'Name' => array(-3, 1, "s", "Nombre", " `Nombre` varchar(255) NOT NULL, "), 'LongName' => array(-4, -1, "s", "NombreLargo", "`NombreLargo` varchar(255) DEFAULT NULL, "), 'Gender' => array(-5, -1, "s", "Genero", " `Genero` varchar(16) DEFAULT NULL, "), 'Breed' => array(-6, -1, "s", "Raza", " `Raza` varchar(255) DEFAULT NULL, "), 'License' => array(-7, -1, "s", "Licencia", " `Licencia` varchar(255) DEFAULT '--------', "), 'KC_ID' => array(-8, -1, "s", "LOE_RRC", " `LOE_RRC` varchar(255) DEFAULT NULL, "), 'Cat' => array(-9, 1, "s", "Categoria", " `Categoria` varchar(1) NOT NULL DEFAULT '-', "), 'Grad' => array(-10, 1, "s", "Grado", " `Grado` varchar(16) DEFAULT '-', "), 'HandlerID' => array(-11, 0, "i", "HandlerID", " `HandlerID` int(4) NOT NULL DEFAULT 0, "), 'Handler' => array(-12, 1, "s", "NombreGuia", " `NombreGuia` varchar(255) NOT NULL, "), 'ClubID' => array(-13, 0, "i", "ClubID", " `ClubID` int(4) NOT NULL DEFAULT 0, "), 'Club' => array(-14, 1, "s", "NombreClub", " `NombreClub` varchar(255) NOT NULL,"));
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  * @param {int} $prueba Prueba ID
  * @throws Exception
  */
 function __construct($prueba)
 {
     parent::__construct("clasifications.xlsx");
     setcookie('fileDownload', 'true', time() + 30, "/");
     // tell browser to hide "downloading" message box
     $p = new Pruebas("excel_Clasificaciones");
     $res = $p->selectByID($prueba);
     if (!is_array($res)) {
         $this->errormsg = "excel_Clasificaciones: getPruebaByID({$prueba}) failed";
         throw new Exception($this->errormsg);
     }
     $this->prueba = $res;
     $j = new Jornadas("excel_Clasificaciones", $prueba);
     $res = $j->selectByPrueba();
     if (!is_array($res)) {
         $this->errormsg = "excel_Clasificaciones: getJornadasByPrueba({$prueba}) failed";
         throw new Exception($this->errormsg);
     }
     $this->jornadas = $res['rows'];
     // to get mode in trs evaluation
     $this->federation = Federations::getFederation($this->prueba['RSCE']);
     $this->jdbObject = new Jueces("excelClasification");
 }
Ejemplo n.º 8
0
 static function __compose(&$data, $prueba, $jornadaid, $tiporonda, $m1, $m2)
 {
     $heights = intval(Federations::getFederation(intval($prueba['RSCE']))->get('Heights'));
     switch (intval($m1['Recorrido'])) {
         // should be the same than $m2['Recorrido']
         case 0:
             // separado
             array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 0, $m1, $m2));
             // large
             array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 1, $m1, $m2));
             // medium
             array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 2, $m1, $m2));
             // small
             if ($heights == 4) {
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 5, $m1, $m2));
                 // tiny
             }
             break;
         case 1:
             // mixto
             if ($heights == 3) {
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 0, $m1, $m2));
                 // large
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 3, $m1, $m2));
                 // m+s
             } else {
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 6, $m1, $m2));
                 // l+m
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 7, $m1, $m2));
                 // s+t
             }
             break;
         case 2:
             // conjunto
             if ($heights == 3) {
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 4, $m1, $m2));
                 // l+m+s
             } else {
                 array_push($data, Jornadas::__composeArray($prueba['ID'], $jornadaid, $tiporonda, $m1['Recorrido'], 8, $m1, $m2));
                 // l+m+s+t
             }
             break;
     }
 }
Ejemplo n.º 9
0
 $mangas[5] = http_request("Manga6", "i", 0);
 $mangas[6] = http_request("Manga7", "i", 0);
 $mangas[7] = http_request("Manga8", "i", 0);
 $mangas[8] = http_request("Manga9", "i", 0);
 // mangas 3..9 are used in KO rondas
 $mode = http_request("Mode", "i", "0");
 // 0:Large 1:Medium 2:Small 3:Medium+Small 4:Large+Medium+Small
 header("Content-type: text/plain");
 header("Content-Disposition: attachment; filename=printEtiquetas.csv");
 // buscamos los recorridos asociados a la mangas
 $dbobj = new DBObject("print_etiquetas_csv");
 $mng = $dbobj->__getObject("Mangas", $mangas[0]);
 $prb = $dbobj->__getObject("Pruebas", $prueba);
 $c = new Clasificaciones("print_etiquetas_csv", $prueba, $jornada);
 $result = array();
 $heights = intval(Federations::getFederation(intval($prb->RSCE))->get('Heights'));
 switch ($mng->Recorrido) {
     case 0:
         // recorridos separados large medium small
         $r = $c->clasificacionFinal($rondas, $mangas, 0);
         $result[0] = $r['rows'];
         $r = $c->clasificacionFinal($rondas, $mangas, 1);
         $result[1] = $r['rows'];
         $r = $c->clasificacionFinal($rondas, $mangas, 2);
         $result[2] = $r['rows'];
         if ($heights != 3) {
             $r = $c->clasificacionFinal($rondas, $mangas, 5);
             $result[5] = $r['rows'];
         }
         break;
     case 1:
Ejemplo n.º 10
0
 /**
  * genera la tabla de resultados finales y evalua el orden de clasificacion
  * @param {array} $c1 clasificacion primera manga
  * @param {array} $c2 clasificacion segunda manga
  */
 function evalFinal($idmangas, $c1, $c2)
 {
     $this->myLogger->enter();
     $m1 = $this->__getObject("Mangas", $idmangas[0]);
     $m2 = $this->__getObject("Mangas", $idmangas[1]);
     $final = array();
     // puesto,dorsal, nombre, licencia,categoria,grado, nombreguia, nombreclub,
     // F1,R1,T1,V1,P1,C1,F2,R2,T2,V2,P2,C2, Penalizacion,Calificacion
     // Procesamos la primera manga y generamos una segunda manga "fake"
     foreach ($c1['rows'] as $item) {
         $participante = array('Participantes' => count($c1['rows']), 'Perro' => $item['Perro'], 'Dorsal' => $item['Dorsal'], 'Nombre' => $item['Nombre'], 'Licencia' => $item['Licencia'], 'Categoria' => $item['Categoria'], 'Grado' => $item['Grado'], 'Equipo' => $item['Equipo'], 'NombreEquipo' => $item['NombreEquipo'], 'NombreGuia' => $item['NombreGuia'], 'NombreClub' => $item['NombreClub'], 'LogoClub' => $item['LogoClub'], 'F1' => $item['Faltas'] + $item['Tocados'], 'R1' => $item['Rehuses'], 'E1' => $item['Eliminado'], 'N1' => $item['NoPresentado'], 'T1' => floatval($item['Tiempo']), 'V1' => $item['Velocidad'], 'P1' => $item['Penalizacion'], 'C1' => $item['CShort'], 'Puesto1' => $item['Puesto'], 'Pcat1' => $item['Pcat'], 'F2' => 0, 'R2' => 0, 'E2' => 0, 'N2' => 0, 'T2' => 0, 'V2' => 0, 'P2' => 400, 'C2' => '', 'Puesto2' => 0, 'Pcat2' => 0, 'Tiempo' => $item['Tiempo'], 'Penalizacion' => $item['Penalizacion'] + 400, 'Calificacion' => $item['CShort'], 'Puntos' => '', 'Puesto' => 0, 'Pcat' => 0);
         $final[$item['Perro']] = $participante;
     }
     if ($c2 != null) {
         // Procesamos la segunda manga
         foreach ($c2['rows'] as $item) {
             if (!isset($final[$item['Perro']])) {
                 $this->myLogger->notice("El perro con ID:{$item['Perro']} no tiene datos en la primera manga.");
                 $final[$item['Perro']] = array('Participantes' => count($c2['rows']), 'Perro' => $item['Perro'], 'Dorsal' => $item['Dorsal'], 'Nombre' => $item['Nombre'], 'Licencia' => $item['Licencia'], 'Categoria' => $item['Categoria'], 'Grado' => $item['Grado'], 'Equipo' => $item['Equipo'], 'NombreEquipo' => $item['NombreEquipo'], 'NombreGuia' => $item['NombreGuia'], 'NombreClub' => $item['NombreClub'], 'LogoClub' => $item['LogoClub'], 'F1' => 0, 'R1' => 0, 'E1' => 0, 'N1' => 0, 'T1' => 0, 'V1' => 0, 'P1' => 400, 'C1' => '', 'Puesto1' => 0, 'Pcat1' => 0, 'Puesto' => 0, 'Pcat' => 0);
             }
             $final[$item['Perro']]['F2'] = $item['Faltas'] + $item['Tocados'];
             $final[$item['Perro']]['R2'] = $item['Rehuses'];
             $final[$item['Perro']]['E2'] = $item['Eliminado'];
             $final[$item['Perro']]['N2'] = $item['NoPresentado'];
             $final[$item['Perro']]['T2'] = floatval($item['Tiempo']);
             $final[$item['Perro']]['V2'] = $item['Velocidad'];
             $final[$item['Perro']]['P2'] = $item['Penalizacion'];
             $final[$item['Perro']]['C2'] = $item['CShort'];
             $final[$item['Perro']]['Puesto2'] = $item['Puesto'];
             $final[$item['Perro']]['Pcat2'] = $item['Pcat'];
             $final[$item['Perro']]['Tiempo'] = $final[$item['Perro']]['T1'] + $final[$item['Perro']]['T2'];
             $final[$item['Perro']]['Penalizacion'] = $final[$item['Perro']]['P1'] + $final[$item['Perro']]['P2'];
             $final[$item['Perro']]['Calificacion'] = '';
             $final[$item['Perro']]['Puntos'] = '';
         }
     }
     // una vez ordenados, el índice perro ya no tiene sentido, con lo que vamos a eliminarlo
     // y reconstruir el array
     $final2 = array();
     foreach ($final as $item) {
         array_push($final2, $item);
     }
     $final = $final2;
     // re-ordenamos los datos en base a la puntuacion
     usort($final, function ($a, $b) {
         if ($a['Penalizacion'] == $b['Penalizacion']) {
             return $a['Tiempo'] > $b['Tiempo'] ? 1 : -1;
         }
         return $a['Penalizacion'] > $b['Penalizacion'] ? 1 : -1;
     });
     // calculamos campo "Puesto", "Calificacion" y Puntos
     $puestocat = array('C' => 1, 'L' => 1, 'M' => 1, 'S' => 1, 'T' => 1);
     // ultimo puesto por cada categoria
     $lastcat = array('C' => 0, 'L' => 0, 'M' => 0, 'S' => 0, 'T' => 0);
     // ultima puntuacion por cada categoria
     $countcat = array('C' => 0, 'L' => 0, 'M' => 0, 'S' => 0, 'T' => 0);
     // perros contabilizados de cada categoria
     $size = count($final);
     for ($idx = 0; $idx < $size; $idx++) {
         // vemos la categoria y actualizamos contadores de categoria
         $cat = $final[$idx]['Categoria'];
         $countcat['C']++;
         // Conjunta
         $countcat[$cat]++;
         // Por categoria
         // obtenemos la penalizacion del perro actual
         $now = 100 * $final[$idx]['Penalizacion'] + $final[$idx]['Tiempo'];
         // ajustamos puesto conjunto y guardamos resultado
         if ($lastcat['C'] != $now) {
             $lastcat['C'] = $now;
             $puestocat['C'] = $countcat['C'];
         }
         $final[$idx]['Puesto'] = $puestocat['C'];
         // ajustamos puesto por categoria y guardamos resultado
         if ($lastcat[$cat] != $now) {
             $lastcat[$cat] = $now;
             $puestocat[$cat] = $countcat[$cat];
         }
         $final[$idx]['Pcat'] = $puestocat[$cat];
         // on special journeys do not evaluate calification
         if ($this->jornada->Equipos3 != 0) {
             continue;
         }
         if ($this->jornada->Equipos4 != 0) {
             continue;
         }
         if ($this->jornada->KO != 0) {
             continue;
         }
         if ($this->jornada->Open != 0) {
             continue;
         }
         // evaluamos calificacion y puntos en funcion de la federacion y de si es o no selectiva
         $fed = Federations::getFederation(intval($this->prueba->RSCE));
         $fed->evalFinalCalification($this->prueba, $this->jornada, $m1, $m2, $c1, $c2, $final[$idx], $puestocat);
     }
     // Esto es (casi) t odo, amigos
     $result = array();
     $result['total'] = $size;
     $result['rows'] = $final;
     $result['trs1'] = $c1['trs'];
     $result['trs2'] = $c2['trs'];
     $result['jueces'] = array($c1['manga']->NombreJuez1, $c1['manga']->NombreJuez2);
     return $result;
 }
Ejemplo n.º 11
0
 /**
  * Enumerate grados 
  * @param {integer} federation ID; -1:any
  * @return null on error; result on success
  * Notice that this is not a combogrid, just combobox, so dont result count
  */
 function gradosPerro($fed = -1)
 {
     $this->myLogger->enter();
     // evaluate federation search argument
     $f = "1";
     if ($fed >= 0) {
         // ask how many grades has selected federation
         $fedinfo = Federations::getFederation(intval($fed));
         if ($fedinfo) {
             if ($fedinfo->get('Grades') === 2) {
                 $f = "(Grado <> 'GIII') ";
             }
             $result = array();
             foreach ($fedinfo->get('ListaGrados') as $cat => $name) {
                 if ($cat === "-") {
                     array_push($result, array("Grado" => $cat, "Comentarios" => $name, "selected" => 1));
                 } else {
                     array_push($result, array("Grado" => $cat, "Comentarios" => $name, "selected" => 0));
                 }
             }
             return $result;
         }
         $this->myLogger->error("CategoriasPerro: invalid federation ID:{$fed}");
     }
     // if federation is not provided or invalid, extract all  available values from database
     // evaluate search string for query
     $q = http_request("q", "s", "");
     $like = "";
     if ($q == "") {
         $like = " WHERE Grado LIKE '%" . $q . "%'";
     }
     // query to retrieve table data
     $sql = "SELECT Grado,Comentarios FROM Grados_Perro " . $like . " ORDER BY Grado";
     $this->myLogger->query($sql);
     $rs = $this->query($sql);
     if (!$rs) {
         return $this->error($this->conn->error);
     }
     // retrieve result into an array
     $result = array();
     while ($row = $rs->fetch_array(MYSQLI_ASSOC)) {
         // add a default state for comobobox
         if ($row["Grado"] === '-') {
             $row["selected"] = 1;
             $row[2] = 1;
         } else {
             $row["selected"] = 0;
             $row[2] = 0;
         }
         // and store into result array
         array_push($result, $row);
     }
     // clean and return
     $rs->free();
     $this->myLogger->leave();
     return $result;
 }
Ejemplo n.º 12
0
 function getFederation()
 {
     if ($this->federation != null) {
         return $this->federation;
     }
     $prb = $this->getDatosPrueba();
     $this->federation = Federations::getFederation(intval($prb->RSCE));
     $this->myLogger->trace("Datos prueba: " . json_encode($prb) . " Datos federacion " . json_encode($this->federation));
     return $this->federation;
 }
Ejemplo n.º 13
0
 static function infomanga($fed, $rec)
 {
     $fed = Federations::getFederation($fed);
     if (!$fed) {
         return array('errorMsg' => 'Invalid federation ID');
     }
     return $fed->getInfoManga($rec);
 }
Ejemplo n.º 14
0
getLogo.php

Copyright  2013-2016 by Juan Antonio Martinez ( juansgaviota at gmail dot com )

This program is free software; you can redistribute it and/or modify it under the terms 
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
 * tool to retrieve an image from server by providing federation and canonical name
 */
require_once __DIR__ . "/../../server/tools.php";
require_once __DIR__ . "/../../modules/Federations.php";
$fed = http_request("Fed", "i", http_request("Federation", "i", 0));
$logo = http_request("Logo", "s", "null.png");
$fedname = Federations::getFederation(intval($fed))->get('Name');
$iconpath = getIconPath($fedname, $logo);
$image = imagecreatefromstring(file_get_contents($iconpath));
imagealphablending($image, false);
// preserve transparency
imagesavealpha($image, true);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
Ejemplo n.º 15
0
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 -->

<?php 
require_once __DIR__ . "/../../server/tools.php";
require_once __DIR__ . "/../../server/auth/Config.php";
require_once __DIR__ . "/../../modules/Federations.php";
$config = Config::getInstance();
// retrieve federation info
$f = intval(http_request("Federation", "i", 0));
$fed = Federations::getFederation($f);
if (!$fed) {
    die("Internal error::Invalid Federation ID: {$f}");
}
?>

<!-- Formulario que contiene los datos de una manga -->

<form id="competicion-formdatosmanga">
	<input type="hidden" id="dmanga_Operation" name="Operation" value=""/>
	<input type="hidden" id="dmanga_Jornada" name="Jornada" value=""/>
	<input type="hidden" id="dmanga_Manga" name="Manga" value=""/>
	<input type="hidden" id="dmanga_ID" name="ID" value=""/>
	<input type="hidden" id="dmanga_Tipo" name="Tipo" value=""/>
	<table id="competicion-tabladatosmanga">
		<tr>
Ejemplo n.º 16
0
 /**
  * Insert or update Tandas according Jornada Data
  */
 function populateJornada()
 {
     $this->myLogger->enter();
     // obtenemos datos de la jornada y prueba
     $j = $this->jornada;
     $p = $this->prueba;
     $f = Federations::getFederation(intval(intval($p->RSCE)));
     $this->myLogger->trace("call to getFederation({$p->RSCE}) returns: " . print_r($f, true));
     // actualizamos la lista de tandas de cada ronda
     // preagility necesita tratamiento especial
     if ($j->PreAgility2 != 0) {
         // preagility2 also handles preagility1
         $this->insert_remove($f, 1, true);
         // Pre-Agility Manga 1
         $this->insert_remove($f, 2, true);
         // Pre-Agility Manga 2
     } else {
         if ($j->PreAgility != 0) {
             $this->insert_remove($f, 1, true);
             // Pre-Agility Manga 1
             $this->insert_remove($f, 2, false);
             // Pre-Agility Manga 2
         } else {
             $this->insert_remove($f, 1, false);
             // Pre-Agility Manga 1
             $this->insert_remove($f, 2, false);
             // Pre-Agility Manga 2
         }
     }
     $this->insert_remove($f, 3, $j->Grado1 != 0 ? true : false);
     // Agility Grado I Manga 1
     $this->insert_remove($f, 4, $j->Grado1 != 0 ? true : false);
     // Agility Grado I Manga 2
     $this->insert_remove($f, 5, $j->Grado2 != 0 ? true : false);
     // Agility Grado II
     $this->insert_remove($f, 10, $j->Grado2 != 0 ? true : false);
     // Jumping Grado II
     $this->insert_remove($f, 6, $j->Grado3 != 0 ? true : false);
     // Agility Grado III
     $this->insert_remove($f, 11, $j->Grado3 != 0 ? true : false);
     // Jumping Grado III
     $this->insert_remove($f, 7, $j->Open != 0 ? true : false);
     // Agility Abierta
     $this->insert_remove($f, 12, $j->Open != 0 ? true : false);
     // Jumping Abierta
     $this->insert_remove($f, 8, $j->Equipos3 != 0 ? true : false);
     // Agility Equipos (3 mejores)
     $this->insert_remove($f, 13, $j->Equipos3 != 0 ? true : false);
     // Jumping Equipos (3 mejores)
     $this->insert_remove($f, 9, $j->Equipos4 != 0 ? true : false);
     // Agility Equipos (Conjunta)
     $this->insert_remove($f, 14, $j->Equipos4 != 0 ? true : false);
     // Jumping Equipos (Conjunta)
     $this->insert_remove($f, 15, $j->KO != 0 ? true : false);
     // Ronda K.O.
     $this->insert_remove($f, 16, $j->Especial != 0 ? true : false);
     // Manga especial
     $this->myLogger->leave();
 }
Ejemplo n.º 17
0
 $result = null;
 $federation = http_request("Federation", "i", -1);
 // -1 defaults to all federations
 $operation = http_request("Operation", "s", null);
 // retrieve requested operation
 $recorrido = http_request("Recorrido", "i", 0);
 // 0:separate 1:mixed 2:common
 if ($operation === null) {
     throw new Exception("Call to moduleFunctions without 'Operation' requested");
 }
 switch ($operation) {
     case "list":
         $result = Federations::getFederationList();
         break;
     case "info":
         $result = Federations::getFederation($federation);
         break;
     case "enumerate":
         $result = Federations::enumerate();
         break;
     case "infomanga":
         $result = Federations::infomanga($federation, $recorrido);
         break;
     default:
         throw new Exception("moduleFunctions:: invalid operation: '{$operation}' provided");
 }
 if ($result === null) {
     throw new Exception($jueces->errormsg);
 }
 if ($result === "") {
     echo json_encode(array('success' => true));
 // Creamos generador de documento
 header("Pragma: public");
 header("Expires: 0");
 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
 header("Content-Type: application/force-download");
 header("Content-Type: application/octet-stream");
 header("Content-Type: application/download");
 header("Content-Disposition: attachment;filename=clasificacion.xls");
 header("Content-Transfer-Encoding: binary ");
 $excel = new Excel($prueba, $jornada, $mangas);
 $excel->xlsBOF();
 $base = $excel->write_PageHeader($prueba, $jornada, $mangas);
 // buscamos los recorridos asociados a la mangas
 $c = new Clasificaciones("print_clasificacion_excel", $prueba, $jornada);
 $result = array();
 $heights = intval(Federations::getFederation(intval($excel->prueba->RSCE))->get('Heights'));
 switch ($excel->manga1->Recorrido) {
     case 0:
         // recorridos separados large medium small tiny
         $r = $c->clasificacionFinal($rondas, $mangas, 0);
         $base = $excel->composeTable($mangas, $r, 0, $base + 1);
         $r = $c->clasificacionFinal($rondas, $mangas, 1);
         $base = $excel->composeTable($mangas, $r, 1, $base + 1);
         $r = $c->clasificacionFinal($rondas, $mangas, 2);
         $base = $excel->composeTable($mangas, $r, 2, $base + 1);
         if ($heights != 3) {
             $r = $c->clasificacionFinal($rondas, $mangas, 5);
             $base = $excel->composeTable($mangas, $r, 5, $base + 1);
         }
         break;
     case 1:
Ejemplo n.º 19
0
 /**
  * Constructor de la superclase 
  * @param {string} orientacion 'landscape' o 'portrait'
  * @param {string} file name of caller to be used in traces
  * @param {int} $prueba ID de la jornada
  * @param {int} jornada Jornada ID
  */
 function __construct($orientacion, $file, $prueba, $jornada = 0)
 {
     date_default_timezone_set('Europe/Madrid');
     $this->config = Config::getInstance();
     $this->myLogger = new Logger($file, $this->config->getEnv("debug_level"));
     parent::__construct($orientacion, 'mm', 'A4');
     // Portrait or Landscape
     $this->SetAutoPageBreak(true, 1.7);
     // default margin is 2cm. so enlarge a bit
     $this->installFonts($this->config->getEnv("pdf_fontfamily"));
     $this->centro = $orientacion === 'Portrait' ? 107 : 145;
     $this->myDBObject = new DBObject($file);
     $this->prueba = null;
     $this->federation = Federations::getFederation(0);
     // defaults to RSCE
     if ($prueba != 0) {
         $this->prueba = $this->myDBObject->__getObject("Pruebas", $prueba);
         $this->federation = Federations::getFederation(intval($this->prueba->RSCE));
     }
     $this->strClub = $this->federation->isInternational() ? _('Country') : _('Club');
     $fedName = $this->federation->get('Name');
     // $this->myLogger->trace("Federation is: ".json_decode($this->federation));
     $this->club = null;
     if ($prueba != 0) {
         $this->club = $this->myDBObject->__getObject("Clubes", $this->prueba->Club);
         // club organizador
     }
     $this->jornada = null;
     if ($jornada != 0) {
         $this->jornada = $this->myDBObject->__getObject("Jornadas", $jornada);
     }
     // on international contests, use logos from federation
     $this->icon = getIconPath($fedName, $this->federation->get('OrganizerLogo'));
     $this->icon2 = getIconPath($fedName, $this->federation->get('ParentLogo'));
     // on national events, use organizing club logo (if any )
     if (!$this->federation->isInternational() && isset($this->club)) {
         $this->icon = getIconPath($fedName, $this->club->Logo);
         $this->icon2 = getIconPath($fedName, $this->federation->get('Logo'));
         if ($this->icon == $this->icon2) {
             $this->icon2 = getIconPath($fedName, $this->federation->get('ParentLogo'));
         }
     }
     // handle registration info related to PDF generation
     $this->authManager = new AuthManager("print_common");
     $this->regInfo = $this->authManager->getRegistrationInfo();
     if ($this->regInfo == null || $this->regInfo['Serial'] === "00000000") {
         $this->icon = getIconPath($fedName, "agilitycontest.png");
     }
     // evaluate number of decimals to show when printing timestamps
     $this->timeResolution = $this->config->getEnv('crono_miliseconds') == "0" ? 2 : 3;
     // $this->myLogger->trace("Time resolution is ".$this->timeResolution);
 }