first commit
This commit is contained in:
commit
e81864e683
2984 files changed
+267797
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Zuladungsliste\Download;
|
||||
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
|
||||
class PdfEinreichung
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
|
||||
$pdfname = GeneralUtility::_GP("pdf");
|
||||
$userid = GeneralUtility::_GP("userid");
|
||||
$file = Environment::getPublicPath() . "/uploads/tx_zuladungsliste/" . $userid . "/" . $pdfname;
|
||||
|
||||
echo $file;
|
||||
|
||||
if(file_exists($file)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename='.basename($file));
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
ob_clean();
|
||||
flush();
|
||||
readfile($file);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Zuladungsliste\Download;
|
||||
|
||||
use HermannTelser\Zuladungsliste\Berechnung\_Berechnung;
|
||||
use HermannTelser\Zuladungsliste\Berechnung\Sektionstage;
|
||||
use HermannTelser\Zuladungsliste\Liste\ListeTree;
|
||||
use Mpdf;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class PdfListe
|
||||
{
|
||||
public static $Mpdf;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
$berechnene = new _Berechnung();
|
||||
Sektionstage::load();
|
||||
|
||||
$pdf_archive_id = GeneralUtility::_GP('pdf_archive_id');
|
||||
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('zuladungsliste');
|
||||
|
||||
if ($pdf_archive_id) {
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_zuladungsliste_archive_admin');
|
||||
$statement = $queryBuilder
|
||||
->select('liste', 'crdate')
|
||||
->from('tx_zuladungsliste_archive_admin')
|
||||
->where(
|
||||
$queryBuilder->expr()->eq('uid', (int) $pdf_archive_id)
|
||||
)
|
||||
->execute()->fetchAll();
|
||||
$_liste = json_decode($statement[0]['liste'], true);
|
||||
$timestamp = $statement[0]['crdate'];
|
||||
$timestamp_formattet = (strftime('%A %d. %B %Y', $statement[0]['crdate']));
|
||||
$timestamp_titel = (strftime('%d. %b. %Y', $statement[0]['crdate']));
|
||||
} else {
|
||||
$berechnene::berechnen();
|
||||
ListeTree::set_dijit();
|
||||
$_liste = $berechnene::$_return;
|
||||
$timestamp = time();
|
||||
$timestamp_formattet = strftime('%A %d. %B %Y', time());
|
||||
$timestamp_titel = strftime('%d. %b. %Y', time());
|
||||
}
|
||||
|
||||
self::$Mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 7,
|
||||
'margin_right' => 7,
|
||||
'margin_top' => 12,
|
||||
'margin_bottom' => 12,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
]);
|
||||
self::$Mpdf->SetTitle("ZL vom " . $timestamp_titel);
|
||||
$stylesheet = file_get_contents($extPath.'Classes/Download/style.css');
|
||||
self::$Mpdf->WriteHTML($stylesheet, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
|
||||
// logo
|
||||
$html = '<div>';
|
||||
$image = $extPath.'Resources/Public/Images/ztkammer-logo.png';
|
||||
$html .= '<img src="'.$image.'" style="width:60mm; height:auto">';
|
||||
|
||||
// header
|
||||
$html .= '<div class="liste-titel">Zuladungsliste Wettbewerbe Steiermark</div>';
|
||||
|
||||
// sub header
|
||||
$sektionstag = Sektionstage::filter($timestamp);
|
||||
$html .= '<p>Stand '.$timestamp_formattet.', auf Basis des Sektionstages vom '.$sektionstag['stichtag'].', '.$sektionstag['bezeichnung'].'</p>';
|
||||
|
||||
// tabelle
|
||||
$html .= '<table class="pure-table pure-table-striped liste">';
|
||||
$html .= '<tr><th>Rang</th><th>Pos</th><th>Büro</th><th>Punkte</th><th>Sperrung bis</th><tr>';
|
||||
foreach ($_liste as $key => $value) {
|
||||
if (isset($value['user_id'])) {
|
||||
if (0 == $value['pos']) {
|
||||
$value['pos'] = '';
|
||||
$color = "rot";
|
||||
} else {
|
||||
$value['gesperrt_bis'] = 'Frei';
|
||||
$color = "gruen";
|
||||
}
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= "<td class=\"center\">".$value['rang'].'</td>';
|
||||
$html .= "<td class=\"center \">".$value['pos'].'</td>';
|
||||
$html .= "<td>".$value['company'].'</td>';
|
||||
$html .= "<td class=\"center\">".number_format($value['punkte'], 2).'</td>';
|
||||
$html .= "<td class=\"center $color\">".$value['gesperrt_bis'].'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
}
|
||||
$html .= '</table>';
|
||||
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
self::$Mpdf->Output('Standard.pdf', Mpdf\Output\Destination::INLINE);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Zuladungsliste\Download;
|
||||
|
||||
use HermannTelser\Zuladungsliste\Utilities\Message;
|
||||
use HermannTelser\Zuladungsliste\Berechnung\_Berechnung;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "Zuladungsliste Steiermark" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2017 - 2022 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
* All rights reserved
|
||||
* ************************************************************* */
|
||||
|
||||
|
||||
class _DownloadController
|
||||
{
|
||||
public function __construct($xaction)
|
||||
{
|
||||
switch ($xaction) {
|
||||
case 'download_pdf':
|
||||
PdfListe::download();
|
||||
break;
|
||||
case 'download_einreichung':
|
||||
PdfEinreichung::download();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 0.9em;
|
||||
line-height: 1.1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.liste-titel {
|
||||
font-family: sans-serif;
|
||||
padding: 15mm 0 0;
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 1em auto;
|
||||
}
|
||||
|
||||
.rot {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.filter {
|
||||
background-color: #eee;
|
||||
border: 1px solid #cbcbcb;
|
||||
padding: 0.5rem 1rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
/* PURE TABLES START */
|
||||
.pure-table {
|
||||
/* Remove spacing between table cells (from Normalize.css) */
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
border: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table td,
|
||||
.pure-table th,
|
||||
.pure-table-noborder td,
|
||||
.pure-table-noborder th {
|
||||
border-left: 1px solid #cbcbcb;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
/* inner column border */
|
||||
border-width: 0 0 1px 1px;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
/*to make ths where the title is really long work*/
|
||||
padding: .7em 1em;
|
||||
/* cell padding */
|
||||
}
|
||||
|
||||
.pure-table td {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.pure-table-odd td {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
/* nth-child selector for modern browsers */
|
||||
.pure-table-striped tr:nth-child(2n-1) td {
|
||||
background-color: #eee;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
/* BORDERED TABLES */
|
||||
.pure-table-bordered td {
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-bordered tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
/* HORIZONTAL BORDERED TABLES */
|
||||
.pure-table-horizontal td,
|
||||
.pure-table-horizontal th {
|
||||
border-width: 0 0 1px 0;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-horizontal tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 18pt;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.liste-titel {
|
||||
font-family: sans-serif;
|
||||
padding: 15mm 0 0;
|
||||
font-size: 1.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.liste {
|
||||
width: 100%;
|
||||
font-size: .9em;
|
||||
margin-top: 15mm;
|
||||
}
|
||||
|
||||
.rot {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
.gruen {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* PURE TABLES START */
|
||||
.pure-table {
|
||||
/* Remove spacing between table cells (from Normalize.css) */
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
border: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-noborder {
|
||||
/* Remove spacing between table cells (from Normalize.css) */
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
.pure-table caption {
|
||||
color: #000;
|
||||
font: italic 85%/1 arial, sans-serif;
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pure-table td,
|
||||
.pure-table th,
|
||||
.pure-table-noborder td,
|
||||
.pure-table-noborder th {
|
||||
border-left: 1px solid #cbcbcb;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
/* inner column border */
|
||||
border-width: 0 0 1px 1px;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
/*to make ths where the title is really long work*/
|
||||
padding: .7em 1em;
|
||||
/* cell padding */
|
||||
}
|
||||
|
||||
.pure-table thead {
|
||||
background-color: #e0e0e0;
|
||||
color: #000;
|
||||
text-align: left;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/*
|
||||
striping:
|
||||
even - #fff (white)
|
||||
odd - #f2f2f2 (light gray)
|
||||
*/
|
||||
.pure-table td {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.pure-table-odd td {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* nth-child selector for modern browsers */
|
||||
.pure-table-striped tr:nth-child(2n-1) td {
|
||||
background-color: #f2f2f2;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
/* BORDERED TABLES */
|
||||
.pure-table-bordered td {
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-bordered tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
/* HORIZONTAL BORDERED TABLES */
|
||||
.pure-table-horizontal td,
|
||||
.pure-table-horizontal th {
|
||||
border-width: 0 0 1px 0;
|
||||
border-bottom: 1px solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-horizontal tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
Reference in new issue
Block a user