Compare commits

...

10 Commits

Author SHA1 Message Date
Torsten Schulz (local)
8ed62b86bc Set default template name in Renderer class and updated imprint.html with official registration and tax identification numbers. 2026-03-16 21:50:31 +01:00
Torsten Schulz
d73f287f7b Changed form creation 2024-04-17 08:34:25 +02:00
Torsten Schulz
7682671a79 Changed form creation 2024-04-17 08:22:48 +02:00
Torsten Schulz
c8475be001 Fixed DB writing 2024-04-17 08:13:31 +02:00
Torsten Schulz
6b27f094a2 added template to register page 2024-04-17 08:08:37 +02:00
Torsten Schulz
4dd6b9ffca fixed project management 2024-02-14 15:56:04 +01:00
Torsten Schulz
8cebbf17d2 extended bulkmail 2024-02-14 15:37:18 +01:00
Torsten Schulz
d37805a798 fixed from error 2023-12-29 08:37:14 +01:00
Torsten Schulz
32cf68e3ac fixed from error 2023-12-28 17:56:50 +01:00
Torsten Schulz
bc2eefd305 fixed from error 2023-12-28 17:48:43 +01:00
9 changed files with 57 additions and 26 deletions

View File

@@ -11,8 +11,8 @@
"mail": "", "mail": "",
"bulkmail": "Emailverteiler", "bulkmail": "Emailverteiler",
"logout": "", "logout": "",
"savemail": "Ideenboard", "savemail": "",
"planboard": "", "planboard": "Ideenboard",
"projectsmanagement": "Förderprojekte", "projectsmanagement": "Förderprojekte",
"memberlistdownload": "" "memberlistdownload": ""
} }

View File

