Skip to content

Commit

Permalink
Merge branch 'main' into issue-170-phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
mrothauer committed Jan 17, 2025
2 parents 5de2fb2 + c3fa5ba commit 29df1ba
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
12 changes: 11 additions & 1 deletion plugins/Admin/templates/Fundings/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
'optionalSearchForms' => [
['options' => $fundingStatus, 'value' => 'FundingStatus', 'label' => 'Status'],
],
'fields' => [
'emailFields' => [
[
'label' => 'Träger',
'field' => 'fundingsupporter.email',
],
[
'label' => 'Owner',
'field' => 'owner_user.email',
],
],
'fields' => [
['name' => 'uid', 'label' => 'UID'],
['name' => 'workshop.name', 'label' => 'Initiative', 'sortable' => false],
['label' => 'AN', 'template' => 'list/fundings/activityProof'],
Expand Down
6 changes: 6 additions & 0 deletions plugins/Admin/templates/Users/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
'optionalSearchForms' => [
['options' => $workshops, 'value' => 'UsersWorkshops.workshop_uid', 'label' => 'Mitarbeiter'],
],
'emailFields' => [
[
'label' => 'E-Mails',
'field' => 'email',
]
],
'fields' => [
['name' => 'uid', 'label' => 'UID'],
['name' => 'nick', 'label' => 'Nick'],
Expand Down
8 changes: 7 additions & 1 deletion plugins/Admin/templates/Workshops/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
['options' => $users, 'value' => 'Workshops.owner', 'label' => 'Owner'],
['options' => $users, 'value' => 'UsersWorkshops.user_uid', 'label' => 'Mitarbeiter']
],
'fields' => [
'emailFields' => [
[
'label' => 'E-Mails',
'field' => 'email',
]
],
'fields' => [
['name' => 'uid', 'label' => 'UID'],
['name' => 'image', 'label' => 'Bild'],
['name' => 'name', 'label' => 'Name'],
Expand Down
21 changes: 13 additions & 8 deletions plugins/Admin/templates/element/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,19 @@

<?php
$objects = $objects->toArray();
if (isset($objects[0]) && isset($objects[0]['email'])) {
$rawEmails = Hash::extract($objects, '{n}.email');
$emails = [];
foreach($rawEmails as $email) {
$emails[] = $email;
}
echo $this->Html->link('<i class="far fa-envelope fa-border"></i>', 'mailto:'.join(';', $emails), ['escape' => false, 'title' => 'E-Mail an alle in Liste versenden', 'class' => 'email-link']);
}
if (isset($emailFields) && isset($objects[0])) {
foreach($emailFields as $emailField) {
$rawEmails = Hash::extract($objects, '{n}.'.$emailField['field']);
$rawEmails = array_filter($rawEmails);
$emails = [];
foreach($rawEmails as $email) {
$emails[] = $email;
}
if (!empty($emails)) {
echo $this->Html->link($emailField['label'] . ' <i class="far fa-envelope fa-border"></i>', 'mailto:'.join(';', $emails), ['escape' => false, 'title' => 'E-Mail an alle in Liste versenden', 'class' => 'email-link']);
}
}
}
?>

<?php
Expand Down
6 changes: 3 additions & 3 deletions plugins/Admin/webroot/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ div.admin div.list a.new-link {
}

div.admin div.list a.email-link {
position: absolute;
top: -25px;
right: 35px;
float: right;
margin-bottom: 5px;
margin-left: 5px;
}

div.admin div.list div.pagination {
Expand Down

0 comments on commit 29df1ba

Please sign in to comment.