This commit is contained in:
Jean-Christian Paul Denis 2023-04-29 22:06:30 +02:00
parent 15d7248db5
commit 8315eede38
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 36 additions and 22 deletions

View File

@ -111,12 +111,10 @@ class BackendList extends adminGenericListV2
'check' => (new Para(null, 'td')) 'check' => (new Para(null, 'td'))
->class('nowrap minimal') ->class('nowrap minimal')
->items([ ->items([
(new Checkbox(['entries[]'], $checked))->value($this->rs->log_id), (new Checkbox(['entries[]'], $checked))
->value($this->rs->log_id),
]), ]),
'date' => (new Text('td', Html::escapeHTML(Date::dt2str( 'date' => (new Text('td', Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->log_dt))))
__('%Y-%m-%d %H:%M'),
$this->rs->log_dt
))))
->class('nowrap minimal'), ->class('nowrap minimal'),
'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->log_msg)))) 'msg' => (new Text('td', nl2br(Html::escapeHTML($this->rs->log_msg))))
->class('maximal'), ->class('maximal'),

View File

@ -97,30 +97,46 @@ class Manage extends dcNsProcess
if ($current->logs !== null && $current->list != null) { if ($current->logs !== null && $current->list != null) {
if ($current->logs->isEmpty() && !$current->filter->show()) { if ($current->logs->isEmpty() && !$current->filter->show()) {
echo (new Text('p', __('There are no logs')))->render(); echo
(new Text('p', __('There are no logs')))
->render();
} else { } else {
$current->filter->display( $current->filter->display(
'admin.plugin.' . My::id(), 'admin.plugin.' . My::id(),
(new Hidden(['p'], My::id()))->render() (new Hidden(['p'], My::id()))
->render()
); );
$current->list->display( $current->list->display(
is_numeric($current->filter->__get('page')) ? (int) $current->filter->__get('page') : 1, is_numeric($current->filter->__get('page')) ? (int) $current->filter->__get('page') : 1,
is_numeric($current->filter->__get('nb')) ? (int) $current->filter->__get('nb') : 10, is_numeric($current->filter->__get('nb')) ? (int) $current->filter->__get('nb') : 10,
(new Form('form-entries'))->action(dcCore::app()->adminurl?->get('admin.plugin.' . My::id()))->method('post')->fields([ (new Form('dcLog_form'))
(new Text('', '%s')), ->action(dcCore::app()->adminurl?->get('admin.plugin.' . My::id()))
(new Div())->class('two-cols')->items([ ->method('post')
(new Para())->class('col checkboxes-helpers'), ->fields([
(new Para())->class('col right')->separator(' ')->items([ (new Text('', '%s')),
(new Submit(['selected_logs']))->class('delete')->value(__('Delete selected logs')), (new Div())
(new Submit(['all_logs']))->class('delete')->value(__('Delete all logs')), ->class('two-cols')
]), ->items([
(new Text( (new Para())
'', ->class('col checkboxes-helpers'),
dcCore::app()->adminurl?->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) . (new Para())
dcCore::app()->formNonce() ->class('col right')
)), ->separator(' ')
]), ->items([
])->render(), (new Submit('selected_logs'))
->class('delete')
->value(__('Delete selected logs')),
(new Submit('all_logs'))
->class('delete')
->value(__('Delete all logs')),
]),
(new Text(
'',
dcCore::app()->adminurl?->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) .
dcCore::app()->formNonce()
)),
]),
])->render(),
$current->filter->show() $current->filter->show()
); );
} }