1
|
<?php
|
2
|
|
3
|
// No direct access
|
4
|
defined( '_JEXEC' ) or die( 'Restricted access' );
|
5
|
|
6
|
jimport('joomla.application.component.view');
|
7
|
jimport('joomla.document.document');
|
8
|
jimport('joomla.environment.request');
|
9
|
jimport('joomla.environment.uri');
|
10
|
jimport('joomla.methods');
|
11
|
|
12
|
class OpenaireViewStats extends JView {
|
13
|
function display($tpl = null) {
|
14
|
$document =& JFactory::getDocument();
|
15
|
$document -> addStyleSheet(JRoute :: _(JURI :: base() . 'components/' . JRequest :: getVar('option') . '/css/search.css'));
|
16
|
$document -> addCustomTag('<script type="text/javascript" src="' . JRoute :: _(JURI :: base() . 'components/' . JRequest::getVar('option') . '/js/toggle.js') . '"></script>');
|
17
|
$model = &$this->getModel('statistics');
|
18
|
|
19
|
$thriftResult = $this->getStats();
|
20
|
|
21
|
$programmeStats = $thriftResult->pubStats->programmeStats->lines;
|
22
|
$subdivisionStats = $thriftResult->pubStats->subdivisionStats->lines;
|
23
|
$countryStats = $thriftResult->pubStats->countryStats->lines;
|
24
|
$institutionStats = $thriftResult->pubStats->organizationStats->lines;
|
25
|
|
26
|
if (JRequest::getVar('showInstitutions', 'false', 'get') == "false") {
|
27
|
$institutionStats = array_slice($institutionStats, 0, 15);
|
28
|
}
|
29
|
|
30
|
if (JRequest::getVar('showCountries', 'false', 'get') == "false") {
|
31
|
$countryStats = array_slice($countryStats, 0, 15);
|
32
|
}
|
33
|
|
34
|
$this->assignRef('stats', $thriftResult);
|
35
|
$this->assignRef('programmeStats', $programmeStats);
|
36
|
$this->assignRef('institutionStats', $institutionStats);
|
37
|
$this->assignRef('subdivisionStats', $subdivisionStats);
|
38
|
$this->assignRef('countryStats', $countryStats);
|
39
|
$this->assignRef('searchMenuId', $model->getSearchMenuId());
|
40
|
|
41
|
parent::display($tpl);
|
42
|
}
|
43
|
|
44
|
private function getStats() {
|
45
|
$model = &$this->getModel('statistics');
|
46
|
$cache = & JFactory::getCache('com_openaire', 'callback');
|
47
|
$conf =& JFactory::getConfig();
|
48
|
$cacheactive = $conf->getValue('config.caching');
|
49
|
$cache->setCaching(1); //enable caching
|
50
|
|
51
|
$stats = $cache->call(array($model, 'getEvaluationStatistics'));
|
52
|
$cache->setCaching($cacheactive);
|
53
|
|
54
|
return $stats;
|
55
|
}
|
56
|
}
|
57
|
|
58
|
?>
|