mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'ent-5370-Pestaña-de-comandos-de-alertas-sin-paginacion' into 'develop'
Add pagination to commands view See merge request artica/pandorafms!3919
This commit is contained in:
commit
43cfa383ac
@ -46,6 +46,8 @@ $create_command = (bool) get_parameter('create_command');
|
|||||||
$delete_command = (bool) get_parameter('delete_command');
|
$delete_command = (bool) get_parameter('delete_command');
|
||||||
$copy_command = (bool) get_parameter('copy_command');
|
$copy_command = (bool) get_parameter('copy_command');
|
||||||
|
|
||||||
|
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands';
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$get_alert_command = (bool) get_parameter('get_alert_command');
|
$get_alert_command = (bool) get_parameter('get_alert_command');
|
||||||
if ($get_alert_command) {
|
if ($get_alert_command) {
|
||||||
@ -634,6 +636,12 @@ if ($commands === false) {
|
|||||||
$commands = [];
|
$commands = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pagination.
|
||||||
|
$total_commands = count($commands);
|
||||||
|
$offset = (int) get_parameter('offset');
|
||||||
|
$limit = (int) $config['block_size'];
|
||||||
|
$commands = array_slice($commands, $offset, $limit);
|
||||||
|
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
@ -678,10 +686,17 @@ foreach ($commands as $command) {
|
|||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($table->data) > 0) {
|
ui_pagination($total_commands, $url);
|
||||||
|
if (isset($data) === true && count($table->data) > 0) {
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||||
} else {
|
} else {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'no_close' => true,
|
||||||
|
'message' => __('No alert commands configured'),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
if ($is_central_policies_on_node === false && check_acl_restricted_all($config['id_user'], $command['id_group'], 'PM')) {
|
||||||
@ -716,4 +731,4 @@ enterprise_hook('close_meta_frame');
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user