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 OpenAireViewSearch extends JViewLegacy{
10
	const LOG = 'openaire';
11
	const MODEL = 'search';
12
	const PAGE = 1;
13
	const SIZE = 5;
14
	
15
	function display($template = NULL) {
16
		$model = $this -> getModel(self :: MODEL);
17
		$locale = JFactory :: getLanguage() -> getTag();
18
		$this -> itemId = JRequest :: getUInt('Itemid', 0);
19
		$this -> keyword = JRequest :: getString('keyword');
20
		if ($this -> keyword == NULL) {
21
			$this -> publications = $model -> getPublicationStatistics($locale);
22
			$this -> datasets = $model -> getDatasetStatistics($locale);
23
			$this -> projects = $model -> getProjectStatistics($locale);
24
			$this -> people = $model -> getPeopleStatistics($locale);
25
			$this -> organizations = $model -> getOrganizationStatistics($locale);
26
			$this -> datasources = $model -> getDatasourceStatistics($locale);
27
		} else {
28
			$this -> publications = $model -> searchPublications($this -> keyword, FALSE, FALSE, FALSE, FALSE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,self :: PAGE, self :: SIZE, $locale);
29
			$this -> datasets = $model -> searchDatasets($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale);
30
			$this -> projects = $model -> searchProjects($this -> keyword, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale);
31
			$this -> people = $model -> searchPeople($this -> keyword, NULL, self :: PAGE, self :: SIZE, $locale);
32
			$this -> organizations = $model -> searchOrganizations($this -> keyword, NULL, NULL, self :: PAGE, self :: SIZE, $locale);
33
			$this -> datasources = $model -> searchDatasources($this -> keyword, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale);
34
		}
35
		if (count($errors = $this -> get('Errors')) > 0) {
36
			JLog :: add('Error viewing search: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
37
			return FALSE;
38
		}
39
		parent :: display($template);
40
	}
41
}
42

    
(2-2/2)