Skip to content

Commit d627f61

Browse files
committed
frm_competicion: add code to change journey directly from competition window
PENDING: revise an oscure javascript error on clear+reload competition window when javascript code is inside competition page. Not critical, but dirty
1 parent 8144c77 commit d627f61

File tree

2 files changed

+87
-23
lines changed

2 files changed

+87
-23
lines changed

agility/console/frm_competicion2.php

+56-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,61 @@
7070
<!-- PANEL INFORMATIVO SOBRE LA MANGAS DE ESTA JORNADA -->
7171
<div id="competicion_info" style="width:100%">
7272

73+
<header style="width:100%">
74+
<span id="competicion_info_title" style="font-weight:bold;text-align:left;display:inline-block;width:50%">Titulo</span>
75+
<span style="text-align:right;display:inline-block;width:47%">
76+
<label for="competicion_journeyList"><?php _e("Select journey");?></label>&nbsp;
77+
<select id="competicion_journeyList" name="competicion_journeyList" style="width:125px" class="easyui-combogrid"
78+
data-options="
79+
panelWidth: 200,
80+
panelHeight: 'auto',
81+
idField: 'ID',
82+
textField: 'Nombre',
83+
value: workingData.datosJornada.ID,
84+
method: 'get',
85+
mode: 'remote',
86+
required: true,
87+
multiple: false,
88+
fitColumns: true,
89+
singleSelect: true,
90+
editable: false,
91+
rownumbers: true,
92+
noheader: true,
93+
url: '../ajax/database/jornadaFunctions.php',
94+
queryParams: { Operation: 'enumerate', Prueba: workingData.prueba, AllowClosed:false, HideUnassigned:1 },
95+
columns: [[
96+
{ field:'ID', hidden:true }, // ID de la jornada
97+
{ field:'Numero', hidden:true }, // numero de orden de la jornada
98+
{ field:'Prueba', hidden:true }, // ID de la prueba
99+
{ field:'Nombre', width:25, sortable:false, align:'left', title: '<?php _e('Journey'); ?>' },
100+
{ field:'Nombre_Competicion',hidden:true },
101+
{ field:'Tipo_Competicion', hidden:true},
102+
{ field:'Fecha', hidden:true},
103+
{ field:'Hora', hidden:true},
104+
{ field:'Grado1', hidden:true},
105+
{ field:'Grado2', hidden:true},
106+
{ field:'Grado3', hidden:true},
107+
{ field:'Open', hidden:true},
108+
{ field:'Equipos3', hidden:true},
109+
{ field:'Equipos4', hidden:true},
110+
{ field:'PreAgility', hidden:true},
111+
{ field:'Children', hidden:true},
112+
{ field:'Junior', hidden:true},
113+
{ field:'Senior', hidden:true},
114+
{ field:'ParaAgility', hidden:true},
115+
{ field:'KO', hidden:true},
116+
{ field:'Especial', hidden:true},
117+
{ field:'Cerrada', hidden:true}
118+
]],
119+
onLoadSuccess: function(data){ $('#competicion_journeyList').combogrid('setValue',workingData.datosJornada.ID); },
120+
onChange: function(newval,oldval) {
121+
jumpToSelectedJourney( $('#competicion_journeyList').combogrid('grid').datagrid('getSelected'));
122+
}
123+
124+
">
125+
</select>
126+
</span>
127+
</header>
73128
<!-- paneles de lista de mangas y datos de cada manga -->
74129
<div id="competicion_infolayout" class="easyui-layout" style="height:450px">
75130
<div data-options="region:'west',title:'<?php _e('Journey rounds');?>',split:true,collapsed:false" style="width:20%">
@@ -102,12 +157,11 @@
102157
onclick="competicionDialog('resultadosmanga');"><?php _e('Round results');?></a>
103158
</span>
104159
</div>
105-
106160
<script type="text/javascript">
107161

