Open Journal Systems  3.3.0
PKPMetricsDAO Class Reference
Inheritance diagram for PKPMetricsDAO:
DAO MetricsDAO

Public Member Functions

 getLoadId ($assocType, $assocId, $metricType)
 
getMetrics ($metricType, $columns=array(), $filters=array(), $orderBy=array(), $range=null, $nonAdditive=true)
 
 hasRecord ($metricType)
 
 insertRecord ($record)
 
 purgeLoadBatch ($loadId)
 
 purgeRecords ($metricType, $toDate)
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAdditionalFieldNames ()
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getLocaleFieldNames ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Protected Member Functions

 foreignKeyLookup ($assocType, $assocId)
 
 getAssocObjectInfo ($submissionId, $contextId)
 
- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Additional Inherited Members

- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 
- Data Fields inherited from DAO
 $_dataSource
 

Detailed Description

Class with basic operations for retrieving and adding statistics data.

Definition at line 21 of file PKPMetricsDAO.inc.php.

Member Function Documentation

◆ foreignKeyLookup()

PKPMetricsDAO::foreignKeyLookup (   $assocType,
  $assocId 
)
protected

Foreign key lookup for the published object dimension.

Parameters
$assocTypeint
$assocIdint
Returns
array Values must be foreign keys relative to the context, pkp section, associated object (type and id), submission and representation.

Reimplemented in MetricsDAO.

Definition at line 348 of file PKPMetricsDAO.inc.php.

References PKPServices\get(), getAssocObjectInfo(), Application\getContextAssocType(), Application\getContextDAO(), DAORegistry\getDAO(), Application\getRepresentationDAO(), and Application\getSectionDAO().

Referenced by insertRecord().

◆ getAssocObjectInfo()

PKPMetricsDAO::getAssocObjectInfo (   $submissionId,
  $contextId 
)
protected

Get the id and type of the object that the passed submission info is associated with. Default implementation returns null, subclasses have to implement it.

Parameters
$submissionIdSubmission id.
$contextIdThe submission context id.
Returns
array Assoc type and id of the object.

Reimplemented in MetricsDAO.

Definition at line 430 of file PKPMetricsDAO.inc.php.

Referenced by foreignKeyLookup().

◆ getLoadId()

PKPMetricsDAO::getLoadId (   $assocType,
  $assocId,
  $metricType 
)

Get all load ids that are associated with records filtered by the passed arguments.

Parameters
$assocTypeint
$assocIdint
$metricTypestring
Returns
array

Definition at line 215 of file PKPMetricsDAO.inc.php.

References DAO\retrieve().

◆ getMetrics()

& PKPMetricsDAO::getMetrics (   $metricType,
  $columns = array(),
  $filters = array(),
  $orderBy = array(),
  $range = null,
  $nonAdditive = true 
)

Retrieve a range of aggregate, filtered, ordered metric values, i.e. a statistics report.

See also
https://pkp.sfu.ca/wiki/index.php/OJSdeStatisticsConcept#Input_and_Output_Formats_.28Aggregation.2C_Filters.2C_Metrics_Data.29 for a full specification of the input and output format of this method.
Parameters
$metricTypestring|array metrics selection
$columnsstring|array column (aggregation level) selection
$filtersarray report-level filter selection
$orderByarray order criteria
$rangenull|DBResultRange paging specification
$nonAdditiveboolean (optional) Whether the metric type dimension will be additive or not. This must be used with care, different metric types should not be additive because they may diverge in ways of counting usage events.
Returns
null|array The selected data as a simple tabular result set or null if metrics are not supported, the specified report is invalid or cannot be produced or another error occurred.

Reimplemented in MetricsDAO.

Definition at line 43 of file PKPMetricsDAO.inc.php.

References DAO\retrieve(), and DAO\retrieveRange().

◆ hasRecord()

PKPMetricsDAO::hasRecord (   $metricType)

Check for the presence of any record that has the passed metric type.

Parameters
$metricTypestring
Returns
boolean

Definition at line 234 of file PKPMetricsDAO.inc.php.

References DAO\retrieve().

◆ insertRecord()

PKPMetricsDAO::insertRecord (   $record)

Insert an entry into metrics table.

Parameters
$recordarray
$errorMsgstring

Definition at line 269 of file PKPMetricsDAO.inc.php.

References foreignKeyLookup(), PKPString\regexp_match(), and DAO\update().

◆ purgeLoadBatch()

PKPMetricsDAO::purgeLoadBatch (   $loadId)

Purge a load batch.

Parameters
$loadIdstring

Definition at line 249 of file PKPMetricsDAO.inc.php.

References DAO\update().

◆ purgeRecords()

PKPMetricsDAO::purgeRecords (   $metricType,
  $toDate 
)

Purge all records associated with the passed metric type until the passed date.

Parameters
$metricTypestring
$toDatestring

Definition at line 259 of file PKPMetricsDAO.inc.php.

References DAO\update().


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