1
|
<?php
|
2
|
|
3
|
defined('_JEXEC') or die('Access denied');
|
4
|
|
5
|
jimport('joomla.application.component.view');
|
6
|
jimport('joomla.environment.request');
|
7
|
jimport('joomla.log.log');
|
8
|
|
9
|
class OpenAireViewStatistics extends JView {
|
10
|
const MODEL = 'statistics';
|
11
|
const OPEN = 'OPEN';
|
12
|
const LIMIT = 15;
|
13
|
const UNLIMITED = -1;
|
14
|
const LOG = 'openaire';
|
15
|
|
16
|
function display($template = NULL) {
|
17
|
$this -> itemId = JRequest :: getUInt('Itemid', 0);
|
18
|
$this -> showCountries = (JRequest :: getString('showCountries') == 'true');
|
19
|
$this -> showInstitutions = (JRequest :: getString('showInstitutions') == 'true');
|
20
|
$model = $this -> getModel(self :: MODEL);
|
21
|
$this -> statistics = $model -> getStatistics();
|
22
|
$this -> publicationsByAccessMode = $model -> getPublicationsByAccessMode();
|
23
|
$this -> openAccessPublications = 0;
|
24
|
$this -> embargoPublications = 0;
|
25
|
if ($this -> publicationsByAccessMode != NULL) {
|
26
|
foreach ($this -> publicationsByAccessMode as $i => $pubilcationsByAccessMode) {
|
27
|
if ($pubilcationsByAccessMode -> accessMode == self :: OPEN) {
|
28
|
$this -> openAccessPublications += $pubilcationsByAccessMode -> publications;
|
29
|
unset($this -> publicationsByAccessMode[$i]);
|
30
|
} else
|
31
|
$this -> embargoPublications += $pubilcationsByAccessMode -> publications;
|
32
|
}
|
33
|
}
|
34
|
$this -> publicationsByProgramme = $model -> getPublicationsByProgramme(self :: UNLIMITED);
|
35
|
$this -> publicationsByScientificArea = $model -> getPublicationsByScientificArea(self :: UNLIMITED);
|
36
|
$this -> publicationsByCountry = $model -> getPublicationsByCountry($this -> showCountries ? self :: UNLIMITED : self :: LIMIT);
|
37
|
$this -> publicationsByInstitution = $model -> getPublicationsByInstitution($this -> showInstitutions ? self :: UNLIMITED : self :: LIMIT);
|
38
|
if (count($errors = $this -> get('Errors')) > 0) {
|
39
|
JLog :: add('Error viewing statistics: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
|
40
|
return FALSE;
|
41
|
}
|
42
|
parent :: display($template);
|
43
|
}
|
44
|
}
|
45
|
|