first commit
This commit is contained in:
commit
e81864e683
2984 files changed
+267797
No files matched your search
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Zuladungsliste\Upload;
|
||||
|
||||
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;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
|
||||
/***
|
||||
*
|
||||
* 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 Upload
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function einreichen()
|
||||
{
|
||||
/*** UPLOAD FILE start ***/
|
||||
$user = $GLOBALS['TSFE']->fe_user->user;
|
||||
$user_id = $user['uid'];
|
||||
$upload_dir = Environment::getPublicPath() . "/uploads/tx_zuladungsliste/$user_id";
|
||||
if (!is_dir($upload_dir)) {
|
||||
GeneralUtility::mkdir($upload_dir);
|
||||
}
|
||||
$insert_array = [];
|
||||
$insert_array['dokument_orig_name'] = "";
|
||||
$insert_array['dokument_size'] = "";
|
||||
$insert_array['dokument_type'] = "";
|
||||
if (isset($_FILES['uploadedfile'])) {
|
||||
$dokument_size = $_FILES['uploadedfile']['size'];
|
||||
$dokument_orig_name = $_FILES['uploadedfile']['name'];
|
||||
$dokument_orig_type = $_FILES['uploadedfile']['type'];
|
||||
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $upload_dir . '/' . $dokument_orig_name);
|
||||
}
|
||||
foreach ($_POST as $nm => $val) {
|
||||
$postdata[$nm] = $val; // array for html
|
||||
}
|
||||
$data = ["Bitte Wählen","Burgenland","Kärnten","Niederösterreich","Oberösterreich","Salzburg","Steiermark","Tirol","Vorarlberg","Wien"];
|
||||
$insert_array = [];
|
||||
$insert_array['crdate'] = time();
|
||||
$insert_array['tstamp'] = time();
|
||||
$insert_array['cruser_id'] = $user_id;
|
||||
$insert_array['wettbewerb'] = htmlspecialchars($postdata['formwettbewerb']);
|
||||
$insert_array['beschreibung'] = htmlspecialchars($postdata["formbeschreibung"]);
|
||||
$insert_array['entscheidungstermin'] = htmlspecialchars($postdata["formentscheidungstermin"]);
|
||||
$insert_array['verfahrensort'] = htmlspecialchars($postdata["formverfahrensort"]);
|
||||
$insert_array['bundesland'] = $data[$postdata["formbundesland"]];
|
||||
$insert_array['dokument_orig_name'] = $dokument_orig_name;
|
||||
$insert_array['dokument_size'] = round($dokument_size/1024, 2) . "k";
|
||||
$insert_array['dokument_type'] = "pdf";
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_zuladungsliste_domain_model_wettbewerbe_einreichungen');
|
||||
$queryBuilder
|
||||
->insert('tx_zuladungsliste_domain_model_wettbewerbe_einreichungen')
|
||||
->values($insert_array)
|
||||
->execute();
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function aktualisieren()
|
||||
{
|
||||
/*** UPLOAD FILE start ***/
|
||||
$uid = GeneralUtility::_GP("uid");
|
||||
if (!is_numeric($uid)) {
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = $GLOBALS['TSFE']->fe_user->user;
|
||||
$user_id = $user['uid'];
|
||||
$upload_dir = Environment::getPublicPath() . "/uploads/tx_zuladungsliste/$user_id";
|
||||
if (!is_dir($upload_dir)) {
|
||||
GeneralUtility::mkdir($upload_dir);
|
||||
}
|
||||
if (isset($_FILES['uploadedfile'])) {
|
||||
$dokument_size = $_FILES['uploadedfile']['size'];
|
||||
$dokument_orig_name = $_FILES['uploadedfile']['name'];
|
||||
$dokument_orig_type = $_FILES['uploadedfile']['type'];
|
||||
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $upload_dir . '/' . $dokument_orig_name);
|
||||
}
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_zuladungsliste_domain_model_wettbewerbe_einreichungen');
|
||||
$queryBuilder
|
||||
->update('tx_zuladungsliste_domain_model_wettbewerbe_einreichungen')
|
||||
->where(
|
||||
$queryBuilder->expr()->eq('uid', (int) $uid)
|
||||
)
|
||||
->set('tstamp', time())
|
||||
->set('dokument_orig_name', (string) $dokument_orig_name)
|
||||
->set('dokument_size', (string) round($dokument_size/1024, 2) . "k")
|
||||
->execute();
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user