wip watten
This commit is contained in:
1 parent
8ace316cbf
commit
afc8a6e1f5
93 files changed
+14369
-1
No files matched your search
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Watten\Hooks;
|
||||
|
||||
/**
|
||||
* This file is part of the "news" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*/
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility as BackendUtilityCore;
|
||||
use TYPO3\CMS\Core\SingletonInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Session\SessionManager;
|
||||
|
||||
/**
|
||||
* Hook into tcemain which is used to show preview of news item
|
||||
*/
|
||||
class DataHandler implements SingletonInterface
|
||||
{
|
||||
/**
|
||||
* Prevent saving of a news record if the editor doesn't have access to all categories of the news record
|
||||
*
|
||||
* @param array $fieldArray
|
||||
* @param string $table
|
||||
* @param int $id
|
||||
* @param $parentObject \TYPO3\CMS\Core\DataHandling\DataHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function processDatamap_preProcessFieldArray(&$fieldArray, $table, $id, $parentObject): void
|
||||
{
|
||||
if ($table === 'tx_watten_domain_model_ergebnisse') {
|
||||
|
||||
// print_r($fieldArray);
|
||||
// print_r($table);
|
||||
// print_r($id);
|
||||
|
||||
$tmp = [];
|
||||
$tmp[] = $fieldArray['s1'];
|
||||
$tmp[] = $fieldArray['s2'];
|
||||
$tmp[] = $fieldArray['v1'];
|
||||
$tmp[] = $fieldArray['v2'];
|
||||
$tmp = array_unique($tmp);
|
||||
if (\array_sum($tmp) < 4) {
|
||||
$parentObject->log(
|
||||
$table,
|
||||
$id,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
"Sichern des Eintrags misslang. Grund: Athleten müssen vollständig ausgefüllt werden.",
|
||||
1,
|
||||
[$table]
|
||||
);
|
||||
// unset table to prevent saving
|
||||
$table = '';
|
||||
} elseif (\count($tmp) != 4) {
|
||||
$parentObject->log(
|
||||
$table,
|
||||
$id,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
"Sichern des Eintrags misslang. Grund: Athleten dürfen nicht doppelt vorkommen.",
|
||||
1,
|
||||
[$table]
|
||||
);
|
||||
// unset table to prevent saving
|
||||
$table = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user