menu[dcAdmin::MENU_PLUGINS]->addItem( __('Activity report'), dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)), dcPage::getPF(basename(__DIR__) . '/icon.png'), preg_match( '/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI'] ), dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ dcAuth::PERMISSION_ADMIN, ]), dcCore::app()->blog->id) ); if (dcCore::app()->activityReport->getSetting('active')) { dcCore::app()->addBehavior('adminDashboardContentsV2', ['activityReportAdmin', 'adminDashboardContents']); dcCore::app()->addBehavior('adminDashboardOptionsFormV2', ['activityReportAdmin', 'adminDashboardOptionsForm']); dcCore::app()->addBehavior('adminAfterDashboardOptionsUpdate', ['activityReportAdmin', 'adminAfterDashboardOptionsUpdate']); } class activityReportAdmin { public static function adminDashboardContents($items) { dcCore::app()->auth->user_prefs->addWorkspace(basename(__DIR__)); $limit = abs((int) dcCore::app()->auth->user_prefs->__get(basename(__DIR__))->dashboard_item); if (!$limit) { return null; } $p = [ 'limit' => $limit, 'order' => 'activity_dt DESC', 'sql' => dcCore::app()->activityReport->requests2params(dcCore::app()->activityReport->getSetting('requests')), ]; $lines = []; $rs = dcCore::app()->activityReport->getLogs($p); if ($rs->isEmpty()) { return null; } $groups = dcCore::app()->activityReport->getGroups(); while ($rs->fetch()) { $group = $rs->activity_group; if (!isset($groups[$group])) { continue; } $lines[] = '
' . '' . vsprintf( __($groups[$group]['actions'][$rs->activity_action]['msg']), dcCore::app()->activityReport->decode($rs->activity_logs) ) . '
' . __('View all logs') . ' - ' . __('Configure plugin') . '
' . '' . form::combo( 'activityReport_dashboard_item', self::comboList(), self::comboList(dcCore::app()->auth->user_prefs->__get(basename(__DIR__))->dashboard_item) ) . '
' . '