#10493 added pagination in group module

This commit is contained in:
Daniel Cebrian 2023-02-21 16:51:05 +01:00
parent f9c3524be8
commit dfadbb0f80
2 changed files with 7 additions and 6 deletions

View File

@ -40,6 +40,7 @@ $custom_id = '';
$create_group = (bool) get_parameter('create_group'); $create_group = (bool) get_parameter('create_group');
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$offset = (int) get_parameter('offset', 0);
if ($id_group) { if ($id_group) {
$group = db_get_row('tmodule_group', 'id_mg', $id_group); $group = db_get_row('tmodule_group', 'id_mg', $id_group);
@ -70,9 +71,9 @@ $table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
echo '</span>'; echo '</span>';
if (is_metaconsole()) { if (is_metaconsole()) {
echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group">'; echo '<form name="grupo" method="post" action="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&offset='.$offset.'">';
} else { } else {
echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list">'; echo '<form name="grupo" method="post" action="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&offset='.$offset.'">';
} }
html_print_table($table); html_print_table($table);

View File

@ -262,18 +262,18 @@ if (empty($groups) === false) {
} }
$table->data = []; $table->data = [];
$offset_delete = ($offset >= $total_groups - 1) ? ($offset - $config['block_size']) : $offset;
foreach ($groups as $id_group) { foreach ($groups as $id_group) {
$data = []; $data = [];
$data[0] = $id_group['id_mg']; $data[0] = $id_group['id_mg'];
if ($is_management_allowed === true) { if ($is_management_allowed === true) {
$data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>'; $data[1] = '<strong><a href="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group&id_group='.$id_group['id_mg'].'&offset='.$offset.'">'.ui_print_truncate_text($id_group['name'], GENERIC_SIZE_TEXT).'</a></strong>';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=advanced&sec2=advanced/component_management&tab=module_group&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} else { } else {
$table->cellclass[][2] = 'action_buttons'; $table->cellclass[][2] = 'action_buttons';
$data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>'; $data[2] = '<a href="index.php?sec=gmodules&sec2=godmode/groups/modu_group_list&id_group='.$id_group['id_mg'].'&delete_group=1&offset='.$offset_delete.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
} }
} else { } else {
$data[1] = '<strong>'; $data[1] = '<strong>';