@@ -8,8 +8,10 @@ class Bulkmail extends Renderer {
['label' => 'Signatur', 'type' => 'combobox', 'size' => 5, 'name' => 'signature', 'combine_with_next_line' => false, ['label' => 'Signatur', 'type' => 'combobox', 'size' => 5, 'name' => 'signature', 'combine_with_next_line' => false,
'values' => ['Persönliche Signatur', 'Vorstandssignatur'], 'values' => ['Persönliche Signatur', 'Vorstandssignatur'],
], ],
['label' => 'An normale Mitglieder', 'type' => 'checkbox', 'size' => 50, 'name' => 'custommembers', 'size' => 1, 'value' => 1, 'combine_with_next_line' => false],
['label' => 'An den Vorstand', 'type' => 'checkbox', 'size' => 50, 'name' => 'board', 'size' => 1, 'value' => 1, 'combine_with_next_line' => false],
]; ];
protected string $formSendButtonLabel = 'Email an alle aktiven Mitglieder absenden'; protected string $formSendButtonLabel = 'Email an ausgewählte Empfängergruppe senden';
protected function formAction(): void { protected function formAction(): void {
$this->sendEmail($this->generateSubject(), $this->generateBody(), $this->generateSignature(filter_input(INPUT_POST, 'signature'))); $this->sendEmail($this->generateSubject(), $this->generateBody(), $this->generateSignature(filter_input(INPUT_POST, 'signature')));
@@ -26,23 +28,32 @@ class Bulkmail extends Renderer {
protected function sendEmail(string $subject, string $body, string $signature): void { protected function sendEmail(string $subject, string $body, string $signature): void {
$mail = $this->initSmtpMailer();; $mail = $this->initSmtpMailer();;
$bccRecipients = $this->loadReceivers(); $bccRecipients = $this->loadReceivers();
$sendToCustomMembers = intval(filter_input(INPUT_POST, 'custommembers')) === 1;
$sendToBoard = intval(filter_input(INPUT_POST, 'board')) === 1;
$sendTo = [];
try { try {
$mail->setFrom('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule'); $mail->setFrom('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule');
$mail->addReplyTo('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule'); $mail->addReplyTo('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule');
$mail->addAddress('vorstand@fvajs.de', 'Vorstand des FVAJS'); $mail->addAddress('vorstand@fvajs.de', 'Vorstand des FVAJS');
foreach ($bccRecipients as $recipient) { foreach ($bccRecipients as $recipient) {
$mail->addBCC($recipient); if (($sendToCustomMembers && $recipient['position'] === null)
|| ($sendToBoard && $recipient['position'] !== null)) {
$mail->addBCC($recipient['email']);
$sendTo[] = $recipient['email'];
} else {
var_dump($recipient['position']);
}
} }
$this->sendMail($mail, $subject, $body, $signature); $this->sendMail($mail, $subject, $body, $signature);
} catch (Exception $e) { } catch (Exception $e) {
$this->templateName = 'error_smtp'; $this->templateName = 'error_smtp';
} }
$this->templateName = 'bulkmail_success'; $this->templateName = 'bulkmail_success';
$this->content['recipients'] = implode('<br />', $bccRecipients); $this->content['recipients'] = implode('<br />', $sendTo);
} }
protected function loadReceivers(): array { protected function loadReceivers(): array {
$query = 'SELECT c.first_name, c.last_name, c.email, c.salt $query = 'SELECT c.first_name, c.last_name, c.email, c.salt, c.position_id
FROM clubmember c FROM clubmember c
JOIN clubmember_status cs JOIN clubmember_status cs
ON cs.id = c.membership_status ON cs.id = c.membership_status
@@ -50,7 +61,7 @@ class Bulkmail extends Renderer {
$dbResult = mysqli_query($this->dbConnection, $query); $dbResult = mysqli_query($this->dbConnection, $query);
$recipientsList = []; $recipientsList = [];
while ($row = mysqli_fetch_assoc($dbResult)) { while ($row = mysqli_fetch_assoc($dbResult)) {
$recipientsList[] = $this->decode($row['email'], $row['salt']); $recipientsList[] = ['email' => $this->decode($row['email'], $row['salt']), 'position' => $row['position_id'] ];
} }
return $recipientsList; return $recipientsList;
} }

View File

@@ -55,13 +55,13 @@ class Projectsmanagement extends Renderer {
WHERE caption = "Fortlaufende Projekte"', $newName); WHERE caption = "Fortlaufende Projekte"', $newName);
mysqli_query($this->dbConnection, $query); mysqli_query($this->dbConnection, $query);
$id = mysqli_insert_id($this->dbConnection); $id = mysqli_insert_id($this->dbConnection);
$query = 'SELECT id, short_title FROM project p ORDER BY short_title'; $query = 'SELECT id, short_title, project_type_id FROM project p ORDER BY short_title';
$dbResult = mysqli_query($this->dbConnection, $query); $dbResult = mysqli_query($this->dbConnection, $query);
$list = []; $list = [];
while ($row = mysqli_fetch_assoc($dbResult)) { while ($row = mysqli_fetch_assoc($dbResult)) {
$list[] = ['id' => $row['id'], 'title' => $row['short_title'] ]; $list[] = ['id' => $row['id'], 'title' => $row['short_title'], 'project_type_id' => $row['project_type_id'] ];
} }
echo json_encode(['list' => $list, 'id' => $id]); echo json_encode(['list' => $list, 'id' => $id, 'types' => $this->getProjectTypes()]);
} }
protected function setDescription(): void { protected function setDescription(): void {
@@ -90,15 +90,10 @@ class Projectsmanagement extends Renderer {
} }
protected function generateContent(): void { protected function generateContent(): void {
$typesQuery = 'SELECT * FROM project_type ORDER BY id'; $types = $this->getProjectTypes();
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
$types = [];
while ($row = mysqli_fetch_assoc($typesResult)) {
$types[$row['id'] ] = $row['caption'];
}
$query = 'SELECT * FROM project ORDER BY short_title'; $query = 'SELECT * FROM project ORDER BY short_title';
$result = mysqli_query($this->dbConnection, $query); $result = mysqli_query($this->dbConnection, $query);
$overviewHtml = '<table><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>'; $overviewHtml = '<table id="projectoverview"><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>';
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$overviewHtml .= '<tr><td>' . $row['short_title'] . '</td>'; $overviewHtml .= '<tr><td>' . $row['short_title'] . '</td>';
$overviewHtml .= '<td><select name="project_type" data="' . $row['id'] . '">'; $overviewHtml .= '<td><select name="project_type" data="' . $row['id'] . '">';
@@ -111,4 +106,14 @@ class Projectsmanagement extends Renderer {
$overviewHtml .= '</tbody></table>'; $overviewHtml .= '</tbody></table>';
$this->content['projects'] = $overviewHtml; $this->content['projects'] = $overviewHtml;
} }
protected function getProjectTypes(): array {
$typesQuery = 'SELECT * FROM project_type ORDER BY id';
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
$types = [];
while ($row = mysqli_fetch_assoc($typesResult)) {
$types[$row['id'] ] = $row['caption'];
}
return $types;
}
} }

View File

@@ -12,6 +12,7 @@ class Register extends Renderer {
'value' => 1], 'value' => 1],
]; ];
protected string $formSendButtonLabel = 'Zugang beantragen'; protected string $formSendButtonLabel = 'Zugang beantragen';
protected string $templateName = 'renderer';
protected function formAction(): void { protected function formAction(): void {
$this->writeToDb(); $this->writeToDb();
@@ -45,7 +46,7 @@ class Register extends Renderer {
protected function writeToDb(): void { protected function writeToDb(): void {
$salt = $this->generateRandomString(); $salt = $this->generateRandomString();
$encryptedName = $this->encode(trim(filter_input(INPUT_POST, 'fullname', FILTER_SANITIZE_STRING), $salt)); $encryptedName = $this->encode(trim(filter_input(INPUT_POST, 'fullname', FILTER_SANITIZE_STRING)), $salt);
$email = strtolower(trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL))); $email = strtolower(trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL)));
$encryptedEmail = $this->encode($email, $salt); $encryptedEmail = $this->encode($email, $salt);
$query = sprintf("INSERT INTO ffajs.`user` (username, password, realname, email, active, save_data_accepted, salt, color_id) " $query = sprintf("INSERT INTO ffajs.`user` (username, password, realname, email, active, save_data_accepted, salt, color_id) "

View File

@@ -8,7 +8,7 @@ use Webklex\PHPIMAP\Client;
require 'vendor/autoload.php'; require 'vendor/autoload.php';
class Renderer { class Renderer {
protected string $templateName; protected string $templateName = 'index';
private array $menuItems = []; private array $menuItems = [];
protected array $internalMenuItems = []; protected array $internalMenuItems = [];
protected $hiddenCount = 0; protected $hiddenCount = 0;
@@ -48,10 +48,11 @@ class Renderer {
$scriptName = $this->getScriptName(); $scriptName = $this->getScriptName();
if (!in_array($scriptName, array_merge($this->menuItems, $this->internalMenuItems))) { if (!in_array($scriptName, array_merge($this->menuItems, $this->internalMenuItems))) {
header('Location: /', true, 301); header('Location: /', true, 301);
return; exit;
} }
$this->templateName = $templateName ?: (!in_array($scriptName, ['ffajs', 'fvajs', '', '/']) ? $scriptName : 'index'); $this->templateName = $templateName ?: (!in_array($scriptName, ['ffajs', 'fvajs', '', '/']) ? $scriptName : 'index');
$this->connectDb(); $this->connectDb();
$this->content['year'] = date('Y');
} }
private function createPublicMenuItems(): void { private function createPublicMenuItems(): void {
@@ -173,7 +174,9 @@ class Renderer {
} }
private function footer(): void { private function footer(): void {
$this->website = str_replace('{{footer}}', file_get_contents('templates/footer.html'), $this->website); $footerTemplate = file_get_contents('templates/footer.html');
$footer = str_replace('{{year}}', date('Y'), $footerTemplate);
$this->website = str_replace('{{footer}}', $footer, $this->website);
} }
protected function showInputField(array $errors, string $inputType, string $fieldName, int $fieldLength): void { protected function showInputField(array $errors, string $inputType, string $fieldName, int $fieldLength): void {
@@ -184,7 +187,7 @@ class Renderer {
} }
protected function renderForm(): string { protected function renderForm(): string {
$form = '<form method="post" action="' . $this->getUrl() . '" enctype="' . $this->encType . '"><table class="form">'; $form = '<form method="post" action="' . str_replace('.php', '', $this->getUrl()) . '" enctype="' . $this->encType . '"><table class="form">';
$label = ''; $label = '';
$input = ''; $input = '';
$error = ''; $error = '';

View File

@@ -1,5 +1,5 @@
<h2>Nicht bearbeitete Anfragen</h2> <h2>Nicht bearbeitete Anfragen</h2>
<form action="accounts.php" method="post"> <form action="accounts" method="post">
<table> <table>
<thead> <thead>
<tr> <tr>

View File

@@ -1,4 +1,4 @@
<footer> <footer>
<span class="footer-copyright">(c) 2023 Verein der Freunde und Förderer der <a href="https://www.steffi-jones-schule.com" target="_blank">Steffi-Jones-Schule e.V.</a></span> <span class="footer-copyright">&copy; {{year}} Verein der Freunde und Förderer der <a href="https://www.steffi-jones-schule.com" target="_blank">Steffi-Jones-Schule e.V.</a></span>
<a href="imprint" class="footer-imprint">Impressum</a> <a href="imprint" class="footer-imprint">Impressum</a>
</footer> </footer>

View File

@@ -11,5 +11,5 @@ Tel: xxx-xxxxxxx
</ul> </ul>
<h2>Amtliche Informationen</h2> <h2>Amtliche Informationen</h2>
Registergericht: Amtsgericht Frankfurt a.M., Gerichtsstraße 2, 60313 Frankfurt am Main<br/> Registergericht: Amtsgericht Frankfurt a.M., Gerichtsstraße 2, 60313 Frankfurt am Main<br/>
Vereinsregisternummer: <br/> Vereinsregisternummer: 13422<br/>
Umsatzsteueridentifkationsnummer: <br/> Umsatzsteueridentifkationsnummer: 4525075625<br/>

View File

@@ -19,6 +19,7 @@ $(document).ready(function() {
return; return;
} }
$("#shorttitle > option:not(:first-child)").remove(); $("#shorttitle > option:not(:first-child)").remove();
$("#projectoverview > tbody > tr").remove();
response.list.forEach(function(item) { response.list.forEach(function(item) {
let newItem = $("<option></option>"); let newItem = $("<option></option>");
newItem.attr("id", item.id); newItem.attr("id", item.id);
@@ -26,7 +27,17 @@ $(document).ready(function() {
if (item.id == response.id) { if (item.id == response.id) {
newItem.attr("selected", "selected"); newItem.attr("selected", "selected");
} }
let newRow = $('<tr><td>' + item.title + '</td></tr>');
let selectElement = $('<select name="project_type" data="' + item.id + '"></select>');
for (let typeId in response.types) {
if (response.types.hasOwnProperty(typeId)) {
let option = $('<option value="' + typeId + '"' + (typeId == item.project_type_id ? ' selected' : '') + '>' + response.types[typeId] + '</option>');
selectElement.append(option);
}
}
newRow.append('<td>' + selectElement.prop('outerHTML') + '</td>');
$("#shorttitle").append(newItem); $("#shorttitle").append(newItem);
$("#projectoverview > tbody").append(newRow);
}); });
}).fail(function(response) { }).fail(function(response) {
alert(response); alert(response);