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 JViewLegacy{
|
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 OPENDOAR_BASEURL="http://www.opendoar.org/find.php?format=full&rID=";
|
18
|
const RE3DATA_BASEURL="http://service.re3data.org/repository/";
|
19
|
const PAGE = 1;
|
20
|
const SIZE = 5;
|
21
|
const LOG = 'openaire';
|
22
|
|
23
|
function display($template = NULL) {
|
24
|
$model = $this -> getModel(self :: MODEL);
|
25
|
$this -> itemId = JRequest :: getUInt('Itemid', 0);
|
26
|
$this -> datasourceId = JRequest :: getString('datasourceId');
|
27
|
$locale = JFactory :: getLanguage() -> getTag();
|
28
|
$this -> datasource = ($this -> datasourceId==NULL||$this -> datasourceId=="")?NULL:$model -> getDatasource($this -> datasourceId, $locale, true);
|
29
|
JViewLegacy:: loadHelper('PiwikHelper');
|
30
|
PiwikHelper :: logPageView(($this -> datasource==NULL)?"Data Provider" :($this -> datasource -> name == NULL) ? "Data Provider" : $this -> datasource -> name);
|
31
|
// if type is Aggregator show related datasources
|
32
|
if ($this -> datasource -> type!=null && strpos($this -> datasource -> type, 'Aggregator') !== false){
|
33
|
$this -> publications =($this -> datasourceId==NULL||$this -> datasourceId=="")?NULL: $model -> browsePublications(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, NULL, self :: PAGE, self :: SIZE, $locale, NULL, NULL,TRUE,'&fields=' . OpenAireModelSearch :: PUBLICATION_PROJECT. '&fields=' . OpenAireModelSearch :: PUBLICATION_DATASOURCE);
|
34
|
$this -> datasets =($this -> datasourceId==NULL||$this -> datasourceId=="")?NULL: $model -> browseDatasets(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, self :: PAGE, self :: SIZE, $locale, NULL, NULL,TRUE, '&fields=' . OpenAireModelSearch :: DATASET_DATASOURCE);
|
35
|
}else{
|
36
|
$this -> publications =($this -> datasourceId==NULL||$this -> datasourceId=="")?NULL: $model -> browsePublications(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, NULL, self :: PAGE, self :: SIZE, $locale, NULL, NULL,TRUE,'&fields=' . OpenAireModelSearch :: PUBLICATION_PROJECT);
|
37
|
$this -> datasets =($this -> datasourceId==NULL||$this -> datasourceId=="")?NULL: $model -> browseDatasets(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $this -> datasourceId, self :: PAGE, self :: SIZE, $locale, NULL, NULL,FALSE);
|
38
|
}
|
39
|
|
40
|
if ($this -> datasource == NULL) {
|
41
|
$this -> statisticsExistUrl = NULL;
|
42
|
$this -> statisticsChartUrl = NULL;
|
43
|
} else {
|
44
|
$this -> statisticsExistUrl = $model -> getDatasourceStatisticsExistUrl() . $this -> datasource -> url;
|
45
|
$this -> statisticsChartUrl = $model -> getDatasourceStatisticsChartUrl() . $this -> datasource -> url;
|
46
|
}
|
47
|
$this -> projectStatisticsChartUrl = $model -> getProjectStatisticsChartUrl();
|
48
|
if (count($errors = $this -> get('Errors')) > 0) {
|
49
|
JLog :: add('Error viewing datasource: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG);
|
50
|
return FALSE;
|
51
|
}
|
52
|
parent :: display($template);
|
53
|
}
|
54
|
}
|
55
|
|