Revision 50494
Added by Argiro Kokogiannaki about 6 years ago
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchpeople/index.html | ||
---|---|---|
1 |
<!DOCTYPE HTML> |
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<title>OpenAIRE</title> |
|
5 |
</head> |
|
6 |
<body> |
|
7 |
<h1>Access denied</h1> |
|
8 |
</body> |
|
9 |
</html> |
|
10 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchpeople/tmpl/index.html | ||
---|---|---|
1 |
<!DOCTYPE HTML> |
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<title>OpenAIRE</title> |
|
5 |
</head> |
|
6 |
<body> |
|
7 |
<h1>Access denied</h1> |
|
8 |
</body> |
|
9 |
</html> |
|
10 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/person/view.html.php | ||
---|---|---|
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 OpenAireViewPerson extends JViewLegacy{ |
|
10 |
const MODEL = 'search'; |
|
11 |
const PAGE = 1; |
|
12 |
const SIZE = 10; |
|
13 |
const LOG = 'openaire'; |
|
14 |
|
|
15 |
function display($template = NULL) { |
|
16 |
$model = $this -> getModel(self :: MODEL); |
|
17 |
$this -> itemId = JRequest :: getUInt('Itemid', 0); |
|
18 |
$this -> personId = JRequest :: getString('personId'); |
|
19 |
$locale = JFactory :: getLanguage() -> getTag(); |
|
20 |
JViewLegacy:: loadHelper('PiwikHelper'); |
|
21 |
PiwikHelper :: logPageView('viewPerson', 'personId=' . urlencode($this -> personId) . '&locale=' . urlencode($locale)); |
|
22 |
$this -> person =($this -> personId==NULL||$this -> personId=="")?NULL: $model -> getPerson($this -> personId, $locale); |
|
23 |
$this -> publications = ($this -> personId==NULL||$this -> personId=="")?NULL: $model -> browsePublications(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale, NULL, $this -> personId, FALSE); |
|
24 |
$this -> datasets =($this -> personId==NULL||$this -> personId=="")?NULL: $model -> browseDatasets(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, self :: PAGE, self :: SIZE, $locale, NULL, $this -> personId, FALSE,NULL); |
|
25 |
if (count($errors = $this -> get('Errors')) > 0) { |
|
26 |
JLog :: add('Error viewing person: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); |
|
27 |
return FALSE; |
|
28 |
} |
|
29 |
parent :: display($template); |
|
30 |
} |
|
31 |
} |
|
32 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/search/tmpl/default_results.php | ||
---|---|---|
9 | 9 |
<?php echo($this -> loadTemplate('results_publications')); |
10 | 10 |
echo($this -> loadTemplate('results_datasets')); |
11 | 11 |
echo($this -> loadTemplate('results_projects')); |
12 |
echo($this -> loadTemplate('results_people')); |
|
13 | 12 |
echo($this -> loadTemplate('results_organizations')); |
14 | 13 |
echo($this -> loadTemplate('results_datasources')); ?> |
15 | 14 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchpeople/view.html.php | ||
---|---|---|
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 OpenAireViewAdvancedSearchPeople extends JViewLegacy { |
|
10 |
const LOG = 'openaire'; |
|
11 |
const MODEL = 'search'; |
|
12 |
const LAST_NAME = 'lastName'; |
|
13 |
const FIRST_NAME = 'firstName'; |
|
14 |
const FULL_NAME = 'fullName'; |
|
15 |
const ALL = 'all'; |
|
16 |
const ANY = 'any'; |
|
17 |
const DEFAULT_PAGE = 1; |
|
18 |
const MIN_SIZE = 10; |
|
19 |
const MAX_SIZE = 50; |
|
20 |
const SIZE_STEP = 10; |
|
21 |
const MAX_PAGES = 5; |
|
22 |
|
|
23 |
public function __construct($configuration = array()) { |
|
24 |
parent :: __construct($configuration); |
|
25 |
} |
|
26 |
|
|
27 |
function display($template = NULL) { |
|
28 |
$locale = JFactory :: getLanguage() -> getTag(); |
|
29 |
$model = $this -> getModel(self :: MODEL); |
|
30 |
$this -> statistics = $model -> getPeopleStatistics($locale); |
|
31 |
$input = JFactory :: getApplication() -> input; |
|
32 |
$this -> itemId = JRequest :: getUInt('Itemid', 0); |
|
33 |
$this -> keywords = $this -> getParameter('keyword'); |
|
34 |
$this -> fields = $this -> getParameter('field'); |
|
35 |
$this -> constraints = $this -> getParameter('constraint'); |
|
36 |
$this -> countries = $this -> getParameter('country'); |
|
37 |
$this -> filters = array(); |
|
38 |
$country = JRequest :: getString('countryFilter'); |
|
39 |
if ($country != NULL) { |
|
40 |
$this -> filters['countryFilter'] = new JObject(); |
|
41 |
$this -> filters['countryFilter'] -> name = 'countryFilter'; |
|
42 |
$this -> filters['countryFilter'] -> value = $country; |
|
43 |
} |
|
44 |
$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); |
|
45 |
$this -> size = JRequest :: getUInt('size', self :: MIN_SIZE); |
|
46 |
$this -> size = ($this -> size > self :: MAX_SIZE || $this -> size < 1) ? self :: MIN_SIZE : $this -> size; |
|
47 |
if ((($this -> keywords != NULL) && ($this -> fields != NULL) && ($this -> constraints != NULL)) || ($this -> countries != NULL)) { |
|
48 |
JViewLegacy :: loadHelper('PiwikHelper'); |
|
49 |
PiwikHelper :: logPageView('advancedSearchPeople', 'keywords=' . urlencode(implode(',', $this -> keywords)) . '&fields=' . urlencode(implode(',', $this -> fields)) . '&constraints=' . urlencode(implode(',', $this -> constraints)) . '&countries=' . urlencode(implode(',', $this -> countries)) . '&country=' . urlencode($country) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); |
|
50 |
$this -> result = $model -> advancedSearchPeople($this -> keywords, $this -> fields, $this -> constraints, $this -> countries, $country, $this -> page, $this -> size, $locale); |
|
51 |
$this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPeople / $this -> size); |
|
52 |
if ($this -> totalPages == NULL) |
|
53 |
$this -> totalPages = 1; |
|
54 |
$this -> page = ($this -> page > $this -> totalPages)? $this -> totalPages:$this -> page; |
|
55 |
$this -> pagingStart = $this -> page; |
|
56 |
$this -> pagingEnd = $this -> page; |
|
57 |
while (($this -> pagingEnd - $this -> pagingStart < self :: MAX_PAGES - 1) && (($this -> pagingStart != 1) || ($this -> pagingEnd != $this -> totalPages))) { |
|
58 |
if ($this -> pagingStart > 1) |
|
59 |
$this -> pagingStart --; |
|
60 |
if ($this -> pagingEnd < $this -> totalPages) |
|
61 |
$this -> pagingEnd++; |
|
62 |
} |
|
63 |
} else |
|
64 |
$this -> result = NULL; |
|
65 |
if (count($errors = $this -> get('Errors')) > 0) { |
|
66 |
JLog :: add('Error viewing advancedsearchpeople: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); |
|
67 |
return FALSE; |
|
68 |
} |
|
69 |
parent :: display($template); |
|
70 |
} |
|
71 |
|
|
72 |
private function getParameter($name) { |
|
73 |
$values = JFactory :: getApplication() -> input -> get($name, NULL, NULL); |
|
74 |
if ($values == NULL) |
|
75 |
$values = array(); |
|
76 |
else if (!is_array($values)) { |
|
77 |
$value = $values; |
|
78 |
$values = array(); |
|
79 |
$values[] = $value; |
|
80 |
} |
|
81 |
return $values; |
|
82 |
} |
|
83 |
} |
|
84 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/advancedsearchpeople/tmpl/default_form.php | ||
---|---|---|
1 |
<?php |
|
2 |
defined('_JEXEC') or die('Access denied'); |
|
3 |
|
|
4 |
jimport('joomla.environment.uri'); |
|
5 |
jimport('joomla.methods'); |
|
6 |
|
|
7 |
$document = JFactory :: getDocument(); |
|
8 |
$document->addStyleSheet(JRoute :: _(JUri :: base() . 'components/com_openaire/css/tabcontent.css')); |
|
9 |
$document->addScript(JRoute :: _(JUri :: base() . 'components/com_openaire/js/tabcontent.js')); |
|
10 |
?> |
|
11 |
<div class="searchBox"> |
|
12 |
<form method="post" action="<?php echo(JRoute :: _('index.php?option=com_openaire&view=advancedsearchpeople&Itemid=' . $this->itemId)); ?>"> |
|
13 |
<input type="hidden" name="Itemid" value="<?php echo ($this->itemId) ?> "/> |
|
14 |
<input type="hidden" name="noscroll" value="true" /> |
|
15 |
<div class="flowWrapper"> |
|
16 |
<?php if (($this->keywords != NULL) && ($this->fields != NULL) && ($this->constraints != NULL)) { |
|
17 |
for ($i = 0; ($i < count($this->keywords)) && ($i < count($this->fields)) && ($i < count($this->constraints)); $i++) { |
|
18 |
?> |
|
19 |
<div class="srchNavTextAdvancedFilter" style="width: 90%"> |
|
20 |
<input type="text" name="keyword[]" class="uk-form-small uk-width-4-10" placeholder="<?php echo(JText :: _('SEARCH_KEYWORDS')); ?>" value="<?php echo($this->keywords[$i]); ?>" /> |
|
21 |
<select name="field[]" class="fieldSelector styleSelect uk-width-2-10"> |
|
22 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ALL); ?>"<?php echo(($this->fields[$i] == OpenAireViewAdvancedSearchPeople :: ALL) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('ALL_FIELDS')); ?></option> |
|
23 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: LAST_NAME); ?>"<?php echo(($this->fields[$i] == OpenAireViewAdvancedSearchPeople :: LAST_NAME) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('LAST_NAME')); ?></option> |
|
24 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: FIRST_NAME); ?>"<?php echo(($this->fields[$i] == OpenAireViewAdvancedSearchPeople :: FIRST_NAME) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('FIRST_NAME')); ?></option> |
|
25 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: FULL_NAME); ?>"<?php echo(($this->fields[$i] == OpenAireViewAdvancedSearchPeople :: FULL_NAME) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('FULL_NAME')); ?></option> |
|
26 |
</select> |
|
27 |
<select name="constraint[]" class="wordTypeSelector styleSelect uk-width-2-10"> |
|
28 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ALL); ?>"<?php echo(($this->constraints[$i] == OpenAireViewAdvancedSearchPeople :: ALL) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('ALL_WORDS')); ?></option> |
|
29 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ANY); ?>"<?php echo(($this->constraints[$i] == OpenAireViewAdvancedSearchPeople :: ANY) ? ' selected="selected"' : ''); ?>><?php echo(JText :: _('ANY_WORDS')); ?></option> |
|
30 |
</select> |
|
31 |
<span class=" addNewFilter uk-icon-button uk-icon-button-success-hover uk-icon-plus" style=""></span> |
|
32 |
<span class="removeNewFilter uk-icon-button uk-icon-button-danger-hover uk-icon-remove" style="<?php echo(($i === 0 && (1 < count($this->keywords)) || (1 < count($this->fields)) || (1 < count($this->constraints))) ? '' : 'display: none;'); ?>"></span> |
|
33 |
</div> |
|
34 |
<?php } |
|
35 |
} else { |
|
36 |
?> |
|
37 |
<div class="srchNavTextAdvancedFilter"> |
|
38 |
<input type="text" name="keyword[]" class="uk-form-small uk-width-4-10" placeholder="<?php echo(JText :: _('SEARCH_KEYWORDS')); ?>" /> |
|
39 |
<select name="field[]" class="fieldSelector styleSelect uk-width-2-10"> |
|
40 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ALL); ?>"><?php echo(JText :: _('ALL_FIELDS')); ?></option> |
|
41 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: LAST_NAME); ?>"><?php echo(JText :: _('LAST_NAME')); ?></option> |
|
42 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: FIRST_NAME); ?>"><?php echo(JText :: _('FIRST_NAME')); ?></option> |
|
43 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: FULL_NAME); ?>"><?php echo(JText :: _('FULL_NAME')); ?></option> |
|
44 |
</select> |
|
45 |
<select name="constraint[]" class="wordTypeSelector styleSelect uk-width-2-10"> |
|
46 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ALL); ?>"><?php echo(JText :: _('ALL_WORDS')); ?></option> |
|
47 |
<option value="<?php echo(OpenAireViewAdvancedSearchPeople :: ANY); ?>"><?php echo(JText :: _('ANY_WORDS')); ?></option> |
|
48 |
</select> |
|
49 |
<span class=" addNewFilter uk-icon-button uk-icon-button-success-hover uk-icon-plus" style="" ></span> |
|
50 |
<span class="removeNewFilter uk-icon-button uk-icon-button-danger-hover uk-icon-remove" style="display:none;" ></span> |
|
51 |
</div> |
|
52 |
<input type="submit" value="<?php echo(JText :: _('SEARCH')); ?>" class="advancedSearchButton uk-button uk-button-small" /> |
|
53 |
</div> |
|
54 |
|
|
55 |
<?php } ?> |
|
56 |
<div class="advancedPageResults"> |
|
57 |
<?php echo(JText :: _('RESULTS_PER_PAGE_')); ?> |
|
58 |
<select name="size" class="resultsSelections"> |
|
59 |
<?php for ($size = OpenAireViewAdvancedSearchPeople :: MIN_SIZE; $size <= OpenAireViewAdvancedSearchPeople :: MAX_SIZE; $size += OpenAireViewAdvancedSearchPeople :: SIZE_STEP) { ?> |
|
60 |
<option value="<?php echo($size); ?>"<?php echo(($size == $this->size) ? ' selected="selected"' : ''); ?>><?php echo($size); ?></option> |
|
61 |
<?php } ?> |
|
62 |
</select> |
|
63 |
</div> |
|
64 |
<!--</div>--> |
|
65 |
|
|
66 |
<?php if ($this->statistics == NULL) { ?> |
|
67 |
<div class="error"><?php echo(JText :: _('ERROR_RETRIEVING_STATISTICS')); ?></div> |
|
68 |
<?php } else { ?> |
|
69 |
<div class="compileAdvancedSearchFilters"> |
|
70 |
<div class="resultDisplayElement"> |
|
71 |
<div class="header"> |
|
72 |
<h3> |
|
73 |
<span class="limitLabel"><?php echo(JText :: _('LIMITS')); ?></span> |
|
74 |
<span id="noLimits" class="limitNoValue"><?php echo(JText :: _('___NONE')); ?></span> |
|
75 |
</h3> |
|
76 |
<a id="clearAll" class="editClear"><?php echo(JText :: _('_CLEAR_ALL_')); ?></a> |
|
77 |
</div> |
|
78 |
<div id="advanceSearchFilters" class="filters"> |
|
79 |
<p id="countryLimits" style="float: none;"> |
|
80 |
<?php echo(JText :: _('COUNTRIES_')); ?> |
|
81 |
<span></span> |
|
82 |
</p> |
|
83 |
</div> |
|
84 |
</div> |
|
85 |
<?php if (($this->result != NULL) && ($this->result->people != NULL)) { ?> |
|
86 |
<div class="addmore"> |
|
87 |
<a><?php echo(JText :: _('VIEW_ADD_FILTERS')); ?><span class=" showfilters uk-icon-plus" style=""></span> <span class=" hidefilters uk-icon-minus" style=""></span></a> |
|
88 |
</div> |
|
89 |
<?php } ?> |
|
90 |
<div class="leftAdvanced"> |
|
91 |
<div id="country" class="filterItem"> |
|
92 |
<?php if ($this->statistics['country']->data == NULL) { ?> |
|
93 |
<div class="box-info"><?php echo($this->statistics['country']->error); ?></div> |
|
94 |
<?php } else { ?> |
|
95 |
<a class="editRef"> |
|
96 |
<h2><?php echo($this->statistics['country']->title); ?></h2> |
|
97 |
<div class="editClearOptions"> |
|
98 |
<?php echo(JText :: _('EDIT')); ?> |
|
99 |
</div> |
|
100 |
</a> |
|
101 |
<div class="hiddenAdvancedSearch flowWrapper"> |
|
102 |
<?php foreach ($this->countries as $country) { ?> |
|
103 |
<input type="hidden" name="country[]" value="<?php echo($country); ?>" /> |
|
104 |
<?php } ?> |
|
105 |
<div class="updateFilters"> |
|
106 |
<input type="button" value="<?php echo(JText :: _('OK')); ?>" class="uk-button uk-button-mini okElement" /> |
|
107 |
<input type="button" value="<?php echo(JText :: _('CANCEL')); ?>" class="uk-button uk-button-mini cancelElement" /> |
|
108 |
</div> |
|
109 |
<div class="filterLimits"> |
|
110 |
<input class="filterLimits" type="text" placeholder="<?php echo(JText :: _('START_TYPING_TO_LIMIT_YOUR_SELECTIONS')); ?>" /> |
|
111 |
</div> |
|
112 |
<div class="valueSelector"> |
|
113 |
<a class="selectAll"><?php echo(JText :: _('SELECT_ALL')); ?></a> | <a class="deselectAll"><?php echo(JText :: _('DESELECT_ALL')); ?></a> |
|
114 |
</div> |
|
115 |
<div class="filterListingBlock"> |
|
116 |
<?php foreach ($this->statistics['country']->data as $row) { ?> |
|
117 |
<div class="filterRow"> |
|
118 |
<input type="checkbox" value="<?php echo($row->id); ?>"<?php echo(in_array($row->id, $this->countries, TRUE) ? ' checked="checked"' : ''); ?> /> |
|
119 |
<label><?php echo($row->name); ?></label> |
|
120 |
</div> |
|
121 |
<?php } ?> |
|
122 |
</div> |
|
123 |
</div> |
|
124 |
<?php } ?> |
|
125 |
</div> |
|
126 |
</div> |
|
127 |
<div class="rightAdvanced"> |
|
128 |
</div> |
|
129 |
</div> |
|
130 |
<?php } ?> |
|
131 |
<div class="flowWrapper"> |
|
132 |
<div class="advancedSearchOpt"> |
|
133 |
<a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchpeople&Itemid=' . $this->itemId . '&noscroll=true#peopletab')); ?>"><?php echo(JText :: _('SIMPLE_SEARCH_')); ?></a> |
|
134 |
</div> |
|
135 |
</div> |
|
136 |
</form> |
|
137 |
|
|
138 |
</div> |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/browsepeople/view.html.php | ||
---|---|---|
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 OpenAireViewBrowsePeople extends JViewLegacy { |
|
10 |
const LOG = 'openaire'; |
|
11 |
const MODEL = 'search'; |
|
12 |
const DEFAULT_PAGE = 1; |
|
13 |
const DEFAULT_SIZE = 10; |
|
14 |
const MAX_PAGES = 5; |
|
15 |
|
|
16 |
function display($template = NULL) { |
|
17 |
$model = $this -> getModel(self :: MODEL); |
|
18 |
$locale = JFactory :: getLanguage() -> getTag(); |
|
19 |
$this -> itemId = JRequest :: getUInt('Itemid', 0); |
|
20 |
$this -> filters = array(); |
|
21 |
$country = JRequest :: getString('country'); |
|
22 |
if ($country != NULL) { |
|
23 |
$this -> filters['country'] = new JObject(); |
|
24 |
$this -> filters['country'] -> name = 'country'; |
|
25 |
$this -> filters['country'] -> value = $country; |
|
26 |
} |
|
27 |
$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); |
|
28 |
$this -> size = self :: DEFAULT_SIZE; //JRequest :: getUInt('size', self :: DEFAULT_SIZE); |
|
29 |
JViewLegacy :: loadHelper('PiwikHelper'); |
|
30 |
PiwikHelper :: logPageView('browsePeople', 'country=' . urlencode($country) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); |
|
31 |
$this -> result = $model -> browsePeople($country, $this -> page, $this -> size, $locale, TRUE); |
|
32 |
$this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPeople / $this -> size); |
|
33 |
if ($this -> totalPages == NULL) |
|
34 |
$this -> totalPages = 1; |
|
35 |
$this -> page = ($this -> page > $this -> totalPages)? $this -> totalPages:$this -> page; |
|
36 |
$this -> pagingStart = $this -> page; |
|
37 |
$this -> pagingEnd = $this -> page; |
|
38 |
while (($this -> pagingEnd - $this -> pagingStart < self :: MAX_PAGES - 1) && (($this -> pagingStart != 1) || ($this -> pagingEnd != $this -> totalPages))) { |
|
39 |
if ($this -> pagingStart > 1) |
|
40 |
$this -> pagingStart--; |
|
41 |
if ($this -> pagingEnd < $this -> totalPages) |
|
42 |
$this -> pagingEnd++; |
|
43 |
} |
|
44 |
if (count($errors = $this -> get('Errors')) > 0) { |
|
45 |
JLog :: add('Error viewing browsepeople: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); |
|
46 |
return FALSE; |
|
47 |
} |
|
48 |
parent :: display($template); |
|
49 |
} |
|
50 |
} |
|
51 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/browsepeople/tmpl/default_people.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
defined('_JEXEC') or die('Access denied'); |
|
4 |
|
|
5 |
jimport('joomla.methods'); |
|
6 |
|
|
7 |
JViewLegacy :: loadHelper('PagingHelper'); |
|
8 |
JViewLegacy :: loadHelper('PersonHelper'); |
|
9 |
|
|
10 |
if ($this -> result == NULL) { ?> |
|
11 |
<div class="error"><?php echo(JText :: _('ERROR_PERFORMING_SEARCH')); ?></div> |
|
12 |
<?php } else if ($this -> result -> people == NULL) { ?> |
|
13 |
<div class="box-info"><?php echo(JText :: _('NO_PEOPLE_FOUND')); ?></div> |
|
14 |
<?php } else { ?> |
|
15 |
<div class="pageController"> |
|
16 |
<span class="totalof"><?php JText :: printf('N_PEOPLE_PAGE_N_OF_N', $this -> result -> totalPeople, $this -> page, $this -> totalPages); ?></span> |
|
17 |
<?php $baseUrl = 'index.php?option=com_openaire&view=browsepeople&Itemid=' . $this -> itemId; |
|
18 |
foreach ($this -> filters as $filter) |
|
19 |
$baseUrl .= '&' . urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)); |
|
20 |
$baseUrl .= '&size=' . $this -> size . '&page='; |
|
21 |
echo(PagingHelper :: formatPaging($this -> page, $this -> totalPages, $this -> pagingStart, $this -> pagingEnd, $baseUrl, '')); ?> |
|
22 |
</div> |
|
23 |
<div class="searchResults"> |
|
24 |
<?php foreach ($this -> result -> people as $person) { |
|
25 |
echo(PersonHelper :: formatPerson($person, $this -> itemId)); |
|
26 |
} ?> |
|
27 |
</div> |
|
28 |
<div class="pageController"> |
|
29 |
<?php echo(PagingHelper :: formatPaging($this -> page, $this -> totalPages, $this -> pagingStart, $this -> pagingEnd, $baseUrl, '')); ?> |
|
30 |
</div> |
|
31 |
<?php } ?> |
|
32 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/helpers/datasethelper.php | ||
---|---|---|
99 | 99 |
} |
100 | 100 |
|
101 | 101 |
public static function _formatAuthor($author, $itemId) { |
102 |
return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ('<span class="auth">' . (($author -> id == NULL) ? '' : ('<a href="' . JRoute :: _('index.php?option=com_openaire&view=person&personId=' . $author -> id) . '">')) . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)) . (($author -> id == NULL) ? '' : '</a>') . '</span>'); |
|
102 |
// return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ('<span class="auth">' . (($author -> id == NULL) ? '' : ('<a href="' . JRoute :: _('index.php?option=com_openaire&view=person&personId=' . $author -> id) . '">')) . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)) . (($author -> id == NULL) ? '' : '</a>') . '</span>'); |
|
103 |
return (($author == NULL) || ((($author -> lastName == NULL) || ($author -> firstName == NULL)) && ($author -> fullName == NULL))) ? '' : ('<span class="auth">' . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)) . '</span>'); |
|
104 |
|
|
103 | 105 |
} |
104 | 106 |
|
105 | 107 |
public static function _formatYear($year) { |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpeople/view.html.php | ||
---|---|---|
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 OpenAireViewSearchPeople extends JViewLegacy{ |
|
10 |
const LOG = 'openaire'; |
|
11 |
const MODEL = 'search'; |
|
12 |
const DEFAULT_PAGE = 1; |
|
13 |
const DEFAULT_SIZE = 10; |
|
14 |
const MAX_PAGES = 5; |
|
15 |
|
|
16 |
function display($template = NULL) { |
|
17 |
$model = $this -> getModel(self :: MODEL); |
|
18 |
$locale = JFactory :: getLanguage() -> getTag(); |
|
19 |
$this -> itemId = JRequest :: getUInt('Itemid', 0); |
|
20 |
$this -> keyword = JRequest :: getString('keyword'); |
|
21 |
$this -> filters = array(); |
|
22 |
$country = JRequest :: getString('country'); |
|
23 |
if ($country != NULL) { |
|
24 |
$this -> filters['country'] = new JObject(); |
|
25 |
$this -> filters['country'] -> name = 'country'; |
|
26 |
$this -> filters['country'] -> value = $country; |
|
27 |
} |
|
28 |
$this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); |
|
29 |
$this -> size = self :: DEFAULT_SIZE; //JRequest :: getUInt('size', self :: DEFAULT_SIZE); |
|
30 |
if ($this -> keyword == NULL) |
|
31 |
$this -> statistics = $model -> getPeopleStatistics($locale); |
|
32 |
else { |
|
33 |
JViewLegacy:: loadHelper('PiwikHelper'); |
|
34 |
PiwikHelper :: logPageView('searchPeople', 'keyword=' . urlencode($this -> keyword) . '&country=' . urlencode($country) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); |
|
35 |
$this -> result = $model -> searchPeople($this -> keyword, $country, $this -> page, $this -> size, $locale,TRUE); |
|
36 |
$this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPeople / $this -> size); |
|
37 |
if ($this -> totalPages == NULL) |
|
38 |
$this -> totalPages = 1; |
|
39 |
$this -> page = ($this -> page > $this -> totalPages)? $this -> totalPages:$this -> page; |
|
40 |
$this -> pagingStart = $this -> page; |
|
41 |
$this -> pagingEnd = $this -> page; |
|
42 |
while (($this -> pagingEnd - $this -> pagingStart < self :: MAX_PAGES - 1) && (($this -> pagingStart != 1) || ($this -> pagingEnd != $this -> totalPages))) { |
|
43 |
if ($this -> pagingStart > 1) |
|
44 |
$this -> pagingStart --; |
|
45 |
if ($this -> pagingEnd < $this -> totalPages) |
|
46 |
$this -> pagingEnd++; |
|
47 |
} |
|
48 |
} |
|
49 |
if (count($errors = $this -> get('Errors')) > 0) { |
|
50 |
JLog :: add('Error viewing searchpeople: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); |
|
51 |
return FALSE; |
|
52 |
} |
|
53 |
parent :: display($template); |
|
54 |
} |
|
55 |
} |
|
56 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpeople/tmpl/default_form.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
defined('_JEXEC') or die('Access denied'); |
|
4 |
|
|
5 |
jimport('joomla.environment.uri'); |
|
6 |
jimport('joomla.methods'); |
|
7 |
|
|
8 |
$document = JFactory :: getDocument(); |
|
9 |
$document -> addStyleSheet(JRoute :: _(JUri :: base() . 'components/com_openaire/css/tabcontent.css')); |
|
10 |
$document -> addScript(JRoute :: _(JUri :: base() . 'components/com_openaire/js/tabcontent.js')); |
|
11 |
|
|
12 |
?> |
|
13 |
|
|
14 |
<div class="searchBox"> |
|
15 |
<!--<ul class="tabs"> |
|
16 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=search&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('ALL')); ?></a></li> |
|
17 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchpublications&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('PUBLICATIONS')); ?></a></li> |
|
18 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchdatasets&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('DATA')); ?></a></li> |
|
19 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchprojects&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('PROJECTS')); ?></a></li> |
|
20 |
<li class="selected"><a rel="peopletab"><?php echo(JText :: _('PEOPLE')); ?></a></li> |
|
21 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchorganizations&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('ORGANIZATIONS')); ?></a></li> |
|
22 |
<li><a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchdatasources&Itemid=' . $this -> itemId . '&noscroll=true')); ?>"><?php echo(JText :: _('DATASOURCES')); ?></a></li> |
|
23 |
</ul> |
|
24 |
|
|
25 |
<div class="tabcontents"> |
|
26 |
<div id="peopletab" class="tabcontent"> |
|
27 |
--> |
|
28 |
<form action="<?php echo(JRoute :: _('index.php?option=com_openaire&view=searchpeople&Itemid=' . $this -> itemId )); ?>" method="post" id="searchform"> |
|
29 |
<input type="hidden" name="Itemid" value="<?php echo($this->itemId); ?>" /> |
|
30 |
<input type="hidden" name="noscroll" value="true" /> |
|
31 |
<div class="flowWrapper"> |
|
32 |
<div class="srchNavText"> |
|
33 |
<select id="searchtype" name="searchtype" class="styleSelect uk-width-2-10"> |
|
34 |
<option value="all" ><?php echo(JText :: _('ALL')); ?></option> |
|
35 |
<option value="pub"><?php echo(JText :: _('PUBLICATIONS')); ?></option> |
|
36 |
<option value="data" ><?php echo(JText :: _('DATA')); ?></option> |
|
37 |
<option value="proj"><?php echo(JText :: _('PROJECTS')); ?></option> |
|
38 |
<option value="people" selected="selected"><?php echo(JText :: _('PEOPLE')); ?></option> |
|
39 |
<option value="org"><?php echo(JText :: _('ORGANIZATIONS')); ?></option> |
|
40 |
<option value="datasources" ><?php echo(JText :: _('DATASOURCES')); ?></option> |
|
41 |
</select> |
|
42 |
<input name="keyword" type="text" class=" textsearch uk-form-small uk-width-6-10" value="<?php echo(htmlspecialchars($this->keyword)); ?>" placeholder="<?php echo(JText :: _('SEARCH_KEYWORDS')); ?>" /> |
|
43 |
<input type="submit" value="<?php echo(JText :: _('SEARCH')); ?>"class="uk-button uk-button-small" /> |
|
44 |
<input type="hidden" name="page" value="1" /> |
|
45 |
<input type="hidden" name="noscroll" value="true" /> |
|
46 |
|
|
47 |
</div> |
|
48 |
</div> |
|
49 |
<div class="flowWrapper"> |
|
50 |
<div class="advancedSearchOpt"> |
|
51 |
<a href="<?php echo(JRoute :: _('index.php?option=com_openaire&view=advancedsearchpeople&Itemid=' . $this->itemId . '&noscroll=true')); ?>" class="advancedSearch"><?php echo(JText :: _('MORE_SEARCH_OPTIONS_')); ?></a> |
|
52 |
</div> |
|
53 |
</div> |
|
54 |
</form> |
|
55 |
<!-- |
|
56 |
</div> |
|
57 |
</div>--> |
|
58 |
</div> |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/helpers/personhelper.php | ||
---|---|---|
13 | 13 |
public static function formatPerson($person, $itemId) { |
14 | 14 |
if (($person == NULL) || ((($person -> lastName == NULL) || ($person -> firstName == NULL)) && ($person -> fullName == NULL))) |
15 | 15 |
return ''; |
16 |
return '<div class="srchRow"><h4>' . (($person -> id == NULL) ? '' : ('<a href="' . JRoute :: _('index.php?option=com_openaire&view=person&personId=' . $person -> id) . '">')) . ((($person -> lastName == NULL) || ($person -> firstName == NULL)) ? $person -> fullName : ($person -> lastName . ', ' . $person -> firstName)) . (($person -> id == NULL) ? '' : '</a>') . '</h4>' . (($person -> country == NULL) ? '' : ('<div class="biblio"><span class="country">' . $person -> country . '</span></div>')) . '</div>';
|
|
16 |
return '<div class="srchRow"><h4>' . ('<a href="' . JRoute :: _('index.php?option=com_openaire&view=advancedsearchpublications&Itemid=' . $itemId . '&keyword=' . ((($author -> lastName == NULL) || ($author -> firstName == NULL)) ? $author -> fullName : ($author -> lastName . ', ' . $author -> firstName)).'&field=author&constraint=all') . '">') . ((($person -> lastName == NULL) || ($person -> firstName == NULL)) ? $person -> fullName : ($person -> lastName . ', ' . $person -> firstName)) . (($person -> id == NULL) ? '' : '</a>') . '</h4>' . (($person -> country == NULL) ? '' : ('<div class="biblio"><span class="country">' . $person -> country . '</span></div>')) . '</div>';
|
|
17 | 17 |
} |
18 | 18 |
} |
19 | 19 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/helpers/statistichelper.php | ||
---|---|---|
32 | 32 |
mb_internal_encoding('UTF-8'); |
33 | 33 |
//encode '&' to '%26' otherwise it takes it as a parameter |
34 | 34 |
$row -> id= str_replace('&','%26',$row -> id); |
35 |
if($row -> name =="unidentified"){ // down't show unidentified projects |
|
36 |
return ""; |
|
37 |
} |
|
35 | 38 |
return '<a href="' . JRoute :: _( $baseUrl . (($filters == NULL) ? '' : ('&' . implode('&', $filters))) . '&' . urlencode($statisticId) . '=' . urlencode($row -> id) . $fragment) . '" class="selectorAdd" title="' . $row -> name . '">' . ((strlen($row -> name.'(' . $row -> count . ')') > StatisticHelper :: MAX_ROW) ? (mb_substr($row -> name, 0, StatisticHelper :: MAX_ROW - strlen('...(' . $row -> count . ')')) . '...') : $row -> name ) . '</a> <span>(' . $row -> count . ')</span>'; |
36 | 39 |
} |
37 | 40 |
public static function _formatRowForFunder($row, $statisticId, $filters, $baseUrl, $fragment) { |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpeople/tmpl/default.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<metadata> |
|
3 |
<layout title="SEARCH_PEOPLE"> |
|
4 |
<message>SEARCH_PEOPLE</message> |
|
5 |
</layout> |
|
6 |
</metadata> |
|
7 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/views/searchpeople/tmpl/default_people.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
defined('_JEXEC') or die('Access denied'); |
|
4 |
|
|
5 |
jimport('joomla.methods'); |
|
6 |
|
|
7 |
JViewLegacy:: loadHelper('PagingHelper'); |
|
8 |
JViewLegacy:: loadHelper('PersonHelper'); |
|
9 |
|
|
10 |
if ($this -> result == NULL) { ?> |
|
11 |
<div class="error"><?php echo(JText :: _('ERROR_PERFORMING_SEARCH')); ?></div> |
|
12 |
<?php } else if ($this -> result -> people == NULL) { ?> |
|
13 |
<div class="box-info"><?php echo(JText :: _('NO_PEOPLE_FOUND')); ?></div> |
|
14 |
<?php } else { ?> |
|
15 |
<div class="pageController"> |
|
16 |
<span class="totalof"><?php JText :: printf('N_PEOPLE_PAGE_N_OF_N', $this -> result -> totalPeople, $this -> page, $this -> totalPages); ?></span> |
|
17 |
<?php $baseUrl = 'index.php?option=com_openaire&view=searchpeople&Itemid=' . $this -> itemId . '&keyword=' . $this -> keyword; |
|
18 |
foreach ($this -> filters as $filter) |
|
19 |
$baseUrl .= '&' . urlencode($filter -> name) . '=' . urlencode(($filter -> value === TRUE) ? 'true' : (($filter -> value === FALSE) ? 'false' : $filter -> value)); |
|
20 |
$baseUrl .= '&size=' . $this -> size . '&noscroll=true&page='; |
|
21 |
echo(PagingHelper :: formatPaging($this -> page, $this -> totalPages, $this -> pagingStart, $this -> pagingEnd, $baseUrl, '')); ?> |
|
22 |
</div> |
|
23 |
<div class="searchResults"> |
|
24 |
<?php foreach ($this -> result -> people as $person) { |
|
25 |
echo(PersonHelper :: formatPerson($person, $this -> itemId)); |
|
26 |
} ?> |
|
27 |
</div> |
|
28 |
<div class="pageController"> |
|
29 |
<?php echo(PagingHelper :: formatPaging($this -> page, $this -> totalPages, $this -> pagingStart, $this -> pagingEnd, $baseUrl, '')); ?> |
|
30 |
</div> |
|
31 |
<?php } ?> |
|
32 |
|
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/models/search.php | ||
---|---|---|
16 | 16 |
const PUBLICATION_STATISTICS_CACHE_ID = 'statistics.publications'; |
17 | 17 |
const DATASET_STATISTICS_CACHE_ID = 'statistics.datasets'; |
18 | 18 |
const PROJECT_STATISTICS_CACHE_ID = 'statistics.projects'; |
19 |
const PEOPLE_STATISTICS_CACHE_ID = 'statistics.people'; |
|
20 | 19 |
const ORGANIZATION_STATISTICS_CACHE_ID = 'statistics.organizations'; |
21 | 20 |
const DATASOURCE_STATISTICS_CACHE_ID = 'statistics.datasource'; |
22 | 21 |
const SEARCH_PUBLICATIONS_CACHE_ID = 'search.publications'; |
23 | 22 |
const SEARCH_DATASETS_CACHE_ID = 'search.datasets'; |
24 | 23 |
const SEARCH_PROJECTS_CACHE_ID = 'search.projects'; |
25 |
const SEARCH_PEOPLE_CACHE_ID = 'search.people'; |
|
26 | 24 |
const SEARCH_ORGANIZATIONS_CACHE_ID = 'search.organizations'; |
27 | 25 |
const SEARCH_DATASOURCES_CACHE_ID = 'search.datasources'; |
28 | 26 |
const BROWSE_PUBLICATIONS_CACHE_ID = 'browse.publications'; |
29 | 27 |
const BROWSE_DATASETS_CACHE_ID = 'browse.datasets'; |
30 |
const BROWSE_PROJECTS_CACHE_ID = 'browse.projects'; |
|
31 |
const BROWSE_PEOPLE_CACHE_ID = 'browse.people'; |
|
28 |
const BROWSE_PROJECTS_CACHE_ID = 'browse.projects'; |
|
32 | 29 |
const BROWSE_ORGANIZATIONS_CACHE_ID = 'browse.organizations'; |
33 | 30 |
const BROWSE_DATASOURCES_CACHE_ID = 'browse.datasources'; |
34 | 31 |
const ADVANCED_SEARCH_PUBLICATIONS_CACHE_ID = 'advanced.publications'; |
32 |
const ADVANCED_SEARCH_DATASETS_CACHE_ID = 'advanced.datasets'; |
|
35 | 33 |
const ADVANCED_SEARCH_PROJECTS_CACHE_ID = 'advanced.projects'; |
36 |
const ADVANCED_SEARCH_PEOPLE_CACHE_ID = 'advanced.people'; |
|
37 | 34 |
const ADVANCED_SEARCH_ORGANIZATIONS_CACHE_ID = 'advanced.organizations'; |
38 | 35 |
const ADVANCED_SEARCH_DATASOURCES_CACHE_ID = 'advanced.datasources'; |
39 | 36 |
const RESULT_CACHE_ID = 'result'; |
... | ... | |
66 | 63 |
const PUBLICATION_SCIENTIFIC_AREA = 'relfundinglevel1_id'; |
67 | 64 |
const PUBLICATION_FUNDING_STREAM_LEVEL2 = 'relfundinglevel2_id'; |
68 | 65 |
const PUBLICATION_YEAR = 'resultacceptanceyear'; |
69 |
const PUBLICATION_ACCESS_MODE = 'resultbestlicense';
|
|
66 |
const PUBLICATION_ACCESS_MODE = 'resultbestaccessright';
|
|
70 | 67 |
const RESULT_HOSTING_DATASOURCE = 'resulthostingdatasource'; |
71 | 68 |
const RESULT_HOSTING_DATASOURCE_ID = 'resulthostingdatasourceid'; |
72 | 69 |
const RESULT_COLLECTED_FROM_DATASOURCE = 'collectedfrom'; |
73 | 70 |
const RESULT_COLLECTED_FROM_DATASOURCE_ID = 'collectedfromdatasourceid'; |
74 | 71 |
const PUBLICATION_PROJECT = 'relproject'; |
75 | 72 |
const PUBLICATION_PROJECT_ID = 'relprojectid'; |
76 |
const PUBLICATION_AUTHOR_ID = 'relpersonid';
|
|
73 |
const PUBLICATION_AUTHOR_ID = 'resultauthor_nt';
|
|
77 | 74 |
const PUBLICATION_ARTICLE = '0001'; |
78 | 75 |
const PUBLICATION_PREPRINT = '0016'; |
79 | 76 |
const PUBLICATION_BOOK = '0002'; |
... | ... | |
85 | 82 |
const PUBLICATION_INTERNAL_REPORT = '0011'; |
86 | 83 |
const PUBLICATION_EXTERNAL_REPORT = '0009'; |
87 | 84 |
const PUBLICATION_TITLE = 'resulttitle'; |
88 |
const PUBLICATION_AUTHOR = 'relperson';
|
|
85 |
const PUBLICATION_AUTHOR = 'resultauthor';
|
|
89 | 86 |
const PUBLICATION_PUBLISHER = 'resultpublisher'; |
90 | 87 |
const PUBLICATION_SUBJECT = 'resultsubject'; |
91 | 88 |
const PUBLICATION_DATE = 'resultdateofacceptance'; |
... | ... | |
98 | 95 |
const DATASET_SCIENTIFIC_AREA = 'relfundinglevel1_id'; |
99 | 96 |
const DATASET_FUNDING_STREAM_LEVEL2 = 'relfundinglevel2_id'; |
100 | 97 |
const DATASET_YEAR = 'resultacceptanceyear'; |
101 |
const DATASET_ACCESS_MODE = 'resultbestlicense';
|
|
98 |
const DATASET_ACCESS_MODE = 'resultbestaccessright';
|
|
102 | 99 |
const DATASET_PROJECT = 'relproject'; |
103 | 100 |
const DATASET_PROJECT_ID = 'relprojectid'; |
104 |
const DATASET_AUTHOR_ID = 'relpersonid';
|
|
101 |
const DATASET_AUTHOR_ID = 'resultauthor_nt';
|
|
105 | 102 |
const DATASET_ID = 'objIdentifier'; |
106 | 103 |
const PROJECT_QUERY = '(oaftype exact project)'; |
107 | 104 |
const PROJECT = 'project'; |
... | ... | |
165 | 162 |
const PUBLICATION = 'publication'; |
166 | 163 |
const DATASET = 'dataset'; |
167 | 164 |
const HTTP_OK = 200; |
168 |
|
|
165 |
const ALL = 'all'; |
|
166 |
const ANY = 'any'; |
|
169 | 167 |
private $searchService; |
170 | 168 |
private $publicationStatisticsExistUrl; |
171 | 169 |
private $publicationStatisticsChartUrl; |
... | ... | |
271 | 269 |
return $statistics; |
272 | 270 |
} |
273 | 271 |
|
274 |
// Retrieve people statistics using cache if enabled. |
|
275 |
// $locale the locale to use |
|
276 |
// return statistics (object) |
|
277 |
public function getPeopleStatistics($locale) { |
|
278 |
if ($this->cache->getCaching()) { |
|
279 |
$cacheId = self :: PEOPLE_STATISTICS_CACHE_ID . '.' . $locale; |
|
280 |
$statistics = $this->cache->get($cacheId, self :: CACHE_GROUP); |
|
281 |
if ($statistics === FALSE) { |
|
282 |
$statistics = $this->_getPeopleStatistics($locale); |
|
283 |
if ($statistics !== NULL) |
|
284 |
$this->cache->store($statistics, $cacheId, self :: CACHE_GROUP); |
|
285 |
} |
|
286 |
} else |
|
287 |
$statistics = $this->_getPeopleStatistics($locale); |
|
288 |
return $statistics; |
|
289 |
} |
|
290 |
|
|
291 | 272 |
// Retrieve organization statistics using cache if enabled. |
292 | 273 |
// $locale the locale to use |
293 | 274 |
// return statistics (object) |
... | ... | |
410 | 391 |
return $result; |
411 | 392 |
} |
412 | 393 |
|
413 |
// Perform a simple search for people using cache if enabled. |
|
414 |
// $keyword the keyword to search for |
|
415 |
// $country the ID of the country to use as filter or NULL for no country filtering |
|
416 |
// $page the page of results to retrieve |
|
417 |
// $size the size of the page of results to retrieve |
|
418 |
// $locale the locale to use |
|
419 |
// return a result (object) containing people and statistics |
|
420 |
public function searchPeople($keyword, $country, $page, $size, $locale, $isRefine) { |
|
421 |
if ($this->cache->getCaching()) { |
|
422 |
$cacheId = self :: SEARCH_PEOPLE_CACHE_ID . '.' . $keyword . '.' . $country . '.' . $page . '.' . $size . '.' . $locale . '.' . $isRefine; |
|
423 |
$result = $this->cache->get($cacheId, self :: CACHE_GROUP); |
|
424 |
if ($result === FALSE) { |
|
425 |
$result = $this->_searchPeople($keyword, $country, $page, $size, $locale, $isRefine); |
|
426 |
if ($result !== NULL) |
|
427 |
$this->cache->store($result, $cacheId, self :: CACHE_GROUP); |
|
428 |
} |
|
429 |
} else |
|
430 |
$result = $this->_searchPeople($keyword, $country, $page, $size, $locale, $isRefine); |
|
431 |
return $result; |
|
432 |
} |
|
433 |
|
|
394 |
|
|
434 | 395 |
// Perform a simple search for organizations using cache if enabled. |
435 | 396 |
// $keyword the keyword to search for |
436 | 397 |
// $country the ID of the country to use as filter or NULL for no country filtering |
... | ... | |
561 | 522 |
return $result; |
562 | 523 |
} |
563 | 524 |
|
564 |
// Perform a browse for people using cache if enabled. |
|
565 |
// $country the ID of the country to use as filter or NULL for no country filtering |
|
566 |
// $page the page of results to retrieve |
|
567 |
// $size the size of the page of results to retrieve |
|
568 |
// $locale the locale to use |
|
569 |
// return a result (object) containing people and statistics |
|
570 |
public function browsePeople($country, $page, $size, $locale, $isRefine) { |
|
571 |
if ($this->cache->getCaching()) { |
|
572 |
$cacheId = self :: BROWSE_PEOPLE_CACHE_ID . '.' . $country . '.' . $page . '.' . $size . '.' . $locale .'.'. $isRefine; |
|
573 |
$result = $this->cache->get($cacheId, self :: CACHE_GROUP); |
|
574 |
if ($result === FALSE) { |
|
575 |
$result = $this->_browsePeople($country, $page, $size, $locale, $isRefine); |
|
576 |
if ($result !== NULL) |
|
577 |
$this->cache->store($result, $cacheId, self :: CACHE_GROUP); |
|
578 |
} |
|
579 |
} else |
|
580 |
$result = $this->_browsePeople($country, $page, $size, $locale, $isRefine); |
|
581 |
return $result; |
|
582 |
} |
|
583 | 525 |
|
584 | 526 |
// Perform a browse for organizations using cache if enabled. |
585 | 527 |
// $country the ID of the country to use as filter or NULL for no country filtering |
... | ... | |
666 | 608 |
$result = $this->_advancedSearchPublications($keywords, $fields, $constraints, $types, $languages, $funders, $fundingStreams, $scientificAreas, $fundingStreamsLevel2, $date, $fromMonth, $fromYear, $toMonth, $toYear, $accessModes, $datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale); |
667 | 609 |
return $result; |
668 | 610 |
} |
611 |
public function advancedSearchDatasets($keywords, $fields, $constraints, $types, $languages, $funders, $fundingStreams, $scientificAreas, $fundingStreamsLevel2, $date, $fromMonth, $fromYear, $toMonth, $toYear, $accessModes, $datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale) { |
|
612 |
if ($this->cache->getCaching()) { |
|
613 |
$cacheId = self :: ADVANCED_SEARCH_DATASETS_CACHE_ID . '.' . implode('.', $keywords) . '.' . implode('.', $fields) . '.' . implode('.', $constraints) . '.' . implode('.', $types) . '.' . implode('.', $languages) . '.' . implode('.', $funders) . '.' . implode('.', $fundingStreams) . '.' . implode('.', $scientificAreas) .'.' . implode('.', $fundingStreamsLevel2) . '.' . $date . '.' . $fromMonth . '.' . $fromYear . '.' . $toMonth . '.' . $toYear . '.' . implode('.', $accessModes) . '.' . implode('.', $datasources) . '.' . $type . '.' . $language . '.' . $funder . '.' . $fundingStream . '.' . $scientificArea . '.'.$fundingStreamLevel2.'.' . $year . '.' . $accessMode . '.' . $datasource . '.' . $page . '.' . $size . '.' . $locale; |
|
614 |
$result = $this->cache->get($cacheId, self :: CACHE_GROUP); |
|
615 |
if ($result === FALSE) { |
|
616 |
$result = $this->_advancedSearchDatasets($keywords, $fields, $constraints, $types, $languages, $funders, $fundingStreams, $scientificAreas, $fundingStreamsLevel2, $date, $fromMonth, $fromYear, $toMonth, $toYear, $accessModes, $datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale); |
|
617 |
if ($result !== NULL) |
|
618 |
$this->cache->store($result, $cacheId, self :: CACHE_GROUP); |
|
619 |
} |
|
620 |
} else |
|
621 |
$result = $this->_advancedSearchDatasets($keywords, $fields, $constraints, $types, $languages, $funders, $fundingStreams, $scientificAreas, $fundingStreamsLevel2, $date, $fromMonth, $fromYear, $toMonth, $toYear, $accessModes, $datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale); |
|
622 |
return $result; |
|
623 |
} |
|
669 | 624 |
|
625 |
|
|
670 | 626 |
// Perform an advanced search for projects using cache if enabled. |
671 | 627 |
// $keywords the keywords to search for (array) |
672 | 628 |
// $fields the fields to match keywords with (array - possible values are ACRONYM, TITLE and KEYWORDS) |
... | ... | |
711 | 667 |
return $result; |
712 | 668 |
} |
713 | 669 |
|
714 |
// Perform an advanced search for people using cache if enabled. |
|
715 |
// $keywords the keywords to search for (array) |
|
716 |
// $fields the fields to match keywords with (array - possible values are LAST_NAME, FIRST_NAME and FULL_NAME) |
|
717 |
// $constraints the constraints to apply to keywords (array - possible values are ALL and ANY) |
|
718 |
// $countries the IDs of the countries to search for |
|
719 |
// $country the ID of the coutnry to use as filter or NULL for no country filtering |
|
720 |
// $page the page of results to retrieve |
|
721 |
// $size the size of the page of results to retrieve |
|
722 |
// $locale the locale to use |
|
723 |
// return a result (object) containing people and statistics |
|
724 |
public function advancedSearchPeople($keywords, $fields, $constraints, $countries, $country, $page, $size, $locale) { |
|
725 |
if ($this->cache->getCaching()) { |
|
726 |
$cacheId = self :: ADVANCED_SEARCH_PEOPLE_CACHE_ID . '.' . implode('.', $keywords) . '.' . implode('.', $fields) . '.' . implode('.', $constraints) . '.' . implode('.', $countries) . '.' . $country . '.' . $page . '.' . $size . '.' . $locale; |
|
727 |
$result = $this->cache->get($cacheId, self :: CACHE_GROUP); |
|
728 |
if ($result === FALSE) { |
|
729 |
$result = $this->_advancedSearchPeople($keywords, $fields, $constraints, $countries, $country, $page, $size, $locale); |
|
730 |
if ($result !== NULL) |
|
731 |
$this->cache->store($result, $cacheId, self :: CACHE_GROUP); |
|
732 |
} |
|
733 |
} else |
|
734 |
$result = $this->_advancedSearchPeople($keywords, $fields, $constraints, $countries, $country, $page, $size, $locale); |
|
735 |
return $result; |
|
736 |
} |
|
737 |
|
|
738 | 670 |
// Perform an advanced search for organizations using cache if enabled. |
739 | 671 |
// $keywords the keywords to search for (array) |
740 | 672 |
// $fields the fields to match keywords with (array - possible values are NAME and SHORT_NAME) |
... | ... | |
884 | 816 |
// $ids the project identifiers |
885 | 817 |
// $locale the locale to use |
886 | 818 |
// return an array of project (object) or NULL if no such projects exists |
887 |
public function getProjectByCodeId($id, $locale) { |
|
819 |
public function getProjectByCodeId($id, $funder, $locale) {
|
|
888 | 820 |
if ($this->cache->getCaching()) { |
889 |
$cacheId = self :: PROJECT_CACHE_ID . '.' . $id . '.' . $locale; |
|
821 |
$cacheId = self :: PROJECT_CACHE_ID . '.' . $id . '.' . $funder . '.' . $locale;
|
|
890 | 822 |
$projects = $this->cache->get($cacheId, self :: CACHE_GROUP); |
891 | 823 |
if ($projects === FALSE) { |
892 |
$projects = $this->_getProjectByCodeId($id, $locale); |
|
824 |
$projects = $this->_getProjectByCodeId($id, $funder, $locale);
|
|
893 | 825 |
if ($projects !== NULL) |
894 | 826 |
$this->cache->store($projects, $cacheId, self :: CACHE_GROUP); |
895 | 827 |
} |
896 | 828 |
} else |
897 |
$projects = $this->_getProjectByCodeId($id, $locale); |
|
829 |
$projects = $this->_getProjectByCodeId($id, $funder, $locale);
|
|
898 | 830 |
return $projects; |
899 | 831 |
} |
900 | 832 |
|
... | ... | |
1181 | 1113 |
} |
1182 | 1114 |
} |
1183 | 1115 |
|
1184 |
// Retrieve people statistics. |
|
1185 |
// $locale the locale to use |
|
1186 |
// return statistics (object) |
|
1187 |
private function _getPeopleStatistics($locale) { |
|
1188 |
$statistics = array(); |
|
1189 |
return $statistics; |
|
1190 |
// try { |
|
1191 |
// $time = microtime(TRUE); |
|
1192 |
// $query = self :: PERSON_QUERY; |
|
1193 |
// JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
1194 |
// if (($response = $this->performGet('search?action=refine&rTransformer=results_openaire_browse&fields=' . self :: PERSON_COUNTRY . '&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
1195 |
// throw new Exception('no HTTP response'); |
|
1196 |
// if ($response->code != self :: HTTP_OK) |
|
1197 |
// throw new Exception('HTTP response code ' . $response->code); |
|
1198 |
// $document = new DOMDocument(); |
|
1199 |
// $document->recover = TRUE; |
|
1200 |
// if ($document->loadXML($response->body) == FALSE) |
|
1201 |
// throw new Exception('invalid XML response'); |
|
1202 |
// $xpath = new DOMXPath($document); |
|
1203 |
// $statistics = $this->createStatistics($xpath, array('country'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)); |
|
1204 |
// JLog :: add('Retrieved people statistics in ' . (microtime(TRUE) - $time) . ' s (locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
1205 |
// |
|
1206 |
// return $statistics; |
|
1207 |
// } catch (Exception $e) { |
|
1208 |
// JLog :: add('Error retrieving people statistics (locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
1209 |
// return NULL; |
|
1210 |
// } |
|
1211 |
} |
|
1212 | 1116 |
|
1213 | 1117 |
// Retrieve organization statistics. |
1214 | 1118 |
// $locale the locale to use |
... | ... | |
1624 | 1528 |
} |
1625 | 1529 |
} |
1626 | 1530 |
|
1627 |
// Perform a simple search for people. |
|
1628 |
// $keyword the keyword to search for |
|
1629 |
// $country the country to use as filter or NULL for no country filtering |
|
1630 |
// $page the page of results to retrieve |
|
1631 |
// $size the size of the page of results to retrieve |
|
1632 |
// $locale the locale to use |
|
1633 |
// return a result (object) containing people and statistics |
|
1634 |
private function _searchPeople($keyword, $country, $page, $size, $locale, $isRefine) { |
|
1635 |
try { |
|
1636 |
$time = microtime(TRUE); |
|
1637 |
$query = self :: PERSON_QUERY; |
|
1638 |
$query .= ($keyword == NULL) ? '' : ' and "' . str_replace('"', '\\"', $keyword) . '"'; |
|
1639 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
1640 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
1641 |
// $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
1642 |
// :'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1643 |
$completeQuery='search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
1644 |
if (($response = $this->performGet($completeQuery)) == NULL) |
|
1645 |
throw new Exception('no HTTP response'); |
|
1646 |
if ($response->code != self :: HTTP_OK) |
|
1647 |
throw new Exception('HTTP response code ' . $response->code); |
|
1648 |
$document = new DOMDocument(); |
|
1649 |
$document->recover = TRUE; |
|
1650 |
if ($document->loadXML($response->body) == FALSE) |
|
1651 |
throw new Exception('invalid XML response'); |
|
1652 |
$xpath = new DOMXPath($document); |
|
1653 |
$result = new JObject(); |
|
1654 |
$result->totalPeople = $this->parseTotalResults($xpath); |
|
1655 |
$result->people = $this->parsePeople($xpath); |
|
1656 |
$result->statistics = $isRefine? array():NULL; |
|
1657 |
JLog :: add('Simple search retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (keyword: ' . $keyword . ', country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
1658 |
return $result; |
|
1659 |
} catch (Exception $e) { |
|
1660 |
JLog :: add('Error performing people simple search (keyword: ' . $keyword . ', country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
1661 |
return NULL; |
|
1662 |
} |
|
1663 |
} |
|
1664 | 1531 |
|
1665 | 1532 |
// Perform a simple search for organizations. |
1666 | 1533 |
// $keyword the keyword to search for |
... | ... | |
2182 | 2049 |
} |
2183 | 2050 |
} |
2184 | 2051 |
|
2185 |
// Perform a browse for people. |
|
2186 |
// $country the ID of the country to use as filter or NULL for no country filtering |
|
2187 |
// $page the page of results to retrieve |
|
2188 |
// $size the size of the page of results to retrieve |
|
2189 |
// $locale the locale to use |
|
2190 |
// return a result (object) containing people and statistics |
|
2191 |
private function _browsePeople($country, $page, $size, $locale, $isRefine) { |
|
2192 |
try { |
|
2193 |
$time = microtime(TRUE); |
|
2194 |
$query = self :: PERSON_QUERY; |
|
2195 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
2196 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
2197 |
// $completeQuery=$isRefine?'search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PERSON_COUNTRY . '&locale=' . str_replace('-', '_', $locale) |
|
2198 |
// :'search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
2199 |
$completeQuery='search?action=search&sTransformer=persons_openaire&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale); |
|
2200 |
if (($response = $this->performGet($completeQuery)) == NULL) |
|
2201 |
throw new Exception('no HTTP response'); |
|
2202 |
if ($response->code != self :: HTTP_OK) |
|
2203 |
throw new Exception('HTTP response code ' . $response->code); |
|
2204 |
$document = new DOMDocument(); |
|
2205 |
$document->recover = TRUE; |
|
2206 |
if ($document->loadXML($response->body) == FALSE) |
|
2207 |
throw new Exception('invalid XML response'); |
|
2208 |
$xpath = new DOMXPath($document); |
|
2209 |
$result = new JObject(); |
|
2210 |
$result->totalPeople = $this->parseTotalResults($xpath); |
|
2211 |
$result->people = $this->parsePeople($xpath); |
|
2212 |
$result->statistics =$result->statistics = $isRefine? array():NULL; |
|
2213 |
JLog :: add('Browse retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
2214 |
return $result; |
|
2215 |
} catch (Exception $e) { |
|
2216 |
JLog :: add('Error performing people browse (country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
2217 |
return NULL; |
|
2218 |
} |
|
2219 |
} |
|
2052 |
|
|
2220 | 2053 |
|
2221 | 2054 |
// Perform a browse for organizations. |
2222 | 2055 |
// $country the ID of the country to use as filter or NULL for no country filtering |
... | ... | |
2421 | 2254 |
for ($i = 0; ($i < count($keywords)) && ($i < count($fields)) && ($i < count($constraints)); $i++) { |
2422 | 2255 |
$tokens = preg_split('/\s/', $keywords[$i], NULL, PREG_SPLIT_NO_EMPTY); |
2423 | 2256 |
switch ($constraints[$i]) { |
2424 |
case OpenAireViewAdvancedSearchPublications :: ALL:
|
|
2257 |
case self :: ALL:
|
|
2425 | 2258 |
$operator = ' and '; |
2426 | 2259 |
break; |
2427 |
case OpenAireViewAdvancedSearchPublications :: ANY:
|
|
2260 |
case self :: ANY:
|
|
2428 | 2261 |
$operator = ' or '; |
2429 | 2262 |
break; |
2430 | 2263 |
default: |
... | ... | |
2541 | 2374 |
return NULL; |
2542 | 2375 |
} |
2543 | 2376 |
} |
2377 |
private function _advancedSearchDatasets($keywords, $fields, $constraints, $types, $languages, $funders, $fundingStreams, $scientificAreas, $fundingStreamsLevel2, $date, $fromMonth, $fromYear, $toMonth, $toYear, $accessModes, $datasources, $type, $language, $funder, $fundingStream, $scientificArea, $fundingStreamLevel2, $year, $accessMode, $datasource, $page, $size, $locale) { |
|
2378 |
try { |
|
2379 |
$time = microtime(TRUE); |
|
2380 |
$query = self :: DATASET_QUERY; |
|
2381 |
for ($i = 0; ($i < count($keywords)) && ($i < count($fields)) && ($i < count($constraints)); $i++) { |
|
2382 |
$tokens = preg_split('/\s/', $keywords[$i], NULL, PREG_SPLIT_NO_EMPTY); |
|
2383 |
switch ($constraints[$i]) { |
|
2384 |
case self :: ALL: |
|
2385 |
$operator = ' and '; |
|
2386 |
break; |
|
2387 |
case self :: ANY: |
|
2388 |
$operator = ' or '; |
|
2389 |
break; |
|
2390 |
default: |
|
2391 |
$operator = NULL; |
|
2392 |
} |
|
2393 |
switch ($fields[$i]) { |
|
2394 |
case OpenAireViewAdvancedSearchPublications :: TITLE: |
|
2395 |
$field = self :: PUBLICATION_TITLE; |
|
2396 |
break; |
|
2397 |
case OpenAireViewAdvancedSearchPublications :: AUTHOR: |
|
2398 |
$field = self :: PUBLICATION_AUTHOR; |
|
2399 |
break; |
|
2400 |
case OpenAireViewAdvancedSearchPublications :: PUBLISHER: |
|
2401 |
$field = self :: PUBLICATION_PUBLISHER; |
|
2402 |
break; |
|
2403 |
case OpenAireViewAdvancedSearchPublications :: SUBJECT: |
|
2404 |
$field = self :: PUBLICATION_SUBJECT; |
|
2405 |
break; |
|
2406 |
default: |
|
2407 |
$field = NULL; |
|
2408 |
} |
|
2409 |
$query .= ($tokens == NULL) ? '' : (' and (' . implode($operator, array_map(function ($keyword) use ($field) { |
|
2410 |
return '(' . (($field == NULL) ? '' : ($field . ' = ')) . '"' . str_replace('"', '\\"', $keyword) . '")'; |
|
2411 |
}, $tokens)) . ')'); |
|
2412 |
} |
|
2413 |
$field = self :: PUBLICATION_TYPE; |
|
2414 |
$query .= ($types == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($type) use ($field) { |
|
2415 |
return '(' . $field . ' exact "' . $type . '")'; |
|
2416 |
}, $types)) . ')'); |
|
2417 |
$field = self :: PUBLICATION_LANGUAGE; |
|
2418 |
$query .= ($languages == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($language) use ($field) { |
|
2419 |
return '(' . $field . ' exact "' . $language . '")'; |
|
2420 |
}, $languages)) . ')'); |
|
2421 |
$field = self :: PUBLICATION_FUNDER; |
|
2422 |
$query .= ($funders == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($funder) use ($field) { |
|
2423 |
return '(' . $field . ' exact "' . $funder . '")'; |
|
2424 |
}, $funders)) . ')'); |
|
2425 |
$field = self :: PUBLICATION_FUNDING_STREAM; |
|
2426 |
$query .= ($fundingStreams == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($fundingStream) use ($field) { |
|
2427 |
return '(' . $field . ' exact "' . $fundingStream . '")'; |
|
2428 |
}, $fundingStreams)) . ')'); |
|
2429 |
$field = self :: PUBLICATION_SCIENTIFIC_AREA; |
|
2430 |
$query .= ($scientificAreas == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($scientificArea) use ($field) { |
|
2431 |
return '(' . $field . ' exact "' . $scientificArea . '")'; |
|
2432 |
}, $scientificAreas)) . ')'); |
|
2433 |
$field = self :: PUBLICATION_FUNDING_STREAM_LEVEL2; |
|
2434 |
$query .= ($fundingStreamsLevel2 == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($fundingStreamsLevel2) use ($field) { |
|
2435 |
return '(' . $field . ' exact "' . $fundingStreamsLevel2 . '")'; |
|
2436 |
}, $fundingStreamsLevel2)) . ')'); |
|
2437 |
$from = new DateTime(); |
|
2438 |
$to = new DateTime(); |
|
2439 |
switch ($date) { |
|
2440 |
case -1: |
|
2441 |
break; |
|
2442 |
case 0: |
|
2443 |
$from->setDate($fromYear, $fromMonth, 1); |
|
2444 |
$to->setDate($toYear, $toMonth, 1); |
|
2445 |
$to->setDate($toYear, $toMonth, date('t', $to->getTimestamp())); // update to with the last day of that month |
|
2446 |
$query .= ' and (' . self :: PUBLICATION_DATE . ' within "' . date('Y-m-d', $from->getTimestamp()) . ' ' . date('Y-m-d', $to->getTimestamp()) . '")'; |
|
2447 |
break; |
|
2448 |
default: |
|
2449 |
$from->sub(new DateInterval('P' . $date . 'M')); |
|
2450 |
$query .= ' and (' . self :: PUBLICATION_DATE . ' within "' . date('Y-m-d', $from->getTimestamp()) . ' ' . date('Y-m-d', $to->getTimestamp()) . '")'; |
|
2451 |
} |
|
2452 |
$field = self :: PUBLICATION_ACCESS_MODE; |
|
2453 |
$query .= ($accessModes == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($accessMode) use ($field) { |
|
2454 |
return '(' . $field . ' exact "' . $accessMode . '")'; |
|
2455 |
}, $accessModes)) . ')'); |
|
2456 |
$field = self :: RESULT_HOSTING_DATASOURCE; |
|
2457 |
$query .= ($datasources == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($datasource) use ($field) { |
|
2458 |
return '(' . $field . ' exact "' . $datasource . '")'; |
|
2459 |
}, $datasources)) . ')'); |
|
2460 |
$query .= ($type == NULL) ? '' : (' and (' . self :: PUBLICATION_TYPE . ' exact "' . $type . '")'); |
|
2461 |
$query .= ($language == NULL) ? '' : (' and (' . self :: PUBLICATION_LANGUAGE . ' exact "' . $language . '")'); |
|
2462 |
//$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")'); |
|
2463 |
if($funder != NULL && (strpos($funder, ',') !== FALSE)){ |
|
2464 |
$temp=''; |
|
2465 |
foreach(explode(',',$funder) as $id){ |
|
2466 |
if(!empty($id)){ |
|
2467 |
$temp.='(' . self :: PUBLICATION_FUNDER . ' exact "' . $id . '") and'; |
|
2468 |
} |
|
2544 | 2469 |
|
2470 |
} |
|
2471 |
$query .= (' and (' . substr($temp, 0, -3). ')'); |
|
2472 |
}else{ |
|
2473 |
$query .= ($funder == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDER . ' exact "' . $funder . '")'); |
|
2474 |
} |
|
2475 |
$query .= ($fundingStream == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM . ' exact "' . $fundingStream . '")'); |
|
2476 |
$query .= ($scientificArea == NULL) ? '' : (' and (' . self :: PUBLICATION_SCIENTIFIC_AREA . ' exact "' . $scientificArea . '")'); |
|
2477 |
$query .= ($fundingStreamLevel2 == NULL) ? '' : (' and (' . self :: PUBLICATION_FUNDING_STREAM_LEVEL2 . ' exact "' . $fundingStreamLevel2 . '")'); |
|
2478 |
$query .= ($year == NULL) ? '' : (' and (' . self :: PUBLICATION_YEAR . ' exact "' . $year . '")'); |
|
2479 |
$query .= ($accessMode == NULL) ? '' : (' and (' . self :: PUBLICATION_ACCESS_MODE . ' exact "' . $accessMode . '")'); |
|
2480 |
$query .= ($datasource == NULL) ? '' : (' and (' . self :: RESULT_HOSTING_DATASOURCE . ' exact "' . $datasource . '")'); |
|
2481 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
2482 |
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=results_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&fields=' . self :: PUBLICATION_TYPE . '&fields=' . self :: PUBLICATION_LANGUAGE . $this->_getFundingFields($funder, $fundingStream, $scientificArea, $fundingStreamLevel2, self::PUBLICATION). '&fields=' . self :: PUBLICATION_YEAR . '&fields=' . self :: PUBLICATION_ACCESS_MODE . '&fields=' . self :: RESULT_HOSTING_DATASOURCE . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
2483 |
throw new Exception('no HTTP response'); |
|
2484 |
if ($response->code != self :: HTTP_OK) |
|
2485 |
throw new Exception('HTTP response code ' . $response->code); |
|
2486 |
$document = new DOMDocument(); |
|
2487 |
$document->recover = TRUE; |
|
2488 |
if ($document->loadXML($response->body) == FALSE) |
|
2489 |
throw new Exception('invalid XML response'); |
|
2490 |
$xpath = new DOMXPath($document); |
|
2491 |
$result = new JObject(); |
|
2492 |
$result->totalDatasets = $this->parseTotalResults($xpath); |
|
2493 |
$result->datasets = $this->parsePublications($xpath); |
|
2494 |
$result->statistics =$this->createStatisticsForPublications($xpath,'Filter'); |
|
2495 |
$result->statistics=self ::_pruningStatisticsForFunders($result->statistics,$funder, $fundingStream, $scientificArea, $fundingStreamLevel2,"Filter"); |
|
2496 |
//$this->createStatistics($xpath, array('typeFilter', 'language', 'funderFilter', 'fundingStreamFilter', 'scientificAreaFilter', 'yearFilter', 'accessModeFilter', 'datasourceFilter'), array('DOCUMENT_TYPE', 'DOCUMENT_LANGUAGE', 'FUNDER', 'FUNDING_STREAM', 'SCIENTIFIC_AREA', 'PUBLICATION_YEAR', 'ACCESS_MODE', 'DATASOURCE'), array('NO_DOCUMENT_TYPE_STATISTICS_FOUND', 'NO_DOCUMENT_LANGUAGE_STATISTICS_FOUND', 'NO_FUNDER_STATISTICS_FOUND', 'NO_FUNDING_STREAM_STATISTICS_FOUND', 'NO_SCIENTIFIC_AREA_STATISTICS_FOUND', 'NO_PUBLICATION_YEAR_STATISTICS_FOUND', 'NO_ACCESS_MODE_STATISTICS_FOUND', 'NO_DATASOURCE_STATISTICS_FOUND'), array(self :: PUBLICATION_TYPE, self :: PUBLICATION_LANGUAGE, self :: PUBLICATION_FUNDER, self :: PUBLICATION_FUNDING_STREAM, self :: PUBLICATION_SCIENTIFIC_AREA, self :: PUBLICATION_YEAR, self :: PUBLICATION_ACCESS_MODE, self :: RESULT_HOSTING_DATASOURCE)); |
|
2497 |
JLog :: add('Advanced search retrieved ' . count($result->publications) . ' publications in ' . (microtime(TRUE) - $time) . ' s (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], types: [' . implode(', ', $types) . '], languages: [' . implode(', ', $languages) . '], funders: [' . implode(', ', $funders) . '], funding streams: [' . implode(', ', $fundingStreams) . '], scientific areas: [' . implode(', ', $scientificAreas) . '], date: ' . $date . ', from month: ' . $fromMonth . ', from year: ' . $fromYear . ', to month: ' . $toMonth . ', to year: ' . $toYear . ', access modes: [' . implode(', ', $accessModes) . '], datasources: [' . implode(', ', $datasources) . '], type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
2498 |
return $result; |
|
2499 |
} catch (Exception $e) { |
|
2500 |
JLog :: add('Error performing publication advanced search (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], types: [' . implode(', ', $types) . '], languages: [' . implode(', ', $languages) . '], funders: [' . implode(', ', $funders) . '], funding streams: [' . implode(', ', $fundingStreams) . '], scientific areas: [' . implode(', ', $scientificAreas) . '], date: ' . $date . ', from month: ' . $fromMonth . ', from year: ' . $fromYear . ', to month: ' . $toMonth . ', to year: ' . $toYear . ', access modes: [' . implode(', ', $accessModes) . '], datasources: [' . implode(', ', $datasources) . '], type: ' . (($type == NULL) ? 'null' : $type) . ', language: ' . (($language == NULL) ? 'null' : $language) . ', funder: ' . (($funder == NULL) ? 'null' : $funder) . ', funding stream: ' . (($fundingStream == NULL) ? 'null' : $fundingStream) . ', scientific area: ' . (($scientificArea == NULL) ? 'null' : $scientificArea) . ', year: ' . (($year == NULL) ? 'null' : $year) . ', access mode: ' . (($accessMode == NULL) ? 'null' : $accessMode) . ', datasource: ' . (($datasource == NULL) ? 'null' : $datasource) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
2501 |
return NULL; |
|
2502 |
} |
|
2503 |
} |
|
2504 |
|
|
2545 | 2505 |
// Perform an advanced search for projects. |
2546 | 2506 |
// $keywords the keywords to search for (array) |
2547 | 2507 |
// $fields the fields to match keywords with (array - possible values are ACRONYM, TITLE and KEYWORDS) |
... | ... | |
2686 | 2646 |
return NULL; |
2687 | 2647 |
} |
2688 | 2648 |
} |
2689 |
|
|
2690 |
// Perform an advanced search for people. |
|
2691 |
// $keywords the keywords to search for (array) |
|
2692 |
// $fields the fields to match keywords with (array - possible values are LAST_NAME, FIRST_NAME and FULL_NAME) |
|
2693 |
// $constraints the constraints to apply to keywords (array - possible values are ALL and ANY) |
|
2694 |
// $countries the IDs of the countries to search for |
|
2695 |
// $country the ID of the coutnry to use as filter or NULL for no country filtering |
|
2696 |
// $page the page of results to retrieve |
|
2697 |
// $size the size of the page of results to retrieve |
|
2698 |
// $locale the locale to use |
|
2699 |
// return a result (object) containing people and statistics |
|
2700 |
private function _advancedSearchPeople($keywords, $fields, $constraints, $countries, $country, $page, $size, $locale) { |
|
2701 |
try { |
|
2702 |
$time = microtime(TRUE); |
|
2703 |
$query = self :: PERSON_QUERY; |
|
2704 |
for ($i = 0; ($i < count($keywords)) && ($i < count($fields)) && ($i < count($constraints)); $i++) { |
|
2705 |
$tokens = preg_split('/\s/', $keywords[$i], NULL, PREG_SPLIT_NO_EMPTY); |
|
2706 |
switch ($constraints[$i]) { |
|
2707 |
case OpenAireViewAdvancedSearchPeople :: ALL: |
|
2708 |
$operator = ' and '; |
|
2709 |
break; |
|
2710 |
case OpenAireViewAdvancedSearchPeople :: ANY: |
|
2711 |
$operator = ' or '; |
|
2712 |
break; |
|
2713 |
default: |
|
2714 |
$operator = NULL; |
|
2715 |
} |
|
2716 |
switch ($fields[$i]) { |
|
2717 |
case OpenAireViewAdvancedSearchPeople :: LAST_NAME: |
|
2718 |
$field = self :: PERSON_LAST_NAME; |
|
2719 |
break; |
|
2720 |
case OpenAireViewAdvancedSearchPeople :: FIRST_NAME: |
|
2721 |
$field = self :: PERSON_FIRST_NAME; |
|
2722 |
break; |
|
2723 |
case OpenAireViewAdvancedSearchPeople :: FULL_NAME: |
|
2724 |
$field = self :: PERSON_FULL_NAME; |
|
2725 |
break; |
|
2726 |
default: |
|
2727 |
$field = NULL; |
|
2728 |
} |
|
2729 |
$query .= ($tokens == NULL) ? '' : (' and (' . implode($operator, array_map(function ($keyword) use ($field) { |
|
2730 |
return '(' . (($field == NULL) ? '' : ($field . ' = ')) . '"' . str_replace('"', '\\"', $keyword) . '")'; |
|
2731 |
}, $tokens)) . ')'); |
|
2732 |
} |
|
2733 |
// $field = self :: PERSON_COUNTRY; |
|
2734 |
// $query .= ($countries == NULL) ? '' : (' and (' . implode(' or ', array_map(function ($country) use ($field) { |
|
2735 |
// return '(' . $field . ' exact "' . $country . '")'; |
|
2736 |
// }, $countries)) . ')'); |
|
2737 |
// $query .= ($country == NULL) ? '' : (' and (' . self :: PERSON_COUNTRY . ' exact "' . $country . '")'); |
|
2738 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
|
2739 |
if (($response = $this->performGet('search?action=searchNrefine&sTransformer=persons_openaire&rTransformer=results_openaire_browse&query=' . urlencode($query) . '&page=' . $page . '&size=' . $size . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
|
2740 |
throw new Exception('no HTTP response'); |
|
2741 |
if ($response->code != self :: HTTP_OK) |
|
2742 |
throw new Exception('HTTP response code ' . $response->code); |
|
2743 |
$document = new DOMDocument(); |
|
2744 |
$document->recover = TRUE; |
|
2745 |
if ($document->loadXML($response->body) == FALSE) |
|
2746 |
throw new Exception('invalid XML response'); |
|
2747 |
$xpath = new DOMXPath($document); |
|
2748 |
$result = new JObject(); |
|
2749 |
$result->totalPeople = $this->parseTotalResults($xpath); |
|
2750 |
$result->people = $this->parsePeople($xpath); |
|
2751 |
$result->statistics = NULL; //$this->createStatistics($xpath, array('countryFilter'), array('COUNTRY'), array('NO_COUNTRY_STATISTICS_FOUND'), array(self :: PERSON_COUNTRY)); |
|
2752 |
JLog :: add('Advanced search retrieved ' . count($result->people) . ' people in ' . (microtime(TRUE) - $time) . ' s (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], countries: [' . implode(', ', $countries) . '], country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . ')', JLog :: INFO, self :: LOG); |
|
2753 |
return $result; |
|
2754 |
} catch (Exception $e) { |
|
2755 |
JLog :: add('Error performing datasource advanced search (keywords: [' . implode(', ', $keywords) . '], fields: [' . implode(', ', $fields) . '], constraints: [' . implode(', ', $constraints) . '], countries: [' . implode(', ', $countries) . '], country: ' . (($country == NULL) ? 'null' : $country) . ', page: ' . $page . ', size: ' . $size . ', locale: ' . $locale . '): ' . $e->getMessage(), JLog :: ERROR, self :: LOG); |
|
2756 |
return NULL; |
|
2757 |
} |
|
2758 |
} |
|
2759 |
|
|
2649 |
|
|
2760 | 2650 |
// Perform an advanced search for organizations. |
2761 | 2651 |
// $keywords the keywords to search for (array) |
2762 | 2652 |
// $fields the fields to match keywords with (array - possible values are NAME and SHORT_NAME) |
... | ... | |
2776 | 2666 |
for ($i = 0; ($i < count($keywords)) && ($i < count($fields)) && ($i < count($constraints)); $i++) { |
2777 | 2667 |
$tokens = preg_split('/\s/', $keywords[$i], NULL, PREG_SPLIT_NO_EMPTY); |
2778 | 2668 |
switch ($constraints[$i]) { |
2779 |
case OpenAireViewAdvancedSearchPeople :: ALL:
|
|
2669 |
case self :: ALL:
|
|
2780 | 2670 |
$operator = ' and '; |
2781 | 2671 |
break; |
2782 |
case OpenAireViewAdvancedSearchPeople :: ANY:
|
|
2672 |
case self :: ANY:
|
|
2783 | 2673 |
$operator = ' or '; |
2784 | 2674 |
break; |
2785 | 2675 |
default: |
... | ... | |
3156 | 3046 |
// $id the project grant agreement code |
3157 | 3047 |
// $locale the locale to use |
3158 | 3048 |
// return projects or NULL if no such project exists |
3159 |
private function _getProjectByCodeId($id, $locale) { |
|
3049 |
private function _getProjectByCodeId($id, $funder, $locale) {
|
|
3160 | 3050 |
try { |
3161 | 3051 |
$time = microtime(TRUE); |
3162 | 3052 |
$query = self :: PROJECT_QUERY . ' and '; |
3163 | 3053 |
// (oaftype=project) and (projectcode_nt exact 731011) |
3164 |
$query.=' ( projectcode_nt exact "' . $id . '")'; |
|
3165 |
|
|
3054 |
$query.=' ( projectcode_nt exact "' . $id . '") and '; |
|
3055 |
$query.=' ( funderid exact "' . $funder . '")'; |
|
3056 |
//and (funderid exact "ec__________::EC")' |
|
3166 | 3057 |
JLog :: add('Generated query is \'' . $query . '\'', JLog :: INFO, self :: LOG); |
3167 | 3058 |
if (($response = $this->performGet('search?action=search&sTransformer=projects_openaire&query=' . urlencode($query) . '&locale=' . str_replace('-', '_', $locale))) == NULL) |
3168 | 3059 |
throw new Exception('no HTTP response'); |
... | ... | |
3646 | 3537 |
foreach ($datasourceNodes as $datasourceNode) { |
3647 | 3538 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
3648 | 3539 |
throw new Exception('error parsing results'); |
3649 |
if (($accessModeNodes = $xpath->query('./field[@name = "licenceid"]/@value_original', $datasourceNode)) == FALSE)
|
|
3540 |
if (($accessModeNodes = $xpath->query('./field[@name = "accessrightid"]/@value', $datasourceNode)) == FALSE)
|
|
3650 | 3541 |
throw new Exception('error parsing results'); |
3651 | 3542 |
$datasource = new JObject(); |
3652 | 3543 |
$datasource->url = (($urlNode = $urlNodes->item(0)) == NULL) ? NULL : trim($urlNode->nodeValue); |
... | ... | |
3736 | 3627 |
throw new Exception('error parsing publication'); |
3737 | 3628 |
if (($pidNodes = $xpath->query('./field[@name = "pid"]', $resultNode)) == FALSE) |
3738 | 3629 |
throw new Exception('error parsing publication'); |
3739 |
if (($accessModeNodes = $xpath->query('./field[@name = "bestlicense"]/@value', $resultNode)) == FALSE)
|
|
3630 |
if (($accessModeNodes = $xpath->query('./field[@name = "bestaccessright"]/@value', $resultNode)) == FALSE)
|
|
3740 | 3631 |
throw new Exception('error parsing publication'); |
3741 | 3632 |
$publication = new JObject(); |
3742 | 3633 |
$publication->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
... | ... | |
3811 | 3702 |
foreach ($datasourceNodes as $datasourceNode) { |
3812 | 3703 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
3813 | 3704 |
throw new Exception('error parsing publications'); |
3814 |
if (($accessModeNodes = $xpath->query('./field[@name = "licenceid"]/@value_original', $datasourceNode)) == FALSE)
|
|
3705 |
if (($accessModeNodes = $xpath->query('./field[@name = "accessrightid"]/@value', $datasourceNode)) == FALSE)
|
|
3815 | 3706 |
throw new Exception('error parsing publications'); |
3816 | 3707 |
$datasource = new JObject(); |
3817 | 3708 |
$datasource->url = (($urlNode = $urlNodes->item(0)) == NULL) ? NULL : trim($urlNode->nodeValue); |
... | ... | |
3923 | 3814 |
foreach ($datasourceNodes as $datasourceNode) { |
3924 | 3815 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
3925 | 3816 |
throw new Exception('error parsing datasets'); |
3926 |
if (($accessModeNodes = $xpath->query('./field[@name = "licenceid"]/@value_original', $datasourceNode)) == FALSE)
|
|
3817 |
if (($accessModeNodes = $xpath->query('./field[@name = "accessrightid"]/@value', $datasourceNode)) == FALSE)
|
|
3927 | 3818 |
throw new Exception('error parsing datasets'); |
3928 | 3819 |
$datasource = new JObject(); |
3929 | 3820 |
$datasource->url = (($urlNode = $urlNodes->item(0)) == NULL) ? NULL : trim($urlNode->nodeValue); |
... | ... | |
4055 | 3946 |
} |
4056 | 3947 |
return $projects; |
4057 | 3948 |
} |
3949 |
// |
|
3950 |
// // Parse people from a search service XML response. |
|
3951 |
// // xpath the DOMXPath to parse |
|
3952 |
// // return people (array) |
|
3953 |
// private function parsePeople($xpath) { |
|
3954 |
// if (($resultNodes = $xpath->query('/response/results/record')) == FALSE) |
|
3955 |
// throw new Exception('error parsing people'); |
|
3956 |
// $people = array(); |
|
3957 |
// foreach ($resultNodes as $resultNode) { |
|
3958 |
// if (($idNodes = $xpath->query('./field[@name = "personId"]/@value', $resultNode)) == FALSE) |
|
3959 |
// throw new Exception('error parsing people'); |
|
3960 |
// if (($lastNameNodes = $xpath->query('./field[@name = "secondnames"]/@value', $resultNode)) == FALSE) |
|
3961 |
// throw new Exception('error parsing people'); |
|
3962 |
// if (($firstNameNodes = $xpath->query('./field[@name = "firstname"]/@value', $resultNode)) == FALSE) |
|
3963 |
// throw new Exception('error parsing people'); |
|
3964 |
// if (($fullNameNodes = $xpath->query('./field[@name = "fullname"]/@value', $resultNode)) == FALSE) |
|
3965 |
// throw new Exception('error parsing people'); |
|
3966 |
// if (($countryNodes = $xpath->query('./field[@name = "nationalityid"]/@value', $resultNode)) == FALSE) |
|
3967 |
// throw new Exception('error parsing people'); |
|
3968 |
// $person = new JObject(); |
|
3969 |
// $person->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
|
3970 |
// $person->lastName = (($lastNameNode = $lastNameNodes->item(0)) == NULL) ? NULL : trim($lastNameNode->nodeValue); |
|
3971 |
// $person->firstName = (($firstNameNode = $firstNameNodes->item(0)) == NULL) ? NULL : trim($firstNameNode->nodeValue); |
|
3972 |
// $person->fullName = (($fullNameNode = $fullNameNodes->item(0)) == NULL) ? NULL : trim($fullNameNode->nodeValue); |
|
3973 |
// $person->country = (($countryNode = $countryNodes->item(0)) == NULL) ? NULL : trim($countryNode->nodeValue); |
|
3974 |
// if (($person->id != NULL) || ($person->lastName != NULL) || ($person->firstName != NULL) || ($person->fullName != NULL) || ($person->country != NULL)) |
|
3975 |
// $people[] = $person; |
|
3976 |
// } |
|
3977 |
// return $people; |
|
3978 |
// } |
|
4058 | 3979 |
|
4059 |
// Parse people from a search service XML response. |
|
4060 |
// xpath the DOMXPath to parse |
|
4061 |
// return people (array) |
|
4062 |
private function parsePeople($xpath) { |
|
4063 |
if (($resultNodes = $xpath->query('/response/results/record')) == FALSE) |
|
4064 |
throw new Exception('error parsing people'); |
|
4065 |
$people = array(); |
|
4066 |
foreach ($resultNodes as $resultNode) { |
|
4067 |
if (($idNodes = $xpath->query('./field[@name = "personId"]/@value', $resultNode)) == FALSE) |
|
4068 |
throw new Exception('error parsing people'); |
|
4069 |
if (($lastNameNodes = $xpath->query('./field[@name = "secondnames"]/@value', $resultNode)) == FALSE) |
|
4070 |
throw new Exception('error parsing people'); |
|
4071 |
if (($firstNameNodes = $xpath->query('./field[@name = "firstname"]/@value', $resultNode)) == FALSE) |
|
4072 |
throw new Exception('error parsing people'); |
|
4073 |
if (($fullNameNodes = $xpath->query('./field[@name = "fullname"]/@value', $resultNode)) == FALSE) |
|
4074 |
throw new Exception('error parsing people'); |
|
4075 |
if (($countryNodes = $xpath->query('./field[@name = "nationalityid"]/@value', $resultNode)) == FALSE) |
|
4076 |
throw new Exception('error parsing people'); |
|
4077 |
$person = new JObject(); |
|
4078 |
$person->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
|
4079 |
$person->lastName = (($lastNameNode = $lastNameNodes->item(0)) == NULL) ? NULL : trim($lastNameNode->nodeValue); |
|
4080 |
$person->firstName = (($firstNameNode = $firstNameNodes->item(0)) == NULL) ? NULL : trim($firstNameNode->nodeValue); |
|
4081 |
$person->fullName = (($fullNameNode = $fullNameNodes->item(0)) == NULL) ? NULL : trim($fullNameNode->nodeValue); |
|
4082 |
$person->country = (($countryNode = $countryNodes->item(0)) == NULL) ? NULL : trim($countryNode->nodeValue); |
|
4083 |
if (($person->id != NULL) || ($person->lastName != NULL) || ($person->firstName != NULL) || ($person->fullName != NULL) || ($person->country != NULL)) |
|
4084 |
$people[] = $person; |
|
4085 |
} |
|
4086 |
return $people; |
|
4087 |
} |
|
4088 |
|
|
4089 | 3980 |
// Parse organizations from a search service XML response. |
4090 | 3981 |
// xpath the DOMXPath to parse |
4091 | 3982 |
// return organizations (array) |
... | ... | |
4407 | 4298 |
throw new Exception('error parsing publication'); |
4408 | 4299 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
4409 | 4300 |
throw new Exception('error parsing publication'); |
4410 |
if (($accessModeNodes = $xpath->query('./field[@name = "licenceid"]/@value_original', $datasourceNode)) == FALSE)
|
|
4301 |
if (($accessModeNodes = $xpath->query('./field[@name = "accessrightid"]/@value', $datasourceNode)) == FALSE)
|
|
4411 | 4302 |
throw new Exception('error parsing publication'); |
4412 | 4303 |
if (($typeNameNodes = $xpath->query('./field[@name = "typename"]/@value', $datasourceNode)) == FALSE) |
4413 | 4304 |
throw new Exception('error parsing publication'); |
... | ... | |
4894 | 4785 |
throw new Exception('error parsing dataset'); |
4895 | 4786 |
if (($urlNodes = $xpath->query('./field[@name = "url"]/@value', $datasourceNode)) == FALSE) |
4896 | 4787 |
throw new Exception('error parsing dataset'); |
4897 |
if (($accessModeNodes = $xpath->query('./field[@name = "licenceid"]/@value_original', $datasourceNode)) == FALSE)
|
|
4788 |
if (($accessModeNodes = $xpath->query('./field[@name = "accessrightid"]/@value', $datasourceNode)) == FALSE)
|
|
4898 | 4789 |
throw new Exception('error parsing dataset'); |
4899 | 4790 |
$datasource = new JObject(); |
4900 | 4791 |
$datasource->id = (($idNode = $idNodes->item(0)) == NULL) ? NULL : trim($idNode->nodeValue); |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/router.php | ||
---|---|---|
25 | 25 |
const ORGANIZATION = 'organization'; |
26 | 26 |
const ORGANIZATIONS = 'organizations'; |
27 | 27 |
const PARTICIPATE = 'participate'; |
28 |
const PEOPLE = 'people'; |
|
29 |
const PERSON = 'person'; |
|
30 | 28 |
const PROJECT = 'project'; |
31 | 29 |
const PROJECTS = 'projects'; |
32 | 30 |
const PROVIDERS = 'providers'; |
... | ... | |
59 | 57 |
unset($query['Itemid']); |
60 | 58 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
61 | 59 |
return $segments; |
62 |
case 'advancedsearchpeople':
|
|
60 |
case 'advancedsearchprojects':
|
|
63 | 61 |
$segments[] = SEARCH; |
64 | 62 |
$segments[] = ADVANCED; |
65 |
$segments[] = PEOPLE;
|
|
63 |
$segments[] = PROJECTS;
|
|
66 | 64 |
unset($query['option']); |
67 | 65 |
unset($query['view']); |
68 | 66 |
unset($query['Itemid']); |
69 | 67 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
70 | 68 |
return $segments; |
71 |
case 'advancedsearchprojects':
|
|
69 |
case 'advancedsearchpublications':
|
|
72 | 70 |
$segments[] = SEARCH; |
73 | 71 |
$segments[] = ADVANCED; |
74 |
$segments[] = PROJECTS;
|
|
72 |
$segments[] = PUBLICATIONS;
|
|
75 | 73 |
unset($query['option']); |
76 | 74 |
unset($query['view']); |
77 | 75 |
unset($query['Itemid']); |
78 | 76 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
79 | 77 |
return $segments; |
80 |
case 'advancedsearchpublications':
|
|
78 |
case 'advancedsearchdatasets':
|
|
81 | 79 |
$segments[] = SEARCH; |
82 | 80 |
$segments[] = ADVANCED; |
83 |
$segments[] = PUBLICATIONS;
|
|
81 |
$segments[] = DATASETS;
|
|
84 | 82 |
unset($query['option']); |
85 | 83 |
unset($query['view']); |
86 | 84 |
unset($query['Itemid']); |
... | ... | |
128 | 126 |
unset($query['Itemid']); |
129 | 127 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
130 | 128 |
return $segments; |
131 |
case 'browsepeople': |
|
132 |
$segments[] = SEARCH; |
|
133 |
$segments[] = BROWSE; |
|
134 |
$segments[] = PEOPLE; |
|
135 |
unset($query['option']); |
|
136 |
unset($query['view']); |
|
137 |
unset($query['Itemid']); |
|
138 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
|
139 |
return $segments; |
|
140 | 129 |
case 'browseprojects': |
141 | 130 |
$segments[] = SEARCH; |
142 | 131 |
$segments[] = BROWSE; |
... | ... | |
259 | 248 |
unset($query['Itemid']); |
260 | 249 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
261 | 250 |
return $segments; |
262 |
case 'person': |
|
263 |
$segments[] = SEARCH; |
|
264 |
$segments[] = PERSON; |
|
265 |
unset($query['option']); |
|
266 |
unset($query['view']); |
|
267 |
unset($query['Itemid']); |
|
268 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
|
269 |
return $segments; |
|
270 | 251 |
case 'printpublication': // print publication is a raw view |
271 | 252 |
//JLog :: add('Ignoring route ' . $initialQuery . '', JLog :: INFO, LOG); |
272 | 253 |
return $segments; |
... | ... | |
336 | 317 |
case 'searchorganizationsraw': // search organizations raw is a raw view |
337 | 318 |
//JLog :: add('Ignoring route ' . $initialQuery . '', JLog :: INFO, LOG); |
338 | 319 |
return $segments; |
339 |
case 'searchpeople': |
|
340 |
$segments[] = SEARCH; |
|
341 |
$segments[] = FIND; |
|
342 |
$segments[] = PEOPLE; |
|
343 |
unset($query['option']); |
|
344 |
unset($query['view']); |
|
345 |
unset($query['Itemid']); |
|
346 |
//JLog :: add('Built route ' . $initialQuery . ' into ' . print_r($segments, TRUE) . '', JLog :: INFO, LOG); |
|
347 |
return $segments; |
|
348 |
case 'searchpeopleraw': // search people raw is a raw view |
|
349 |
//JLog :: add('Ignoring route ' . $initialQuery . '', JLog :: INFO, LOG); |
|
350 |
return $segments; |
|
351 | 320 |
case 'searchprojects': |
352 | 321 |
$segments[] = SEARCH; |
353 | 322 |
$segments[] = FIND; |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/controller.php | ||
---|---|---|
18 | 18 |
$piwik = $this -> getModel('piwik'); |
19 | 19 |
$this -> getView('advancedsearchdatasources', 'html') -> setModel($search); |
20 | 20 |
$this -> getView('advancedsearchorganizations', 'html') -> setModel($search); |
21 |
$this -> getView('advancedsearchpeople', 'html') -> setModel($search); |
|
22 | 21 |
$this -> getView('advancedsearchprojects', 'html') -> setModel($search); |
23 | 22 |
$this -> getView('advancedsearchpublications', 'html') -> setModel($search); |
23 |
$this -> getView('advancedsearchdatasets', 'html') -> setModel($search); |
|
24 | 24 |
$this -> getView('alerts', 'html') -> setModel($alerts); |
25 | 25 |
$this -> getView('alerts', 'html') -> setModel($piwik); |
26 | 26 |
$this -> getView('article', 'html') -> setModel($search); |
27 | 27 |
$this -> getView('browsedatasets', 'html') -> setModel($search); |
28 | 28 |
$this -> getView('browsedatasources', 'html') -> setModel($search); |
29 | 29 |
$this -> getView('browseorganizations', 'html') -> setModel($search); |
30 |
$this -> getView('browsepeople', 'html') -> setModel($search); |
|
31 | 30 |
$this -> getView('browseprojects', 'html') -> setModel($search); |
32 | 31 |
$this -> getView('browsepublications', 'html') -> setModel($search); |
33 | 32 |
$this -> getView('chart', 'html') -> setModel($statistics); |
... | ... | |
61 | 60 |
$this -> getView('invenio', 'html') -> setModel($redirect); |
62 | 61 |
$this -> getView('invenio', 'html') -> setModel($piwik); |
63 | 62 |
$this -> getView('organization', 'html') -> setModel($search); |
64 |
$this -> getView('person', 'html') -> setModel($search); |
|
65 | 63 |
$this -> getView('printpublication', 'raw') -> setModel($search); |
66 | 64 |
$this -> getView('printpublication', 'raw') -> setModel($piwik); |
67 | 65 |
$this -> getView('project', 'html') -> setModel($search); |
... | ... | |
77 | 75 |
$this -> getView('searchdatasourcesraw', 'raw') -> setModel($search); |
78 | 76 |
$this -> getView('searchorganizations', 'html') -> setModel($search); |
79 | 77 |
$this -> getView('searchorganizationsraw', 'raw') -> setModel($search); |
80 |
$this -> getView('searchpeople', 'html') -> setModel($search); |
|
81 |
$this -> getView('searchpeopleraw', 'raw') -> setModel($search); |
|
82 | 78 |
$this -> getView('searchprojects', 'html') -> setModel($search); |
83 | 79 |
$this -> getView('searchprojectsraw', 'raw') -> setModel($search); |
84 | 80 |
$this -> getView('searchpublications', 'html') -> setModel($search); |
modules/uoa-joomla/trunk/joomla-3.4/com_openaire/site/js/search.js | ||
---|---|---|
13 | 13 |
document.getElementById('searchform').action = openaireSearchDatasetsUrl+keyword; //will set it |
14 | 14 |
}else if(searchType==="proj"){ |
Also available in: Unified diff
Remove person entities, change query, change bestlicense field, remove unidentified from stats, show categorized subjects when no other subjects are available