17 import(
'lib.pkp.classes.plugins.ReportPlugin');
24 function register($category, $path, $mainContextId =
null) {
25 $success = parent::register($category, $path, $mainContextId);
34 return 'usageStatsReportPlugin';
41 return __(
'plugins.reports.usageStats.report.displayName');
48 return __(
'plugins.reports.usageStats.report.description');
56 $context = $router->getContext(
$request);
60 import(
'classes.statistics.StatisticsHelper');
62 $columnNames = $statsHelper->getColumnNames();
64 unset($columnNames[STATISTICS_DIMENSION_DAY]);
65 $columns = array_keys($columnNames);
68 'metricType' => $metricType,
69 'columns' => $columns,
70 'filters' => json_encode(array(STATISTICS_DIMENSION_CONTEXT_ID => $context->getId())),
71 'orderBy' => json_encode(array(STATISTICS_DIMENSION_MONTH => STATISTICS_ORDER_ASC))
74 $request->redirect(
null,
null,
'tools',
'generateReport', $reportArgs);
80 function getMetrics($metricType =
null, $columns =
null, $filters =
null, $orderBy =
null, $range =
null) {
84 return $metricsDao->getMetrics($metricType, $columns, $filters, $orderBy, $range);
91 return __(
'plugins.reports.usageStats.metricType');
98 return __(
'plugins.reports.usageStats.metricType.full');
107 if (is_null($metricTypes)) $metricTypes = $pluginMetricTypes;
112 $columns = array(STATISTICS_DIMENSION_ASSOC_TYPE,
113 STATISTICS_DIMENSION_CONTEXT_ID,
114 STATISTICS_DIMENSION_MONTH,
115 STATISTICS_DIMENSION_COUNTRY);
120 $reports[] = array(
'nameLocaleKey' =>
'',
121 'metricType' => $metricTypes,
'columns' => $columns,
'filter' => $filter,
134 STATISTICS_DIMENSION_CITY,
135 STATISTICS_DIMENSION_REGION
150 return array(STATISTICS_DIMENSION_COUNTRY,
151 STATISTICS_DIMENSION_REGION,
152 STATISTICS_DIMENSION_CITY,
153 STATISTICS_DIMENSION_MONTH,
154 STATISTICS_DIMENSION_DAY);
165 if (!is_array($metricType)) $metricType = array($metricType);
168 $intersection = array_intersect($metricType, $pluginMetricTypes);
169 return !empty($intersection);