200 lines
5.8 KiB
PHP
200 lines
5.8 KiB
PHP
<?php
|
|
|
|
namespace HermannTelser\Zuladungsliste\User;
|
|
|
|
use HermannTelser\Zuladungsliste\Utilities\Message;
|
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
|
|
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 UserKonto
|
|
{
|
|
|
|
public static function sichern(){
|
|
$user = $GLOBALS['TSFE']->fe_user->user;
|
|
$data = GeneralUtility::_GP('data');
|
|
$data = json_decode($data, true);
|
|
|
|
$update_array = [];
|
|
foreach ($data as $key => $value)
|
|
{
|
|
switch ($value["fieldname"]) {
|
|
case "address":
|
|
$update_array["address"] = $value["value"];
|
|
break;
|
|
case "zip":
|
|
$update_array["zip"] = $value["value"];
|
|
break;
|
|
case "city":
|
|
$update_array["city"] = $value["value"];
|
|
break;
|
|
case "title":
|
|
$update_array["title"] = $value["value"];
|
|
break;
|
|
case "first_name":
|
|
$update_array["first_name"] = $value["value"];
|
|
break;
|
|
case "last_name":
|
|
$update_array["last_name"] = $value["value"];
|
|
break;
|
|
case "telephone":
|
|
$update_array["telephone"] = $value["value"];
|
|
break;
|
|
}
|
|
}
|
|
|
|
$user = $GLOBALS['TSFE']->fe_user->user;
|
|
|
|
if(\count($update_array) == 7){
|
|
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('fe_users');
|
|
$queryBuilder->update('fe_users')
|
|
->where($queryBuilder->expr()->eq('uid', (int) $user['uid']))
|
|
->set('address', (string) $update_array['address'])
|
|
->set('zip', (string) $update_array['zip'])
|
|
->set('city', (string) $update_array['city'])
|
|
->set('title', (string) $update_array['title'])
|
|
->set('first_name', (string) $update_array['first_name'])
|
|
->set('last_name', (string) $update_array['last_name'])
|
|
->set('telephone', (string) $update_array['telephone'])
|
|
->execute();
|
|
}
|
|
// echo $queryBuilder->getSQL();
|
|
|
|
echo 1;
|
|
exit;
|
|
}
|
|
|
|
public static function laden()
|
|
{
|
|
$user = $GLOBALS['TSFE']->fe_user->user;
|
|
|
|
$return = [];
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 0;
|
|
$tmp['editable'] = 0;
|
|
$tmp['title'] = 1;
|
|
$tmp['beschreibung'] = "Architektur";
|
|
$tmp['value'] = 'Büro';
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 1;
|
|
$tmp['editable'] = 0;
|
|
$tmp['fieldname'] = 'company';
|
|
$tmp['beschreibung'] = "Büroname:";
|
|
$tmp['value'] = $user['company'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 2;
|
|
$tmp['editable'] = 0;
|
|
$tmp['fieldname'] = 'email';
|
|
$tmp['beschreibung'] = "E-Mail:";
|
|
$tmp['value'] = $user['email'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 3;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'address';
|
|
$tmp['beschreibung'] = "Büroanschrift:";
|
|
$tmp['value'] = $user['address'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 4;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'zip';
|
|
$tmp['beschreibung'] = "PLZ:";
|
|
$tmp['value'] = $user['zip'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 5;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'city';
|
|
$tmp['beschreibung'] = "Ort:";
|
|
$tmp['value'] = $user['city'];
|
|
$return[] = $tmp;
|
|
|
|
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 6;
|
|
$tmp['editable'] = 0;
|
|
$tmp['title'] = 1;
|
|
$tmp['beschreibung'] = "Verantwortliche";
|
|
$tmp['value'] = 'Person';
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 7;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'title';
|
|
$tmp['beschreibung'] = "Titel:";
|
|
$tmp['value'] = $user['title'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 8;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'first_name';
|
|
$tmp['beschreibung'] = "Vorname:";
|
|
$tmp['value'] = $user['first_name'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 9;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'last_name';
|
|
$tmp['beschreibung'] = "Nachname:";
|
|
$tmp['value'] = $user['last_name'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 10;
|
|
$tmp['editable'] = 0;
|
|
$tmp['fieldname'] = 'vereidigung';
|
|
$tmp['beschreibung'] = "Tag der Vereidigung:";
|
|
$tmp['value'] = $user['vereidigung'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 11;
|
|
$tmp['editable'] = 0;
|
|
$tmp['fieldname'] = 'kammermitgliedsnummer';
|
|
$tmp['beschreibung'] = "Mitgliedsnummer:";
|
|
$tmp['value'] = $user['kammermitgliedsnummer'];
|
|
$return[] = $tmp;
|
|
|
|
$tmp = [];
|
|
$tmp['id'] = 12;
|
|
$tmp['editable'] = 1;
|
|
$tmp['fieldname'] = 'telephone';
|
|
$tmp['beschreibung'] = "Telefon:";
|
|
$tmp['value'] = $user['telephone'];
|
|
$return[] = $tmp;
|
|
|
|
$return = json_encode($return);
|
|
header('Content-Type: application/json');
|
|
echo $return;
|
|
exit();
|
|
}
|
|
}
|