Project

General

Profile

1 14504 thanos.pap
<?php
2
3
defined('_JEXEC') or die('Access denied');
4
5
jimport('joomla.application.component.view');
6
jimport('joomla.environment.request');
7
8
class OpenAireViewInvenio extends JView {
9 25039 thanos.pap
	const REDIRECT = 'redirect';
10
	const PIWIK = 'piwik';
11 15938 thanos.pap
	const LOG = 'openaire';
12 14504 thanos.pap
13
	function display($template = NULL) {
14
		$user = JFactory :: getUser();
15 15921 thanos.pap
		$itemId = JRequest :: getUInt('Itemid', 0);
16 25039 thanos.pap
		$this -> getModel(self :: PIWIK) -> track('invenio', '');
17 30864 yannis.str
		JFactory :: getApplication() -> redirect($user -> guest ? JRoute :: _('index.php?option=com_users&view=login&Itemid=' . $itemId . '&return=' . base64_encode(JRoute :: _('index.php?option=com_openaire&view=invenio&Itemid=' . $itemId, FALSE)), FALSE) : $this -> getModel(self :: REDIRECT) -> createInvenioRedirectUrl($user));
18 15938 thanos.pap
		if (count($errors = $this -> get('Errors')) > 0) {
19
			JLog :: add('Error viewing invenio: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
20
			return FALSE;
21
		}
22 14504 thanos.pap
		return TRUE;
23
	}
24
}