19 define(
'STATISTICS_DIMENSION_CONTEXT_ID',
'context_id');
20 define(
'STATISTICS_DIMENSION_PKP_SECTION_ID',
'pkp_section_id');
21 define(
'STATISTICS_DIMENSION_ASSOC_OBJECT_TYPE',
'assoc_object_type');
22 define(
'STATISTICS_DIMENSION_ASSOC_OBJECT_ID',
'assoc_object_id');
23 define(
'STATISTICS_DIMENSION_SUBMISSION_ID',
'submission_id');
24 define(
'STATISTICS_DIMENSION_REPRESENTATION_ID',
'representation_id');
25 define(
'STATISTICS_DIMENSION_ASSOC_TYPE',
'assoc_type');
26 define(
'STATISTICS_DIMENSION_ASSOC_ID',
'assoc_id');
27 define(
'STATISTICS_DIMENSION_FILE_TYPE',
'file_type');
29 define(
'STATISTICS_DIMENSION_MONTH',
'month');
30 define(
'STATISTICS_DIMENSION_DAY',
'day');
32 define(
'STATISTICS_DIMENSION_COUNTRY',
'country_id');
33 define(
'STATISTICS_DIMENSION_REGION',
'region');
34 define(
'STATISTICS_DIMENSION_CITY',
'city');
36 define(
'STATISTICS_DIMENSION_METRIC_TYPE',
'metric_type');
39 define(
'STATISTICS_METRIC',
'metric');
42 define(
'STATISTICS_ORDER_ASC',
'ASC');
43 define(
'STATISTICS_ORDER_DESC',
'DESC');
46 define(
'STATISTICS_FILE_TYPE_HTML', 1);
47 define(
'STATISTICS_FILE_TYPE_PDF', 2);
48 define(
'STATISTICS_FILE_TYPE_OTHER', 3);
49 define(
'STATISTICS_FILE_TYPE_DOC', 4);
52 define(
'STATISTICS_UNKNOWN_COUNTRY_ID',
'ZZ');
55 define(
'STATISTICS_YESTERDAY',
'yesterday');
56 define(
'STATISTICS_CURRENT_MONTH',
'currentMonth');
59 define(
'STATISTICS_EARLIEST_DATE',
'20010101');
82 if (isset($filter[STATISTICS_DIMENSION_CONTEXT_ID])) {
83 $contextFilter = $filter[STATISTICS_DIMENSION_CONTEXT_ID];
84 if (is_scalar($contextFilter)) {
87 $context = $contextDao->getById($contextFilter);
106 if (is_null($metricType)) {
107 if (is_a($context,
'Context')) {
108 $metricType = $context->getDefaultMetricType();
110 $metricType = $defaultSiteMetricType;
115 if (!is_null($metricType)) {
116 if (is_scalar($metricType) && $metricType !==
'*') {
118 $metricType = array($metricType);
120 } elseif ($metricType ===
'*') {
122 if (is_a($context,
'Context')) {
123 $metricType = $context->getMetricTypes();
125 $metricType = $siteMetricTypes;
131 if (!is_array($metricType)) $metricType =
null;
152 if (empty($reportPlugins) || empty($metricType)) {
156 if (is_scalar($metricType)) {
157 $metricType = array($metricType);
160 foreach ($reportPlugins as $reportPlugin) {
162 $pluginMetricTypes = $reportPlugin->getMetricTypes();
163 $metricTypeMatches = array_intersect($pluginMetricTypes, $metricType);
164 if (!empty($metricTypeMatches)) {
165 $returner = $reportPlugin;
180 $allMetricTypes = array();
182 if (!empty($reportPlugins)) {
183 foreach ($reportPlugins as $reportPlugin) {
185 $reportMetricTypes = $reportPlugin->getMetricTypes();
186 foreach ($reportMetricTypes as $metricType) {
187 $allMetricTypes[$metricType] = $reportPlugin->getMetricDisplayType($metricType);
192 return $allMetricTypes;
204 if (isset($columns[$column])) {
205 return $columns[$column];
222 if (is_null($assocType)) {
225 if (isset($objectTypes[$assocType])) {
226 return $objectTypes[$assocType];
241 if (is_null($fileType)) {
242 return $fileTypeArray;
244 if (isset($fileTypeArray[$fileType])) {
245 return $fileTypeArray[$fileType];
262 function getReportUrl($request, $metricType, $columns, $filter, $orderBy = array()) {
263 $dispatcher = $request->getDispatcher();
265 'metricType' => $metricType,
266 'columns' => $columns,
267 'filters' => json_encode($filter)
270 if (!empty($orderBy)) {
271 $args[
'orderBy'] = json_encode($orderBy);
274 return $dispatcher->url($request, ROUTE_PAGE,
null,
'management',
'tools',
'generateReport', $args);
283 $geoLocationTool =
null;
285 if (is_a($plugin,
'UsageStatsPlugin')) {
286 $geoLocationTool = $plugin->getGeoLocationTool();
288 return $geoLocationTool;
302 STATISTICS_DIMENSION_ASSOC_ID => __(
'common.id'),
303 STATISTICS_DIMENSION_ASSOC_TYPE => __(
'common.type'),
304 STATISTICS_DIMENSION_FILE_TYPE => __(
'common.fileType'),
305 STATISTICS_DIMENSION_SUBMISSION_ID => $this->
getAppColumnTitle(STATISTICS_DIMENSION_SUBMISSION_ID),
306 STATISTICS_DIMENSION_CONTEXT_ID => $this->
getAppColumnTitle(STATISTICS_DIMENSION_CONTEXT_ID),
307 STATISTICS_DIMENSION_PKP_SECTION_ID => $this->
getAppColumnTitle(STATISTICS_DIMENSION_PKP_SECTION_ID),
308 STATISTICS_DIMENSION_CITY => __(
'manager.statistics.city'),
309 STATISTICS_DIMENSION_REGION => __(
'manager.statistics.region'),
310 STATISTICS_DIMENSION_COUNTRY => __(
'common.country'),
311 STATISTICS_DIMENSION_DAY => __(
'common.day'),
312 STATISTICS_DIMENSION_MONTH => __(
'common.month'),
313 STATISTICS_DIMENSION_METRIC_TYPE => __(
'common.metric'),
314 STATISTICS_METRIC => __(
'common.count')
325 ASSOC_TYPE_SUBMISSION_FILE => __(
'submission.submit.submissionFiles')
336 STATISTICS_FILE_TYPE_PDF =>
'PDF',
337 STATISTICS_FILE_TYPE_HTML =>
'HTML',
338 STATISTICS_FILE_TYPE_OTHER => __(
'common.other'),
339 STATISTICS_FILE_TYPE_DOC =>
'DOC',