forked from ohilbig01/simpleStatistics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupplementaryMetricsDAO.inc.php
More file actions
39 lines (33 loc) · 1.08 KB
/
SupplementaryMetricsDAO.inc.php
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* @file plugins/generic/simpleStatistics/SupplementaryMetricsDAO.inc.php
*
* Copyright (c) 2013-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 SupplementaryMetricsDAO
* @ingroup plugins_generic_simpleStatistics
*
* @brief Operation for retrieving Supplementary Galley Views
*/
class SupplementaryMetricsDAO extends DAO {
function __construct() {
parent::__construct();
}
function getSupplementaryGalleyView($id) {
$result = $this->retrieve(
'SELECT sum(metric) FROM metrics WHERE representation_id = ?', [$id]
);
if (method_exists($result, 'GetRowAssoc')) {
// before OJS 3.3
$row = $result->GetRowAssoc(false);
$result->Close();
} else {
// OJS 3.3
$row = (array) $result->current();
unset($result);
}
return $row['sum(metric)'] ? $row['sum(metric)'] : 0 ;
}
}