use anonymous function
This commit is contained in:
parent
fe7cf97bc5
commit
796119e0d2
1 changed files with 68 additions and 93 deletions
37
_admin.php
37
_admin.php
|
@ -16,29 +16,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
require __DIR__ . '/_widgets.php';
|
require __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
# Dashboard item and user preference
|
dcCore::app()->addBehavior('adminDashboardItemsV2', function($__dashboard_items) {
|
||||||
dcCore::app()->addBehavior(
|
|
||||||
'adminDashboardItemsV2',
|
|
||||||
['dcLatestVersionsAdmin', 'adminDashboardItems']
|
|
||||||
);
|
|
||||||
dcCore::app()->addBehavior(
|
|
||||||
'adminDashboardOptionsFormV2',
|
|
||||||
['dcLatestVersionsAdmin', 'adminDashboardOptionsForm']
|
|
||||||
);
|
|
||||||
dcCore::app()->addBehavior(
|
|
||||||
'adminAfterDashboardOptionsUpdate',
|
|
||||||
['dcLatestVersionsAdmin', 'adminAfterDashboardOptionsUpdate']
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup DC_PLUGIN_DCLATESTVERSIONS
|
|
||||||
* @brief Display latest versions of Dotclear - admin methods.
|
|
||||||
* @since 2.6
|
|
||||||
*/
|
|
||||||
class dcLatestVersionsAdmin
|
|
||||||
{
|
|
||||||
public static function adminDashboardItems($__dashboard_items)
|
|
||||||
{
|
|
||||||
if (!dcCore::app()->auth->user_prefs->dashboard->get('dcLatestVersionsItems')) {
|
if (!dcCore::app()->auth->user_prefs->dashboard->get('dcLatestVersionsItems')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -92,10 +70,9 @@ class dcLatestVersionsAdmin
|
||||||
'<h3>' . html::escapeHTML(__("Dotclear's latest versions")) . '</h3>' .
|
'<h3>' . html::escapeHTML(__("Dotclear's latest versions")) . '</h3>' .
|
||||||
'<ul>' . implode('', $li) . '</ul>' .
|
'<ul>' . implode('', $li) . '</ul>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
});
|
||||||
|
|
||||||
public static function adminDashboardOptionsForm()
|
dcCore::app()->addBehavior('adminDashboardOptionsFormV2', function() {
|
||||||
{
|
|
||||||
if (!dcCore::app()->auth->user_prefs->dashboard->prefExists('dcLatestVersionsItems')) {
|
if (!dcCore::app()->auth->user_prefs->dashboard->prefExists('dcLatestVersionsItems')) {
|
||||||
dcCore::app()->auth->user_prefs->dashboard->put(
|
dcCore::app()->auth->user_prefs->dashboard->put(
|
||||||
'dcLatestVersionsItems',
|
'dcLatestVersionsItems',
|
||||||
|
@ -113,14 +90,12 @@ class dcLatestVersionsAdmin
|
||||||
__("Show Dotclear's latest versions on dashboards.") .
|
__("Show Dotclear's latest versions on dashboards.") .
|
||||||
'</label></p>' .
|
'</label></p>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
});
|
||||||
|
|
||||||
public static function adminAfterDashboardOptionsUpdate($user_id)
|
dcCore::app()->addBehavior('adminAfterDashboardOptionsUpdate', function($user_id) {
|
||||||
{
|
|
||||||
dcCore::app()->auth->user_prefs->dashboard->put(
|
dcCore::app()->auth->user_prefs->dashboard->put(
|
||||||
'dcLatestVersionsItems',
|
'dcLatestVersionsItems',
|
||||||
!empty($_POST['dcLatestVersionsItems']),
|
!empty($_POST['dcLatestVersionsItems']),
|
||||||
'boolean'
|
'boolean'
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue