| Server IP : 10.10.92.66 / Your IP : 104.23.243.85 Web Server : Apache/2.4.52 (Ubuntu) System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64 User : jurnal ( 1001) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/jurnal/public_html/classes/statistics/ |
Upload File : |
<?php
/**
* @file classes/statistics/MetricsDAO.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class MetricsDAO
* @ingroup statistics
*
* @brief Operations for retrieving and adding statistics data.
*/
import('lib.pkp.classes.statistics.PKPMetricsDAO');
class MetricsDAO extends PKPMetricsDAO {
/**
* @copydoc PKPMetricsDAO::getMetrics()
*/
function &getMetrics($metricType, $columns = array(), $filters = array(), $orderBy = array(), $range = null, $nonAdditive = true) {
// Translate the issue dimension to a generic one used in pkp library.
// Do not move this into foreach: https://github.com/pkp/pkp-lib/issues/1615
$worker = array(&$columns, &$filters, &$orderBy);
foreach ($worker as &$parameter) { // Reference needed.
if ($parameter === $filters && array_key_exists(STATISTICS_DIMENSION_ISSUE_ID, $parameter)) {
$parameter[STATISTICS_DIMENSION_ASSOC_OBJECT_TYPE] = ASSOC_TYPE_ISSUE;
}
$key = array_search(STATISTICS_DIMENSION_ISSUE_ID, $parameter);
if ($key !== false) {
$parameter[] = STATISTICS_DIMENSION_ASSOC_OBJECT_TYPE;
}
unset($parameter);
}
return parent::getMetrics($metricType, $columns, $filters, $orderBy, $range, $nonAdditive);
}
/**
* @copydoc PKPMetricsDAO::foreignKeyLookup()
*/
protected function foreignKeyLookup($assocType, $assocId) {
list($contextId, $sectionId, $assocObjType,
$assocObjId, $submissionId, $representationId) = parent::foreignKeyLookup($assocType, $assocId);
$isFile = false;
if (!$contextId) {
switch ($assocType) {
case ASSOC_TYPE_ISSUE_GALLEY:
$issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO'); /* @var $issueGalleyDao IssueGalleyDAO */
$issueGalley = $issueGalleyDao->getById($assocId);
if (!$issueGalley) {
throw new Exception('Cannot load record: invalid issue galley id.');
}
$assocObjType = ASSOC_TYPE_ISSUE;
$assocObjId = $issueGalley->getIssueId();
$isFile = true;
// Don't break but go on to retrieve the issue.
case ASSOC_TYPE_ISSUE:
if (!$isFile) {
$assocObjType = $assocObjId = null;
$issueId = $assocId;
} else {
$issueId = $assocObjId;
}
$issueDao = DAORegistry::getDAO('IssueDAO'); /* @var $issueDao IssueDAO */
$issue = $issueDao->getById($issueId);
if (!$issue) {
throw new Exception('Cannot load record: invalid issue id.');
}
$contextId = $issue->getJournalId();
break;
}
}
return array($contextId, $sectionId, $assocObjType, $assocObjId, $submissionId, $representationId);
}
/**
* @copydoc PKPMetricsDAO::getAssocObjectInfo()
*/
protected function getAssocObjectInfo($submissionId, $contextId) {
$returnArray = parent::getAssocObjectInfo($submissionId, $contextId);
// Submissions in OJS are associated with an Issue.
$submission = Services::get('submission')->get($submissionId);
if ($submission->getCurrentPublication()->getData('issueId')) {
$returnArray = array(ASSOC_TYPE_ISSUE, $submission->getCurrentPublication()->getData('issueId'));
}
return $returnArray;
}
}