Project

General

Profile

1
<?php
2

    
3
defined('_JEXEC') or die('Access denied');
4

    
5
jimport('joomla.application.component.view');
6
jimport('joomla.log.log');
7

    
8
class OpenAireViewDataset extends JView {
9
	const MODEL = 'search';
10
	const OPEN_ACCESS = 'OPEN';
11
	const EMBARGO_ACCESS = 'EMBARGO';
12
	const RESTRICTED_ACCESS = 'RESTRICTED';
13
	const CLOSED_ACCESS = 'CLOSED';
14
	const DOI = 'doi';
15
	const PMC = 'pmc';
16
	const DOI_URL = 'http://dx.doi.org/';
17
	const PMC_URL = 'http://europepmc.org/articles/';
18
	const OTHER_RESOURCES = 'Other Resources';
19
	const MAX_RELATED = 10;
20
	const LOG = 'openaire';
21
	
22
	function display($template = NULL) {
23
		$search = $this -> getModel(self :: MODEL);
24
		$locale = JFactory :: getLanguage() -> getTag();
25
		$this -> itemId = JRequest :: getUInt('Itemid', 0);
26
		$this -> datasetId = JRequest :: getString('datasetId');
27
		$this -> dataset = $search -> getDataset($this -> datasetId, $locale);
28
		JView :: loadHelper('PiwikHelper');
29
		PiwikHelper :: logPageView('viewDataset', 'datasetId=' . urlencode($this -> dataset -> id) . '&locale=' . urlencode($locale));
30
		if (count($errors = $this -> get('Errors')) > 0) {
31
			JLog :: add('Error viewing dataset: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
32
			return FALSE;
33
		}
34
		parent :: display($template);
35
	}
36
}
37

    
(2-2/2)