public function ZoekTijd() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); require_once "/Classes/calculatetime.php"; $calculatetime = new calculatetime(); $Database->query('SELECT fileName, name FROM wedstrijden WHERE name=?'); $Database->bind(1, $_GET['wedstrijd']); $resultSet = $Database->single(); if (isset($_GET['startnummer']) || isset($_GET['naam'])) { include 'Classes/PHPExcel/IOFactory.php'; $inputFileName = 'excel/' . $resultSet['fileName']; try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) { die('Er is een fout opgetreden met bestand "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); for ($row = 1; $row <= $highestRow; $row++) { $rowData[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE)[0]; } if (isset($_GET['startnummer']) && $_GET['startnummer'] == !null) { $Startnummer = $_GET['startnummer']; $key = array_search($Startnummer, array_column($rowData, 0)); } if (isset($_GET['naam']) && $_GET['naam'] == !null) { $Naam = $_GET['naam']; $key = array_search($Naam, array_column($rowData, 1)); } $this->Startnummer = $rowData[$key][0]; $this->Naam = $rowData[$key][1]; $this->Woonplaats = $rowData[$key][2]; $this->Geboortedatum = $rowData[$key][3]; $this->Geslacht = $rowData[$key][4]; $this->Wedstrijdnaam = $resultSet['name']; $cell = $sheet->getCellByColumnAndRow(5, $key + 1); $cell_value = PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'hh:mm:ss'); $this->VideoTijd = $calculatetime->GetPlayerTime($cell_value); $_GET['startnummer'] = $this->Startnummer; } }
public function ZoekTijd() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); require_once "/Classes/calculatetime.php"; $calculatetime = new calculatetime(); $Database->query('SELECT wedstrijdID, name FROM wedstrijden WHERE wedstrijdID=?'); $Database->bind(1, $_GET['eventid']); $wedstrijden = $Database->single(); $Database->query('SELECT camName, videoID FROM cams WHERE fk_wedstrijdID=?'); $Database->bind(1, $_GET['eventid']); $cams = $Database->single(); $Database->query('SELECT * FROM tijden WHERE fk_wedstrijdID=? AND Startnummer=?'); $Database->bind(1, $_GET['eventid']); $Database->bind(2, $_GET['startnummer']); $tijd = $Database->single(); if (isset($_GET['video'])) { $Database->query('SELECT camName, videoID, tijdName FROM cams WHERE camID=?'); $Database->bind(1, $_GET['video']); $cams = $Database->single(); $Database->query('SELECT * FROM tijden WHERE fk_wedstrijdID=? AND Startnummer=?'); $Database->bind(1, $_GET['eventid']); $Database->bind(2, $_GET['startnummer']); $tijd = $Database->single(); if (empty($tijd)) { header("Location: ?error&code=1"); die; } $this->Startnummer = $tijd['Startnummer']; $this->Naam = $tijd['Naam']; $this->Woonplaats = $tijd['Woonplaats']; $this->Geboortedatum = $tijd['Geboortedatum']; $this->Geslacht = $tijd['Geslacht']; $this->Wedstrijdnaam = $wedstrijden['name']; $this->VideoID = $cams['videoID']; $this->CamName = $cams['camName']; $this->VideoTijd = $calculatetime->GetPlayerTime($tijd[$cams['tijdName']]); $this->RenderPage(); } else { if (empty($tijd)) { header("Location: ?error&code=1"); die; } $this->Startnummer = $tijd['Startnummer']; $this->Naam = $tijd['Naam']; $this->Woonplaats = $tijd['Woonplaats']; $this->Geboortedatum = $tijd['Geboortedatum']; $this->Geslacht = $tijd['Geslacht']; $this->Wedstrijdnaam = $wedstrijden['name']; $this->VideoID = $cams['videoID']; $this->CamName = $cams['camName']; $this->VideoTijd = $calculatetime->GetPlayerTime($tijd['Finish']); $this->RenderPage(); } //7-11-2015 wijzigen van Excel naar database. }