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'] ), $core->auth->check('admin',$core->blog->id) ); if ($core->activityReport->getSetting('active')) { $core->addBehavior('adminDashboardContents', ['activityReportAdmin', 'adminDashboardContents']); $core->addBehavior('adminDashboardOptionsForm', ['activityReportAdmin', 'adminDashboardOptionsForm']); $core->addBehavior('adminAfterDashboardOptionsUpdate', ['activityReportAdmin', 'adminAfterDashboardOptionsUpdate']); } class activityReportAdmin { public static function adminDashboardContents(dcCore $core, $items) { $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) ) . '
' . __('View all logs') . ' - ' . __('Configure plugin') . '
' . '' . form::combo( 'activityReport_dashboard_item', self::comboList(), self::comboList($core->auth->user_prefs->activityReport->dashboard_item) ) . '
' . '