Project

General

Profile

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 OpenAireViewDatasource extends JView {
10
	const MODEL = 'search';
11
	const UNKNOWN_REPOSITORY = 'Unknown Repository';
12
	const OTHER = 'Οther';
13
	const OPENAIRE = 'OpenAIRE publication 2.0';
14
	const DRIVER = 'OpenAIRE publication basic (DRIVER)';
15
	const DRIVER_OPENAIRE = 'OpenAIRE funding 2.0';
16
	const NON_COMPATIBLE = 'non compatible';
17
	const PAGE = 1;
18
	const SIZE = 10;
19
	const LOG = 'openaire';
20
	
21
	function display($template = NULL) {
22
		$model = $this -> getModel(self :: MODEL);
23
		$this -> itemId = JRequest :: getUInt('Itemid', 0);
24
		$this -> datasourceId = JRequest :: getString('datasourceId');
25
		$locale = JFactory :: getLanguage() -> getTag();
26
		JView :: loadHelper('PiwikHelper');
27
		PiwikHelper :: logPageView('viewDatasource', 'datasourceId=' . urlencode($this -> datasourceId) . '&locale=' . urlencode($locale));
28
		$this -> datasource = $model -> getDatasource($this -> datasourceId, $locale, true);
29
		$this -> publications = $model -> browsePublications(NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, NULL, self :: PAGE, self :: SIZE, $locale, NULL, NULL);
30
		$this -> datasets = $model -> browseDatasets(NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, self :: PAGE, self :: SIZE, $locale, NULL, NULL);
31
		if ($this -> datasource == NULL) {
32
			$this -> statisticsExistUrl = NULL;
33
			$this -> statisticsChartUrl = NULL;
34
		} else {
35
			$this -> statisticsExistUrl = $model -> getDatasourceStatisticsExistUrl() . $this -> datasource -> url;
36
			$this -> statisticsChartUrl = $model -> getDatasourceStatisticsChartUrl() . $this -> datasource -> url;
37
		}
38
		$this -> projectStatisticsChartUrl = $model -> getProjectStatisticsChartUrl();
39
		if (count($errors = $this -> get('Errors')) > 0) {
40
			JLog :: add('Error viewing datasource: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
41
			return FALSE;
42
		}
43
		parent :: display($template);
44
	}
45
}
46

    
(2-2/2)