65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
|
<?php
|
||
|
|
||
|
use Bdp\Modules\Gruppen\Controllers\MainController as GruppenController;
|
||
|
|
||
|
function kompass_edit_group_form(int $groupId)
|
||
|
{
|
||
|
global $dbHandler;
|
||
|
$page = BDP_LV_PLUGIN_SLUG . '-create-group';
|
||
|
$group = $dbHandler->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']);
|
||
|
}
|