diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a65b0..8fde797 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ 0.8.1 - dev - [ ] update public templates - [ ] fix javascript +- [x] add user pref for list options 0.8 - 2021.09.09 - fix compatibility Dotclear v2.19 diff --git a/_admin.php b/_admin.php index 459f507..c0c3ab9 100644 --- a/_admin.php +++ b/_admin.php @@ -22,12 +22,16 @@ $_menu['Plugins']->addItem( $core->adminurl->get('admin.plugin.cinecturlink2'), dcPage::getPF('cinecturlink2/icon.png'), preg_match( - '/' . preg_quote($core->adminurl->get('admin.plugin.dcAdvancedCleaner')) . '(&.*)?$/', + '/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/', $_SERVER['REQUEST_URI'] ), $core->auth->check('contentadmin', $core->blog->id) ); +$core->addBehavior( + 'adminColumnsLists', + ['cinecturlink2AdminBehaviors', 'adminColumnsLists'] +); $core->addBehavior( 'adminDashboardFavorites', ['cinecturlink2AdminBehaviors', 'adminDashboardFavorites'] @@ -35,6 +39,20 @@ $core->addBehavior( class cinecturlink2AdminBehaviors { + public static function adminColumnsLists($core, $cols) + { + $cols['c2link'] = [ + __('Cinecturlink'), [ + 'date' => [true, __('Date')], + 'cat' => [true, __('Category')], + 'author' => [true, __('Author')], + 'desc' => [false, _('Category')], + 'link' => [true, _('Liens')], + 'note' => [true, __('Rating')], + ] + ]; + } + public static function adminDashboardFavorites($core, $favs) { $favs->register('cinecturlink2', [ diff --git a/inc/lib.cinecturlink2.list.php b/inc/lib.cinecturlink2.list.php index 0a1eb85..ff3c35c 100644 --- a/inc/lib.cinecturlink2.list.php +++ b/inc/lib.cinecturlink2.list.php @@ -34,6 +34,20 @@ class adminlistCinecturlink2 $this->html_next = __('next »'); } + public function userColumns($type, $cols) + { + $cols_user = @$this->core->auth->user_prefs->interface->cols; + if (is_array($cols_user) || $cols_user instanceof ArrayObject) { + if (isset($cols_user[$type])) { + foreach ($cols_user[$type] as $cn => $cd) { + if (!$cd && isset($cols[$cn])) { + unset($cols[$cn]); + } + } + } + } + } + public function display($page, $nb_per_page, $enclose_block = '', $filter = false, $redir = '') { $this->redir = $redir; @@ -52,6 +66,18 @@ class adminlistCinecturlink2 } } + $cols = [ + 'title' => '
' . __('Title') . ' | ' . - '' . __('Author') . ' | ' . - '' . __('Description') . ' | ' . - '' . __('Links') . ' | ' . - '' . __('Category') . ' | ' . - '' . __('Rating') . ' | ' . - '' . __('Date') . ' | ' . - '|
---|---|---|---|---|---|---|---|