Пример #1
0
 private function writeTableHeader()
 {
     // internationalize header texts
     for ($n = 0; $n < count($this->cols); $n++) {
         $this->cols[$n] = _utf($this->cols[$n]);
     }
     // send to excel
     $this->myWriter->addRowWithStyle($this->cols, $this->rowHeaderStyle);
 }
Пример #2
0
 function composeTable()
 {
     $this->myLogger->enter();
     $this->createInfoPage(_utf('Scores'), $this->prueba['RSCE']);
     $this->createPruebaInfoPage($this->prueba, $this->jornadas);
     $insc = new Inscripciones("excel_Clasificaciones", $this->prueba['ID']);
     // iterate on every valid journeys
     foreach ($this->jornadas as $jornada) {
         if ($jornada['Nombre'] === '-- Sin asignar --') {
             continue;
         }
         // skip empty journeys
         // create info page for this journey
         $this->createJornadaInfoPage($jornada, $insc);
         // Create data page for this journey
         $this->createJornadaDataPage($jornada, $insc);
     }
     $this->myLogger->leave();
 }
Пример #3
0
 private function validateHeader($header)
 {
     $this->saveStatus("Validating header...");
     // search required fields in header and store index when found
     foreach ($this->fieldList as $field => &$data) {
         for ($index = 0; $index < count($header); $index++) {
             $fieldName = $header[$index];
             if ($fieldName == $field || $fieldName == _utf($field)) {
                 $data[0] = $index;
             }
         }
     }
     // now check for required but not declared fields
     foreach ($this->fieldList as $key => $val) {
         if ($val[0] < 0 && $val[1] > 0) {
             throw new Exception("ExcelImport(dogs)::required field '{$key}' => " . json_encode($val) . " not found in Excel header");
         }
     }
     return 0;
 }
Пример #4
0
 /**
  * Anyade una pagina con informacion de la prueba y de las jornadas
  * @param $prueba
  * @param $jornadas
  */
 function createPruebaInfoPage($prueba, $jornadas)
 {
     // Create page
     $ppage = $this->myWriter->addNewSheetAndMakeItCurrent();
     $name = $this->normalizeSheetName($prueba['Nombre']);
     $ppage->setName($name);
     // cabecera de la tabla
     $prbHdr = array("", _utf('Name'), _utf('Club'), _utf('Federation'), _utf('Selective'), _utf('Comments'));
     $this->myWriter->addRowWithStyle($prbHdr, $this->rowHeaderStyle);
     // componemos informacion de la prueba
     $row = array();
     $row[] = _utf('Contest') . ':';
     $row[] = $prueba['Nombre'];
     // extract club info
     $clbObj = new Clubes("common_writer");
     $club = $clbObj->selectByID($prueba['Club']);
     $row[] = $club['Nombre'];
     // extract federation info
     $row[] = $this->federation->get('Name');
     // add extra parameters
     $row[] = $prueba['Selectiva'];
     $row[] = $prueba['Observaciones'];
     // and print Prueba data
     $this->myWriter->addRow($row);
     // anyadimos ahora informacion de las jornadas
     $this->myWriter->addRow(array(""));
     $jrdHdr = array("", _utf('Name'), _utf('Date'), _utf('Hour'), _utf('Closed'), "");
     $this->myWriter->addRowWithStyle($jrdHdr, $this->rowHeaderStyle);
     foreach ($jornadas as $jornada) {
         if ($jornada['Nombre'] === '-- Sin asignar --') {
             continue;
         }
         // skip empty journeys
         $row = array();
         $row[] = _utf('Journey') . ": " . $jornada['Numero'];
         $row[] = $jornada['Nombre'];
         $row[] = $jornada['Fecha'];
         $row[] = $jornada['Hora'];
         $row[] = $jornada['Cerrada'];
         if ($jornada['Observaciones'] != null && $jornada['Observaciones'] !== "(sin especificar)") {
             $row[] = $jornada['Observaciones'];
             // add name for special rounds
         }
         $this->myWriter->addRow($row);
     }
 }