108162
// declaracion de cada elemento grafico
163+
$('#competicion_info_title').html(workingData.nombrePrueba+' -- '+workingData.nombreJornada);
109164
$('#competicion_info').panel({
110-
title:workingData.nombrePrueba+' -- '+workingData.nombreJornada,
111165
border:true,
112166
closable:false,
113167
collapsible:false,

agility/server/pdf/classes/PrintEntradaDeDatos.php

+31-21
Original file line numberDiff line numberDiff line change
@@ -611,34 +611,44 @@ function composeTable() {
611611
$fromItem=intval($a[0]);
612612
$toItem=intval($a[1]);
613613
}
614-
// Datos
615-
$numentries=count($this->orden);
616-
$orden=1;
617-
$rowcount=0;
618-
$printed=1;
614+
// OrdenSalida::getData() nos da _todos_ los perros de una manga que cumplen con el modo de recorrido dado
615+
// como aquí fromItem y toItem se refieren al puesto en que aparecen en la consola, sera preciso hacer
616+
// una criba inicial, excluyendo a los que no coincidan con las categorias pedidas (validCats)
617+
$items=array();
619618
foreach($this->orden as $row) {
620-
// elimina todos los perros que no entran en las categorias a imprimir
621-
if (!category_match($row['Categoria'],$this->heights,$this->validcats)) continue;
622-
if (($orden<$fromItem) || ($orden>$toItem) ) { $orden++; continue; } // not in range; skip
623-
// in team best min/max, there can be more dogs than max, so if dog is marked as "Not Presented" skip
624-
if(intval($row['NoPresentado'])===1) { $orden++; continue; } ;
625-
// if number of entries is lower than rows per page, print every entries in just one page
626-
$page=true; // check for need to page categories
627-
if ($numentries <= $this->numrows) $page=false; // every dogs fits in one sheet
628-
if ( isMangaPreAgility($this->manga->Tipo)) $page=false; // pre-agility rounds does not page heights
629-
// if ($this->validcats=="XLMST") $page=false; // any height is allowed: do not page
619+
// pending: trying to optimize when "validcats" matches "recorrido"
620+
if (category_match($row['Categoria'],$this->heights,$this->validcats)) array_push($items,$row);
621+
}
622+
// ahora que hemos filtrado, vamos a imprimir solo los que esten entre fromItem y toItem
623+
$orden=0; // numero de orden en la consola
624+
$rowcount=0; // numero de columna en la hoja (5,10,15)
625+
$printed=1; // numero de orden que aparecera en el listado
626+
for($orden=0;$orden<count($items);$orden++) {
627+
if ($orden+1<$fromItem) continue;
628+
if ($orden+1>$toItem) continue;
629+
// also skip items marked as "No Presentado"
630+
$row=$items[$orden];
631+
if(intval($row['NoPresentado'])===1) continue;
632+
633+
// ok. tenemos elemento a imprimir. Vamos a ver si hay que hacer salto de pagina
634+
$page=true;
635+
// si el numero de entradas cabe en una paquina omitimos saltos de pagina
636+
if (count($items) <= $this->numrows) $page=false;
637+
// en pre-agility tambien saltan todos juntos, y omitimos salto de pagina en el listado
638+
if ( isMangaPreAgility($this->manga->Tipo)) $page=false;
639+
// en caso de que se permita salto de pagina, comprobamos si hay cambio de categoria
640+
// y en caso afirmativo, reseteamos el contador de fila y actualizamos ultima categoria activa
630641
if ( $page ) {
631642
// if change in categoria, reset orden counter and force page change
632643
$ccats=compatible_categories($this->heights,$this->categoria);
633644
if (!category_match($row['Categoria'],$this->heights,$ccats)) {
634645
$rowcount=0;
635-
$orden=1;
636646
$this->categoria = $row['Categoria'];
637647
}
638648
}
639-
649+
// ahora vemos si hay que cambiar de pagina
640650
// REMINDER: $this->cell( width, height, data, borders, where, align, fill)
641-
if( ($rowcount % $this->numrows) == 0 ) { // assume $numrows entries per page
651+
if( ($rowcount % $this->numrows) == 0 ) { // assume $numrows entries per page
642652
$this->AddPage();
643653
if($this->numrows!=1) {
644654
// indicamos nombre del operador que rellena la hoja
@@ -649,14 +659,14 @@ function composeTable() {
649659
$this->Ln(15);
650660
}
651661
}
662+
// y finalmente imprimimos la celda en cuestion
652663
switch($this->numrows) {
653664
case 1: $this->writeTableCell_1($row,$printed);break;
654665
case 5: $this->writeTableCell_5($row,$printed);break;
655-
case 10: $this->writeTableCell_10($row,$printed);break;
656-
case 15: $this->writeTableCell_15($row,$printed);break;
666+
case 10: $this->writeTableCell_10($row,$printed);break;
667+
case 15: $this->writeTableCell_15($row,$printed);break;
657668
}
658669
$rowcount++;
659-
$orden++;
660670
$printed++;
661671
}
662672
// Línea de cierre

0 commit comments

Comments
 (0)