function composeTable() { $this->myLogger->enter(); $this->ac_SetDrawColor($this->config->getEnv('pdf_linecolor')); $this->SetLineWidth(0.3); if ($this->federation->get('WideLicense')) { $this->pos[1] += 5; $this->pos[2] = 0; $this->pos[3] += 5; $this->pos[4] += 5; } // Datos $rowcount = 0; $numrows = $this->PageNo() == 1 ? 30 : 33; $this->myLogger->trace("before foreach"); foreach ($this->resultados['rows'] as $row) { // REMINDER: $this->cell( width, height, data, borders, where, align, fill) if ($rowcount % $numrows == 0) { // assume $numrows rows per page ( rowWidth = 7mmts ) if ($rowcount > 0) { $this->Cell(array_sum($this->pos), 0, '', 'T'); } // linea de cierre $this->addPage(); $this->writeTableHeader(); } // properly format special fields $puesto = $row['Penalizacion'] >= 200 ? "-" : "{$row['Puesto']}"; $veloc = $row['Penalizacion'] >= 200 ? "-" : number_format($row['Velocidad'], 1); $tiempo = $row['Penalizacion'] >= 200 ? "-" : number_format($row['Tiempo'], $this->timeResolution); $penal = number_format($row['Penalizacion'], $this->timeResolution); $this->ac_row($rowcount, 8); // print row data $this->SetFont($this->getFontName(), '', 8); // set data font size $this->Cell($this->pos[0], 6, $row['Dorsal'], 'LR', 0, $this->align[0], true); $this->SetFont($this->getFontName(), 'B', 8); // mark Nombre as bold $this->Cell($this->pos[1], 6, $row['Nombre'], 'LR', 0, $this->align[1], true); $this->SetFont($this->getFontName(), '', 8); // set data font size if ($this->pos[2] != 0) { $this->Cell($this->pos[2], 6, $row['Licencia'], 'LR', 0, $this->align[2], true); } $this->Cell($this->pos[3], 6, $row['NombreGuia'], 'LR', 0, $this->align[3], true); $this->Cell($this->pos[4], 6, $row['NombreClub'], 'LR', 0, $this->align[4], true); if (Jornadas::hasGrades($this->jornada->ID)) { $this->Cell($this->pos[5], 6, $row['Categoria'] . ' - ' . $row['Grado'], 'LR', 0, $this->align[5], true); } else { // $catstr=$row['Categoria']; $catstr = $this->federation->getCategory($row['Categoria']); $this->Cell($this->pos[5], 6, $catstr, 'LR', 0, $this->align[5], true); } $this->Cell($this->pos[6], 6, $row['Faltas'], 'LR', 0, $this->align[6], true); $this->Cell($this->pos[7], 6, $row['Tocados'], 'LR', 0, $this->align[7], true); $this->Cell($this->pos[8], 6, $row['Rehuses'], 'LR', 0, $this->align[8], true); $this->Cell($this->pos[9], 6, $tiempo, 'LR', 0, $this->align[9], true); $this->Cell($this->pos[10], 6, $veloc, 'LR', 0, $this->align[10], true); $this->Cell($this->pos[11], 6, $penal, 'LR', 0, $this->align[11], true); $this->Cell($this->pos[12], 6, $row['Calificacion'], 'LR', 0, $this->align[12], true); $this->SetFont($this->getFontName(), 'B', 11); // bold 11px $this->Cell($this->pos[13], 6, $puesto, 'LR', 0, $this->align[13], true); $this->Ln(); $rowcount++; } // Línea de cierre $this->Cell(array_sum($this->pos), 0, '', 'T'); $this->myLogger->leave(); }
function writeCell($idx, $row) { $wide = $this->federation->get('WideLicense'); // use extra space for wide license id // REMINDER: $this->cell( width, height, data, borders, where, align, fill) $offset = $this->PageNo() == 1 ? 80 : 55; $this->SetXY(10, $offset + 6 * $idx); // first page has 3 extra header lines $fill = $idx % 2 != 0 ? true : false; // fomateamos datos $puesto = $row['Penalizacion'] >= 200 ? "-" : "{$row['Puesto']}º"; $penal = number_format($row['Penalizacion'], $this->timeResolution); $tiempo = number_format($row['Tiempo'], $this->timeResolution); $v1 = $row['P1'] >= 200 ? "-" : number_format($row['V1'], 1); $t1 = $row['P1'] >= 200 ? "-" : number_format($row['T1'], $this->timeResolution); $p1 = number_format($row['P1'], $this->timeResolution); $v2 = $row['P2'] >= 200 ? "-" : number_format($row['V2'], 1); $t2 = $row['P2'] >= 200 ? "-" : number_format($row['T2'], $this->timeResolution); $p2 = number_format($row['P2'], $this->timeResolution); // REMINDER: $this->cell( width, height, data, borders, where, align, fill) $this->SetFont($this->getFontName(), '', 8); // default font // datos del participante $this->Cell(10, 6, $row['Dorsal'], 0, 0, 'L', $fill); // dorsal $this->SetFont($this->getFontName(), 'B', 8); // Display Nombre in bold typeface $this->Cell($wide ? 20 : 25, 6, $row['Nombre'], 0, 0, 'L', $fill); // nombre (20,y $this->SetFont($this->getFontName(), '', $wide ? 6 : 8); // default font $this->Cell($wide ? 30 : 15, 6, $row['Licencia'], 0, 0, 'C', $fill); // licencia $this->SetFont($this->getFontName(), '', 8); // default font if (Jornadas::hasGrades($this->jornada)) { $this->Cell(10, 6, "{$row['Categoria']} {$row['Grado']}", 0, 0, 'C', $fill); // categoria/grado } else { $this->Cell(10, 6, "{$row['Categoria']}", 0, 0, 'C', $fill); // categoria/grado } $this->Cell($wide ? 30 : 35, 6, $row['NombreGuia'], 0, 0, 'R', $fill); // nombreGuia $this->Cell($wide ? 15 : 20, 6, $row['NombreClub'], 0, 0, 'R', $fill); // nombreClub // manga 1 $this->Cell(7, 6, $row['F1'], 0, 0, 'C', $fill); // 1- Faltas+Tocados $this->Cell(7, 6, $row['R1'], 0, 0, 'C', $fill); // 1- Rehuses $this->Cell(12, 6, $t1, 0, 0, 'C', $fill); // 1- Tiempo $this->Cell(9, 6, $v1, 0, 0, 'C', $fill); // 1- Velocidad $this->Cell(12, 6, $p1, 0, 0, 'C', $fill); // 1- Penalizacion $this->Cell(10, 6, $row['C1'], 0, 0, 'C', $fill); // 1- calificacion // manga 2 if ($this->manga2 != null) { $this->Cell(7, 6, $row['F2'], 0, 0, 'C', $fill); // 2- Faltas+Tocados $this->Cell(7, 6, $row['R2'], 0, 0, 'C', $fill); // 2- Rehuses $this->Cell(12, 6, $t2, 0, 0, 'C', $fill); // 2- Tiempo $this->Cell(9, 6, $v2, 0, 0, 'C', $fill); // 2- Velocidad $this->Cell(12, 6, $p2, 0, 0, 'C', $fill); // 2- Penalizacion $this->Cell(10, 6, $row['C2'], 0, 0, 'C', $fill); // 2- calificacion } else { $this->Cell(57, 6, '', 0, 0, 'C', $fill); // espacio en blanco } // global $this->Cell(12, 6, $tiempo, 0, 0, 'C', $fill); // Tiempo $this->Cell(12, 6, $penal, 0, 0, 'C', $fill); // Penalizacion $this->Cell(14, 6, $row['Calificacion'], 0, 0, 'C', $fill); // Calificacion $this->SetFont($this->getFontName(), 'B', 10); // default font $this->Cell(8, 6, $puesto, 0, 0, 'C', $fill); // Puesto // lineas rojas $this->ac_SetDrawColor($this->config->getEnv('pdf_linecolor')); $this->Line(10, $offset + 6 * $idx, 10, $offset + 6 * ($idx + 1)); $this->Line(10 + 115, $offset + 6 * $idx, 10 + 115, $offset + 6 * ($idx + 1)); $this->Line(10 + 172, $offset + 6 * $idx, 10 + 172, $offset + 6 * ($idx + 1)); $this->Line(10 + 229, $offset + 6 * $idx, 10 + 229, $offset + 6 * ($idx + 1)); $this->Line(10 + 275, $offset + 6 * $idx, 10 + 275, $offset + 6 * ($idx + 1)); $this->Ln(); }
/** * Constructor * @param {integer} $prueba Prueba ID * @param {array} $inscritos Lista de inscritos en formato jquery array[count,rows[]] * @throws Exception */ function __construct($prueba, $inscritos, $jornadas, $jornadaid) { parent::__construct('Portrait', 'print_inscritosByJornada', $prueba, 0); if ($prueba == 0 || $inscritos === null) { $this->errormsg = "printInscritosByPrueba: either prueba or inscription data are invalid"; throw new Exception($this->errormsg); } usort($inscritos['rows'], function ($a, $b) { return $a['Dorsal'] > $b['Dorsal'] ? 1 : -1; }); $this->inscritos = $inscritos['rows']; $this->jornadas = $jornadas['rows']; $this->setPageName("inscritosByJornada.pdf"); $this->cellHeader = array(_('Dorsal'), _('Name'), _('Lic'), _('Handler'), $this->strClub, _('Cat'), _('Grado'), _('Heat'), _('Comments')); $this->JName = ""; foreach ($jornadas['rows'] as $j) { if ($j['ID'] == $jornadaid) { $this->jornada = $j; $this->JName = "J{$j['Numero']}"; // remove "Grade" from cell array if jornada is open/team/KO if (!Jornadas::hasGrades($j)) { $this->pos[5] = 16; // increase category size $this->pos[6] = 0; // set grade size to zero } break; } } if ($this->JName === "") { $this->errormsg = "printInscritosByJornada: Invalid Jornada ID:{$jornadaid} for provided prueba"; throw new Exception($this->errormsg); } }
function writeCell($idx, $row) { // REMINDER: $this->cell( width, height, data, borders, where, align, fill) $y = $this->getY(); $this->SetX(10); // first page has 3 extra header lines $this->ac_row($idx, 9); // fomateamos datos $puesto = $row['Penalizacion'] >= 200 ? "-" : "{$row['Puesto']}º"; $penal = number_format($row['Penalizacion'], $this->timeResolution); $tiempo = number_format($row['Tiempo'], $this->timeResolution); $v1 = $row['P1'] >= 200 ? "-" : number_format($row['V1'], 1); $t1 = $row['P1'] >= 200 ? "-" : number_format($row['T1'], $this->timeResolution); $p1 = number_format($row['P1'], $this->timeResolution); $v2 = $row['P2'] >= 200 ? "-" : number_format($row['V2'], 1); $t2 = $row['P2'] >= 200 ? "-" : number_format($row['T2'], $this->timeResolution); $p2 = number_format($row['P2'], $this->timeResolution); // REMINDER: $this->cell( width, height, data, borders, where, align, fill) // datos del participante $this->Cell(10, 6, $row['Dorsal'], 0, 0, 'R', true); // dorsal $this->SetFont($this->getFontName(), 'B', 9); // bold font $this->Cell(25, 6, $row['Nombre'], 0, 0, 'L', true); // nombre (20,y $this->SetFont($this->getFontName(), '', 9); // default font $this->Cell(15, 6, $row['Licencia'], 0, 0, 'C', true); // licencia if (Jornadas::hasGrades($this->jornada)) { $this->Cell(10, 6, "{$row['Categoria']} {$row['Grado']}", 0, 0, 'C', true); // categoria/grado } else { $this->Cell(10, 6, "{$row['Categoria']}", 0, 0, 'C', true); // solo categoria (Open/Teams/KO) } $this->Cell(35, 6, $row['NombreGuia'], 0, 0, 'R', true); // nombreGuia $this->Cell(20, 6, $row['NombreClub'], 0, 0, 'R', true); // nombreClub // manga 1 $this->Cell(7, 6, $row['F1'], 0, 0, 'C', true); // 1- Faltas+Tocados $this->Cell(7, 6, $row['R1'], 0, 0, 'C', true); // 1- Rehuses $this->Cell(12, 6, $t1, 0, 0, 'C', true); // 1- Tiempo $this->Cell(9, 6, $v1, 0, 0, 'C', true); // 1- Velocidad $this->Cell(12, 6, $p1, 0, 0, 'C', true); // 1- Penalizacion $this->Cell(12, 6, $row['C1'], 0, 0, 'C', true); // 1- calificacion // manga 2 if ($this->manga2 != null) { $this->Cell(7, 6, $row['F2'], 0, 0, 'C', true); // 2- Faltas+Tocados $this->Cell(7, 6, $row['R2'], 0, 0, 'C', true); // 2- Rehuses $this->Cell(12, 6, $t2, 0, 0, 'C', true); // 2- Tiempo $this->Cell(9, 6, $v2, 0, 0, 'C', true); // 2- Velocidad $this->Cell(12, 6, $p2, 0, 0, 'C', true); // 2- Penalizacion $this->Cell(12, 6, $row['C2'], 0, 0, 'C', true); // 2- calificacion } else { $this->Cell(59, 6, '', 0, 0, 'C', true); // espacio en blanco } // global $this->Cell(12, 6, $tiempo, 0, 0, 'C', true); // Tiempo $this->Cell(12, 6, $penal, 0, 0, 'C', true); // Penalizacion $this->Cell(10, 6, $row['Calificacion'], 0, 0, 'C', true); // Calificacion $this->SetFont($this->getFontName(), 'B', 9); // default font $this->Cell(8, 6, $puesto, 0, 0, 'R', true); // Puesto $this->SetFont($this->getFontName(), '', 9); // default font // lineas rojas $this->ac_SetDrawColor($this->config->getEnv('pdf_linecolor')); $this->Line(10, $y, 10, $y + 6); $this->Line(10 + 115, $y, 10 + 115, $y + 6); $this->Line(10 + 174, $y, 10 + 174, $y + 6); $this->Line(10 + 233, $y, 10 + 233, $y + 6); $this->Line(10 + 275, $y, 10 + 275, $y + 6); $this->Ln(6); }