diff --git a/_admin.php b/_admin.php index 4d11688..b41f5f3 100644 --- a/_admin.php +++ b/_admin.php @@ -18,69 +18,120 @@ if (!defined('ACTIVITY_REPORT')) { return null; } -# Plugin menu $_menu['Plugins']->addItem( __('Activity report'), $core->adminurl->get('admin.plugin.activityReport'), dcPage::getPF('activityReport/icon.png'), - preg_match('/' . preg_quote($core->adminurl->get('admin.plugin.activityReport')) . '(&.*)?$/', $_SERVER['REQUEST_URI']), + preg_match( + '/' . preg_quote($core->adminurl->get('admin.plugin.activityReport')) . '(&.*)?$/', + $_SERVER['REQUEST_URI'] + ), $core->auth->check('admin',$core->blog->id) ); -# Dashboarditems -if ($core->activityReport->getSetting('dashboardItem')) { - $core->addBehavior('adminDashboardHeaders', ['activityReportAdmin', 'dashboardHeaders']); - $core->addBehavior('adminDashboardItems', ['activityReportAdmin', 'dashboardItems']); -} +$core->addBehavior('adminDashboardOptionsForm', ['activityReportAdmin', 'adminDashboardOptionsForm']); +$core->addBehavior('adminAfterDashboardOptionsUpdate', ['activityReportAdmin', 'adminAfterDashboardOptionsUpdate']); class activityReportAdmin { - /** - * Add CSS to dashboardHeaders for items - */ - public static function dashboardHeaders() + public static function adminDashboardContents(dcCore $core, $items) { - return dcPage::jsLoad('index.php?pf=activityReport/style.css'); + $core->auth->user_prefs->addWorkspace('activityReport'); + $limit = abs((integer) $core->auth->user_prefs->activityReport->dashboard_item); + if (!$limit) { + return null; + } + $p = [ + 'limit' => $limit, + 'order' => 'activity_dt DESC', + 'sql' => $core->activityReport->requests2params($core->activityReport->getSetting('requests')) + ]; + $lines = []; + $rs = $core->activityReport->getLogs($p); + if ($rs->isEmpty()) { + return null; + } + $groups = $core->activityReport->getGroups(); + while($rs->fetch()) { + $group = $rs->activity_group; + + if (!isset($groups[$group])) { + continue; + } + $lines[] = + '
' . + '' .vsprintf( + __($groups[$group]['actions'][$rs->activity_action]['msg']), + $core->activityReport->decode($rs->activity_logs) + ) . '
' . + form::combo( + 'activityReport_dashboard_item', + self::comboList(), + self::comboList($core->auth->user_prefs->activityReport->dashboard_item) + ) . '
' . + '' . - __($g[$group]['actions'][$rs->activity_action]['title']) . - '
' . - vsprintf( - __($g[$group]['actions'][$rs->activity_action]['msg']), - $core->activityReport->decode($rs->activity_logs) - ) . - '' . form::combo('obsolete', $combo_obselete, $report->getSetting('obsolete')) . '
diff --git a/inc/class.activity.report.php b/inc/class.activity.report.php index 9a8a76a..8191fa6 100644 --- a/inc/class.activity.report.php +++ b/inc/class.activity.report.php @@ -92,7 +92,6 @@ class activityReport $settings = [ 'active' => false, 'obsolete' => 2419200, - 'dashboardItem' => false, 'interval' => 86400, 'lastreport' => 0, 'mailinglist' => [],