From 5e766bc2e5c8011aa02a951f667c2703a815c13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
';print_r($member);die();
+ }
+}
\ No newline at end of file
diff --git a/modules/Gruppen/Controllers/PrintMemberListController.php b/modules/Gruppen/Controllers/PrintMemberListController.php
new file mode 100644
index 0000000..0089f08
--- /dev/null
+++ b/modules/Gruppen/Controllers/PrintMemberListController.php
@@ -0,0 +1,16 @@
+readFromDb(MainController::KOMPASS_STAMMESGRUPPEN_TEILIS, ['gruppe_id' => $groupId]);
+ }
+}
\ No newline at end of file
diff --git a/modules/Gruppen/Requests/SearchMemberRequest.php b/modules/Gruppen/Requests/SearchMemberRequest.php
new file mode 100644
index 0000000..62ede43
--- /dev/null
+++ b/modules/Gruppen/Requests/SearchMemberRequest.php
@@ -0,0 +1,15 @@
+readSqlFromDb( MainController::KOMPASS_STAMMESGRUPPEN_TEILIS,
+ 'SELECT * FROM %tablename% WHERE CONCAT(`vorname`, " " , `nachname`) LIKE "%' . $name . '%"');
+
+
+ }
+}
\ No newline at end of file
diff --git a/modules/Gruppen/Views/CreateGroupForm.php b/modules/Gruppen/Views/CreateGroupForm.php
new file mode 100644
index 0000000..8f6f400
--- /dev/null
+++ b/modules/Gruppen/Views/CreateGroupForm.php
@@ -0,0 +1,64 @@
+readFromDb(GruppenController::KOMPASS_STAMMESGRUPPEN_GRUPPEN, ['id' => $groupId]);
+
+ add_settings_section(
+ 'custom_settings_section',
+ __('Edit Group', BDP_LV_PLUGIN_SLUG),
+ 'kompass_prepare_form',
+ $page,
+ [
+ 'action' => 'update-group',
+ 'page' => 'kompass-groups',
+ 'group_id' => $groupId
+ ]
+ );
+
+ _kompass_group_display_elements($page, $group[0]);
+ do_settings_sections(BDP_LV_PLUGIN_SLUG . '-create-group');
+ kompass_close_form(__('Update', BDP_LV_PLUGIN_SLUG));
+}
+
+function kompass_create_group_form()
+{
+ global $dbHandler;
+ $page = BDP_LV_PLUGIN_SLUG . '-create-group';
+
+ add_settings_section(
+ 'custom_settings_section',
+ __('Create Group', BDP_LV_PLUGIN_SLUG),
+ 'kompass_prepare_form',
+ $page,
+ [
+ 'action' => 'create-group',
+ 'page' => 'kompass-groups'
+ ]
+ );
+ _kompass_group_display_elements($page);
+
+ do_settings_sections(BDP_LV_PLUGIN_SLUG . '-create-group');
+ kompass_close_form(__('Create', BDP_LV_PLUGIN_SLUG));
+}
+
+function _kompass_group_display_elements(string $page, stdClass $currentGroup = null)
+{
+ $value = '';
+ if (null !== $currentGroup) {
+ $value = $currentGroup->gruppen_name;
+ }
+
+ add_settings_field(
+ 'kompass_group_field_1',
+ __('Group Name', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_groups_group_name',
+ 'value' => $value, 'style' => 'width: 512px']);
+}
diff --git a/modules/Gruppen/Views/CreateMemberForm.php b/modules/Gruppen/Views/CreateMemberForm.php
new file mode 100644
index 0000000..c29c28f
--- /dev/null
+++ b/modules/Gruppen/Views/CreateMemberForm.php
@@ -0,0 +1,131 @@
+readFromDb(GruppenController::KOMPASS_STAMMESGRUPPEN_GRUPPEN, ['id' => $groupId]);
+
+ add_settings_section(
+ 'custom_settings_section',
+ __('Edit Group', BDP_LV_PLUGIN_SLUG),
+ 'kompass_prepare_form',
+ $page,
+ [
+ 'action' => 'update-group',
+ 'page' => 'kompass-groups',
+ 'group_id' => $groupId
+ ]
+ );
+
+ _kompass_group_display_elements($page, $group[0]);
+ do_settings_sections(BDP_LV_PLUGIN_SLUG . '-create-group');
+ kompass_close_form(__('Update', BDP_LV_PLUGIN_SLUG));
+}
+
+function kompass_create_group_member_form(array $prefilledData = [])
+{
+ global $dbHandler;
+ $page = BDP_LV_PLUGIN_SLUG . '-create-member';
+
+ add_settings_section(
+ 'custom_settings_section',
+ __('Add Member', BDP_LV_PLUGIN_SLUG),
+ 'kompass_prepare_form',
+ $page,
+ [
+ 'action' => 'create-member',
+ 'page' => 'kompass-groups'
+ ]
+ );
+ _kompass_group_member_display_elements($page, $prefilledData);
+
+ do_settings_sections($page);
+ kompass_close_form(__('Add member', BDP_LV_PLUGIN_SLUG));
+}
+
+function _kompass_group_member_display_elements(string $page, array $prefilledElements = [])
+{
+
+ $value = $prefilledElements['kompass_group_member_firstname'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_1',
+ __('First Name', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_firstname',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_lastname'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_2',
+ __('Last Name', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_lastname',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_birthday'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_3',
+ __('Birthday', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_datebox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_birthday',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_parents'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_4',
+ __('Contact person', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_parents',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_email_1'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_5',
+ __('E-Mail', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_email_1',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_email_2'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_6',
+ __('Alternative E-Mail', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_email_2',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_phone_1'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_7',
+ __('Telephone', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_phone_1',
+ 'value' => $value, 'style' => 'width: 512px']);
+
+ $value = $prefilledElements['kompass_group_member_phone_2'] ?? '';
+ add_settings_field(
+ 'kompass_group_member_field_8',
+ __('Alternative Telephone', BDP_LV_PLUGIN_SLUG),
+ 'kompass_print_textbox',
+ $page,
+ 'custom_settings_section',
+ ['setting' => 'kompass_group_member_phone_2',
+ 'value' => $value, 'style' => 'width: 512px']);
+}
diff --git a/modules/Gruppen/Views/GruppenOverview.php b/modules/Gruppen/Views/GruppenOverview.php
index 617dbf8..0af502e 100644
--- a/modules/Gruppen/Views/GruppenOverview.php
+++ b/modules/Gruppen/Views/GruppenOverview.php
@@ -11,7 +11,8 @@ function kompass_print_gruppen_overview()
+ placeholder="=__('Search member', BDP_LV_PLUGIN_SLUG); ?>" />
+
@@ -28,15 +29,60 @@ function kompass_print_gruppen_overview()
readFromDb( GruppenController::KOMPASS_STAMMESGRUPPEN_GRUPPEN) as $currentGruppe) {
+ $participantCount = $dbHandler->countSqlRows(GruppenController::KOMPASS_STAMMESGRUPPEN_TEILIS, ['gruppe_id' => $currentGruppe->id]);
echo '';
echo '' . $currentGruppe->gruppen_name .' ';
- echo '' . $dbHandler->countSqlRows(GruppenController::KOMPASS_STAMMESGRUPPEN_TEILIS, ['gruppe_id' => $currentGruppe->id]) .' ';
- echo '' .
- __('Show Members', BDP_LV_PLUGIN_SLUG) . ' ';
+ echo '' . $participantCount . ' ';
+ echo ' ' . kompass_get_group_actions($currentGruppe->id, $participantCount ) .' ';
echo ' ';
}
?>
+
';
+ if ( current_user_can( 'send_mails' ) ) {
+ echo '' .
+ __( 'Mail to multiple groups', BDP_LV_PLUGIN_SLUG ) . ' ';
+ }
+
+ if (current_user_can('create_teilis')) {
+ echo '' .
+ __( 'New Member', BDP_LV_PLUGIN_SLUG ) . ' ';
+ }
+
+ if ( current_user_can( 'delete_teilis' ) ) {
+ ?>
+
+ = __('Create Group', BDP_LV_PLUGIN_SLUG); ?>
+ ';
+}
+
+function kompass_get_group_actions(int $groupId, int $participantCount) : string
+{
+ $elements = [];
+ if ($participantCount > 0) {
+ $elements[] = '' .
+ __('Show Members', BDP_LV_PLUGIN_SLUG) . '';
+ if (current_user_can('send_mails')) {
+ $elements[] = '' .
+ __( 'Mail to group', BDP_LV_PLUGIN_SLUG ) . '';
+ }
+ } else {
+ if (current_user_can('delete_groups')) {
+ $elements[] = '' .
+ __('Delete', BDP_LV_PLUGIN_SLUG) . '';
+ }
+ }
+
+ if (current_user_can('edit_groups')) {
+ $elements[] = '' .
+ __('Edit', BDP_LV_PLUGIN_SLUG) . '';
+ }
+
+ return implode('
' , $elements);
+
}
diff --git a/modules/Gruppen/Views/PrintMembers.php b/modules/Gruppen/Views/PrintMembers.php
index b87696c..251ee0a 100644
--- a/modules/Gruppen/Views/PrintMembers.php
+++ b/modules/Gruppen/Views/PrintMembers.php
@@ -29,7 +29,7 @@ function kompass_print_gruppen_members(array $memberList)
-
+ id; ?>">
= __('Show details', BDP_LV_PLUGIN_SLUG); ?>
diff --git a/modules/KompassSettings/Controllers/SettingsPage.php b/modules/KompassSettings/Controllers/SettingsPage.php
index 5923617..80d7180 100644
--- a/modules/KompassSettings/Controllers/SettingsPage.php
+++ b/modules/KompassSettings/Controllers/SettingsPage.php
@@ -24,7 +24,7 @@ class SettingsPage
switch ($tab) {
case 'tab1':
update_option('bdp_calendar_categories', json_encode($_POST['category']));
- update_option('bdp_calendar_source_url', $_POST['ical_url']);
+ update_option('bdp_calendar_source_url', $_POST['bdp_calendar_source_url']);
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
break;
diff --git a/modules/LimitLoginAttempts/includes/gui_elements.php b/modules/LimitLoginAttempts/includes/gui_elements.php
index 3b3c834..3070c18 100644
--- a/modules/LimitLoginAttempts/includes/gui_elements.php
+++ b/modules/LimitLoginAttempts/includes/gui_elements.php
@@ -1,8 +1,5 @@
';
-}
@@ -19,7 +16,7 @@ bdp_kompass_load_plugin_textdomain();
add_settings_section(
'custom_settings_section',
__('Options', BDP_LV_PLUGIN_SLUG),
- 'custom_settings_section_callback',
+ 'kompass_prepare_form',
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts'
);
@@ -34,7 +31,7 @@ $settings_page = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';
add_settings_field(
'kompass_lla_1',
__('Maximum reps until lockout', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_allowed_retries']);
@@ -42,7 +39,7 @@ add_settings_field(
add_settings_field(
'kompass_lla_2',
__('Duration of lockout (in minutes)', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_lockout_duration', 'unit_division' => 60 ]);
@@ -50,7 +47,7 @@ add_settings_field(
add_settings_field(
'kompass_lla_3',
__('Maximum number of lockouts', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_allowed_lockouts']);
@@ -58,7 +55,7 @@ add_settings_field(
add_settings_field(
'kompass_lla_4',
__('Long-term duration (in hours)', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_long_duration', 'unit_division' => 3600]);
@@ -98,7 +95,7 @@ add_settings_field(
add_settings_field(
'kompass_lla_9',
__('Failed attempts until notification', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$settings_page,
'custom_settings_section',
['setting' => 'kompass_limit_login_notify_email_after']);
diff --git a/modules/calendar/Views/settings-form.php b/modules/calendar/Views/settings-form.php
index 34d117b..73afdc8 100644
--- a/modules/calendar/Views/settings-form.php
+++ b/modules/calendar/Views/settings-form.php
@@ -3,7 +3,7 @@
add_settings_section(
'custom_settings_section',
__('Calendar settings', BDP_LV_PLUGIN_SLUG),
- 'custom_settings_section_callback',
+ 'kompass_prepare_form',
BDP_LV_PLUGIN_SLUG . '-calendar-settings'
);
@@ -12,7 +12,7 @@ $seo_settings_page = BDP_LV_PLUGIN_SLUG . '-calendar-settings';
add_settings_field(
'kompass_cal_1',
__('Calendar URL', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$seo_settings_page,
'custom_settings_section',
['setting' => 'bdp_calendar_source_url', 'style' => 'width: 1024px']);
diff --git a/modules/seo/Views/seo-form.php b/modules/seo/Views/seo-form.php
index c9f5054..19841fb 100644
--- a/modules/seo/Views/seo-form.php
+++ b/modules/seo/Views/seo-form.php
@@ -4,7 +4,7 @@
add_settings_section(
'custom_settings_section',
__('SEO-Options', BDP_LV_PLUGIN_SLUG),
- 'custom_settings_section_callback',
+ 'kompass_prepare_form',
BDP_LV_PLUGIN_SLUG . '-seo-settings'
);
@@ -13,7 +13,7 @@ $seo_settings_page = BDP_LV_PLUGIN_SLUG . '-seo-settings';
add_settings_field(
'kompass_seo_1',
__('Google Site verification', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$seo_settings_page,
'custom_settings_section',
['setting' => 'kompass_seo_google_verification', 'style' => 'width: 500px']);
@@ -22,7 +22,7 @@ add_settings_field(
add_settings_field(
'kompass_seo_2',
__('Bing Site verification', BDP_LV_PLUGIN_SLUG),
- '_kompass_limit_logins_settings_callback',
+ 'kompass_print_textbox',
$seo_settings_page,
'custom_settings_section',
['setting' => 'kompass_seo_bing_verification', 'style' => 'width: 500px']);
\ No newline at end of file