diff --git a/src/ManageList.php b/src/ManageList.php index c21e9ad..567ed06 100644 --- a/src/ManageList.php +++ b/src/ManageList.php @@ -31,10 +31,15 @@ use Dotclear\Helper\Html\Html; */ class ManageList extends adminGenericListV2 { - public function display(adminGenericFilterV2 $filter, string $enclose = '',): void + public function display(adminGenericFilterV2 $filter, string $enclose = ''): void { + if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->blog)) { + return; + } + if ($this->rs->isEmpty()) { - echo '

' . ($filter->show() ? + echo '

' . ( + $filter->show() ? __('No widgets matching the filter.') : __('No widget') ) . '

'; @@ -43,8 +48,7 @@ class ManageList extends adminGenericListV2 $pager = new dcPager((int) $filter->value('page'), (int) $this->rs_count, (int) $filter->value('nb'), 10); - $content = - '
' . + $content = '
' . '' . ''; + $tz = dcCore::app()->auth->getInfo('user_tz') ?? (dcCore::app()->blog->settings->get('system')->get('blog_timezone') ?? 'UTC'); + while ($this->rs->fetch()) { $w_title = Html::escapeHTML($this->rs->option_title); if ($w_title == '') { @@ -80,24 +86,22 @@ class ManageList extends adminGenericListV2 } $cols = new ArrayObject([ - 'check' => '', - 'name' => '', + 'name' => '', - 'post_dt' => '', - 'option_title' => '', - 'option_creadt' => '', - 'user_id' => '', - 'post_type' => '', + 'post_dt' => '', + 'option_title' => '', + 'option_creadt' => '', + 'user_id' => '', + 'post_type' => '', ]); $this->userColumns(My::id(), $cols); - $content .= - '' . + $content .= '' . implode(iterator_to_array($cols)) . ''; - } $content .= '
' . ( $filter->show() ? @@ -66,6 +70,8 @@ class ManageList extends adminGenericListV2 $content .= implode(iterator_to_array($cols)) . '
' . (new Checkbox(['widgets[]'], (bool) $this->rs->f('option_id')))->value($this->rs->f('periodical_id'))->disabled(!$this->rs->isEditable())->render() . '' . + 'check' => '' . (new Checkbox(['widgets[]'], (bool) $this->rs->f('option_id')))->value($this->rs->f('option_id'))->disabled(!$this->rs->isEditable())->render() . '' . Html::escapeHTML($this->rs->f('post_title')) . '' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('post_dt'), $tz ?? 'UTC') . '' . $w_title . '' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('option_upddt'), $tz ?? 'UTC') . '' . $this->rs->f('user_id') . '' . $this->rs->f('post_type') . '' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('post_dt'), $tz) . '' . $w_title . '' . Date::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->f('option_upddt'), $tz) . '' . $this->rs->f('user_id') . '' . $this->rs->f('post_type') . '
';