Open Journal Systems  3.3.0
PKP\Services\PKPStatsService Class Reference
Inheritance diagram for PKP\Services\PKPStatsService:
APP\Services\StatsService

Public Member Functions

 filterRecordFile ($record)
 
 filterRecordHtml ($record)
 
 filterRecordOther ($record)
 
 filterRecordPdf ($record)
 
 getEmptyTimelineIntervals ($startDate, $endDate, $timelineInterval)
 
 getOrderedObjects ($groupBy, $orderDirection, $args=[])
 
 getRecords ($args=[])
 
 getTimeline ($timelineInterval, $args=[])
 
 sumMetric ($total, $record)
 

Protected Member Functions

 getQueryBuilder ($args=[])
 

Detailed Description

Definition at line 18 of file PKPStatsService.inc.php.

Member Function Documentation

◆ filterRecordFile()

PKP\Services\PKPStatsService::filterRecordFile (   $record)

A callback to be used with array_filter() to return records for a file (galley, representation).

Parameters
array$record
Returns
array

Definition at line 222 of file PKPStatsService.inc.php.

◆ filterRecordHtml()

PKP\Services\PKPStatsService::filterRecordHtml (   $record)

A callback to be used with array_filter() to return records for a HTML file.

Parameters
array$record
Returns
array

Definition at line 244 of file PKPStatsService.inc.php.

◆ filterRecordOther()

PKP\Services\PKPStatsService::filterRecordOther (   $record)

A callback to be used with array_filter() to return records for any Other files (all files that are not PDF or HTML).

Parameters
array$record
Returns
array

Definition at line 255 of file PKPStatsService.inc.php.

◆ filterRecordPdf()

PKP\Services\PKPStatsService::filterRecordPdf (   $record)

A callback to be used with array_filter() to return records for a pdf file.

Parameters
array$record
Returns
array

Definition at line 233 of file PKPStatsService.inc.php.

◆ getEmptyTimelineIntervals()

PKP\Services\PKPStatsService::getEmptyTimelineIntervals (   $startDate,
  $endDate,
  $timelineInterval 
)

Get all time segments (months or days) between the start and end date with empty values.

Parameters
$startDatestring
$endDatestring
$timelineIntervalstring STATISTICS_DIMENSION_MONTH or STATISTICS_DIMENSION_DAY
Returns
array of time segments in ASC order

Definition at line 268 of file PKPStatsService.inc.php.

References PKPApplication\get().

Referenced by PKP\Services\PKPStatsService\getTimeline().

◆ getOrderedObjects()

PKP\Services\PKPStatsService::getOrderedObjects (   $groupBy,
  $orderDirection,
  $args = [] 
)

Get a list of objects ordered by their total stats

The $args argument is used to determine what records to include in the results. The $groupBy argument is used to group these records.

For example, to get a list of submissions ordered by their total PDF galley views:

// Get all records with the PDF file type $args = ['fileType' => STATISTICS_FILE_TYPE_PDF]

// Group them by their submission ID $groupBy = STATISTICS_DIMENSION_SUBMISSION_ID

Parameters
string$groupByThe column to sum the stats by.
string$orderDirectionSTATISTICS_ORDER_ASC or STATISTICS_ORDER_DESC
array$argsFilter the records to include. See self::getRecords()

Definition at line 161 of file PKPStatsService.inc.php.

References HookRegistry\call(), DAORegistry\getDAO(), and PKP\Services\PKPStatsService\getQueryBuilder().

◆ getQueryBuilder()

PKP\Services\PKPStatsService::getQueryBuilder (   $args = [])
protected

Get a QueryBuilder object with the passed args

Parameters
array$argsSee self::getRecords()
Returns
\PKP\Services\QueryBuilders\PKPStatsQueryBuilder

Reimplemented in APP\Services\StatsService.

Definition at line 302 of file PKPStatsService.inc.php.

References HookRegistry\call().

Referenced by PKP\Services\PKPStatsService\getOrderedObjects(), PKP\Services\PKPStatsService\getRecords(), and PKP\Services\PKPStatsService\getTimeline().

◆ getRecords()

PKP\Services\PKPStatsService::getRecords (   $args = [])

Get all statistics records that match the passed arguments

Parameters
array$args[ @option array contextIds Return records for these contexts @option array submissionIds Return records for these submissions @option array sectionIds Return records for these sections @option string dateEnd Return records on or before this date @option string dateStart Return records on or after this date @option array assocTypes Return records for these types of objects. One of ASSOC_TYPE_* @option array assocIds Return records for these objects. Only used when assocTypes is set. @option array fileTypes Return records for these file types. One of STATISTICS_FILE_TYPE_* ]
Returns
array

Definition at line 35 of file PKPStatsService.inc.php.

References HookRegistry\call(), DAORegistry\getDAO(), and PKP\Services\PKPStatsService\getQueryBuilder().

◆ getTimeline()

PKP\Services\PKPStatsService::getTimeline (   $timelineInterval,
  $args = [] 
)

Get the sum of a set of metrics broken down by day or month

Parameters
string$timelineIntervalSTATISTICS_DIMENSION_MONTH or STATISTICS_DIMENSION_DAY
array$argsFilter the records to include. See self::getRecords()
Returns
array

Definition at line 93 of file PKPStatsService.inc.php.

References HookRegistry\call(), DAORegistry\getDAO(), PKP\Services\PKPStatsService\getEmptyTimelineIntervals(), and PKP\Services\PKPStatsService\getQueryBuilder().

◆ sumMetric()

PKP\Services\PKPStatsService::sumMetric (   $total,
  $record 
)

A callback to be used with array_reduce() to add up the metric value for a record

Parameters
array$record
Returns
integer

Definition at line 210 of file PKPStatsService.inc.php.


The documentation for this class was generated from the following file: