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 OpenAireViewArticle 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 ARXIV = 'arXiv';
16
	const PMC = 'pmc';
17
	const PMID = 'pmid';
18
	const PMID_URL = 'http://europepmc.org/articles/';
19
	const DOI_URL = 'http://dx.doi.org/';
20
	const PMC_URL = 'http://europepmc.org/articles/';
21
	const ARXIV_URL = 'http://arxiv.org/abs/';
22
	const OTHER_RESOURCES = 'Other Resources';
23
	const UNKNOWN_REPOSITORY = 'Unknown Repository';
24
	const MAX_RELATED = 10;
25
	const LOG = 'openaire';
26
	
27
	function display($template = NULL) {
28
		$search = $this -> getModel(self :: MODEL);
29
		$locale = JFactory :: getLanguage() -> getTag();
30
		$this -> itemId = JRequest :: getUInt('Itemid', 0);
31
		$this -> articleId = JRequest :: getString('articleId');
32
		$this -> statisticsExistUrl = $search -> getPublicationStatisticsExistUrl();
33
		$this -> statisticsChartUrl = $search -> getPublicationStatisticsChartUrl();
34
		$this -> article = $search -> getPublication($this -> articleId, $locale);
35
		$this -> logged = (JFactory::getUser()->guest?false:true);
36
		JView :: loadHelper('PiwikHelper');
37
		PiwikHelper :: logPageView('viewPublication', 'publicationId=' . urlencode($this -> articleId) . '&locale=' . urlencode($locale));
38
		if (count($errors = $this -> get('Errors')) > 0) {
39
			JLog :: add('Error viewing article: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
40
			return FALSE;
41
		}
42
		parent :: display($template);
43
	}
44
}
45

    
(2-2/2)