Files
gutachten_t3/packages/gutachten/Classes/DB/Select/ProjekteSetActive.php
T

45 lines
1.0 KiB
PHP

<?php
namespace HermannTelser\Gutachten\DB\Select;
use HermannTelser\Gutachten\DB\DbFunction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/***
*
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
*
***/
class ProjekteSetActive
{
public static function set()
{
$projectid = GeneralUtility::_GP('id');
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
$has = DbFunction::has('tx_gutachten_freigabe', ['AND' => ['userid' => $userid, 'projektid' => $projectid]]);
if (!$has) {
$value_array = [];
$value_array['userid'] = $userid;
$value_array['projektid'] = $projectid;
DbFunction::secureInsert('tx_gutachten_freigabe', $value_array);
echo 1;
} else {
$active = DbFunction::delete('tx_gutachten_freigabe', ['AND' => ['userid' => $userid, 'projektid' => $projectid]]);
echo 0;
}
exit;
}
}