141 lines
5.9 KiB
PHP
141 lines
5.9 KiB
PHP
<?php
|
|
|
|
namespace HermannTelser\Zuladungsliste\Zuteilungen;
|
|
|
|
use ForceUTF8\Encoding;
|
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
use HermannTelser\Zuladungsliste\Utilities\Message;
|
|
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
|
|
|
|
/***
|
|
*
|
|
* 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 Zuteilung
|
|
{
|
|
/**
|
|
* @return void
|
|
*/
|
|
public static function laden()
|
|
{
|
|
// load for prit zuteilungen
|
|
$zuteilung_uid = preg_replace("'\D'", "", $_GET['zuladungid']);
|
|
if (!is_numeric($zuteilung_uid)) {
|
|
exit;
|
|
}
|
|
|
|
// $arr = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows("a.uid id, a.tstamp, b.wettbewerb, a.anzahl_architekten",
|
|
// "tx_zuladungsliste_zuteilungen a, tx_zuladungsliste_domain_model_wettbewerbe b",
|
|
// "a.hidden=0 AND a.uid_wettbewerbe=b.uid AND a.uid=$zuteilung_uid");
|
|
|
|
|
|
$limitSelection=date('Y-m-d', strtotime('-1 year'));
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_zuladungsliste_zuteilungen');
|
|
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
|
|
$queryBuilder
|
|
->select('tx_zuladungsliste_zuteilungen.uid', 'tx_zuladungsliste_zuteilungen.tstamp', 'b.wettbewerb', 'tx_zuladungsliste_zuteilungen.anzahl_architekten')
|
|
->from('tx_zuladungsliste_zuteilungen')
|
|
->join(
|
|
'tx_zuladungsliste_zuteilungen',
|
|
'tx_zuladungsliste_domain_model_wettbewerbe',
|
|
'b',
|
|
$queryBuilder->expr()->eq('b.uid', $queryBuilder->quoteIdentifier('tx_zuladungsliste_zuteilungen.uid_wettbewerbe')),
|
|
)
|
|
->where($queryBuilder->expr()->eq('tx_zuladungsliste_zuteilungen.uid', $zuteilung_uid));
|
|
$statement = $queryBuilder->execute()->fetchAll();
|
|
|
|
// Message::note($queryBuilder->getSQL());
|
|
|
|
$$print = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
<title>Print Zuladungsliste</title></head><body>';
|
|
|
|
if (isset($_GET['print'])) {
|
|
$print .= '<image style="width:300px;" src="/typo3conf/ext/zuladungsliste/Resources/Public/Images/ztkammer-logo-adler.png"><br>';
|
|
} else {
|
|
$print .= '<div id="print_header"></div>';
|
|
}
|
|
$print .= '<br><br><h3 class="text-subheader center">'.$statement[0]["wettbewerb"].'<br> vom '.date("d. M. y", (int)$statement[0]["tstamp"]).'</h3>';
|
|
|
|
$limitSelection=date('Y-m-d', strtotime('-1 year'));
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_zuladungsliste_zuteilungen');
|
|
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
|
|
$queryBuilder
|
|
->select(
|
|
'tx_zuladungsliste_zuteilungen_user.uid',
|
|
'tx_zuladungsliste_zuteilungen_user.tstamp',
|
|
'tx_zuladungsliste_zuteilungen_user.position',
|
|
'tx_zuladungsliste_zuteilungen_user.ersatz',
|
|
'b.company',
|
|
'b.name'
|
|
)
|
|
->from('tx_zuladungsliste_zuteilungen_user')
|
|
->join(
|
|
'tx_zuladungsliste_zuteilungen_user',
|
|
'fe_users',
|
|
'b',
|
|
$queryBuilder->expr()->eq('b.uid', $queryBuilder->quoteIdentifier('tx_zuladungsliste_zuteilungen_user.user_id')),
|
|
)
|
|
->where($queryBuilder->expr()->eq('tx_zuladungsliste_zuteilungen_user.uid_zuteilungen_user', $zuteilung_uid))
|
|
->orderBy('ersatz')->addOrderBy('position');
|
|
|
|
// Message::note($queryBuilder->getSQL());
|
|
|
|
|
|
|
|
$statement = $queryBuilder->execute()->fetchAll();
|
|
|
|
$nomiert = '<h3 class="center">Nominierungen</h3>';
|
|
$nomiert .= '<table class="print_zladungen" width="95%" border="0" cellspacing="5" cellpadding="5">';
|
|
$ersatz = '<h3 class="center">Ersatz Nominierungen</h3>';
|
|
$ersatz .= '<table class="print_zladungen" width="95%" border="0" cellspacing="5" cellpadding="5">';
|
|
|
|
// if (count($statement)/2==$key) {
|
|
// $print .= '<tr><td> </td></tr>';
|
|
// }
|
|
|
|
foreach ($statement as $key => $value) {
|
|
$colorclass = $value["ersatz"] ? "ersatz" : "gewaehlt";
|
|
|
|
if ($value["ersatz"]) {
|
|
$ersatz .= '<tr>';
|
|
$ersatz .= '<td class="position '.$colorclass.'">'.$value["position"].'</td>';
|
|
$ersatz .= '<td class="company '.$colorclass.'">'.$value["company"].'</td>';
|
|
$ersatz .= '<td class="name '.$colorclass.'">'.$value["name"].'</td>';
|
|
$ersatz .= '<td class="'.$colorclass.'">Ersatz</td>';
|
|
$ersatz .= '</tr>';
|
|
} else {
|
|
$nomiert .= '<tr>';
|
|
$nomiert .= '<td class="position '.$colorclass.'">'.$value["position"].'</td>';
|
|
$nomiert .= '<td class="company '.$colorclass.'">'.$value["company"].'</td>';
|
|
$nomiert .= '<td class="name '.$colorclass.'">'.$value["name"].'</td>';
|
|
$nomiert .= '<td class="'.$colorclass.'">Ausgewählt</td>';
|
|
$nomiert .= '</tr>';
|
|
}
|
|
}
|
|
$nomiert .= '</table></div>';
|
|
$ersatz .= '</table></div>';
|
|
|
|
$print .= $nomiert;
|
|
$print .= $ersatz;
|
|
|
|
if (isset($_GET['print'])) {
|
|
$print .= '<script>this.focus(); this.print();</script>';
|
|
}
|
|
echo $print;
|
|
exit;
|
|
}
|
|
}
|