getTag(); $model = $this -> getModel(self :: MODEL); $this -> statistics = $model -> getPublicationStatistics($locale); $this -> minYear = ($this -> statistics['year'] -> data == NULL) ? date('Y') : min(array_keys($this -> statistics['year'] -> data)); $this -> maxYear = ($this -> statistics['year'] -> data == NULL) ? date('Y') : max(array_keys($this -> statistics['year'] -> data)); $input = JFactory :: getApplication() -> input; $this -> itemId = JRequest :: getUInt('Itemid', 0); $this -> keywords = $this -> getParameter('keyword'); $this -> fields = $this -> getParameter('field'); $this -> constraints = $this -> getParameter('constraint'); $this -> types = $this -> getParameter('type'); $this -> languages = $this -> getParameter('languageSearch'); $this -> funders = $this -> getParameter('funder'); $this -> fundingStreams = $this -> getParameter('fundingStream'); $this -> scientificAreas = $this -> getParameter('scientificArea'); $this -> date = JRequest :: getInt('date', -1); $this -> fromMonth = JRequest :: getUInt('fromMonth', self :: DEFAULT_FROM_MONTH); $this -> fromYear = JRequest :: getUInt('fromYear', $this -> minYear); $this -> toMonth = JRequest :: getUInt('toMonth', self :: DEFAULT_TO_MONTH); $this -> toYear = JRequest :: getUInt('toYear', $this -> maxYear); $this -> accessModes = $this -> getParameter('accessMode'); $this -> datasources = $this -> getParameter('datasource'); $this -> filters = array(); $type = JRequest :: getString('typeFilter'); if ($type != NULL) { $this -> filters['typeFilter'] = new JObject(); $this -> filters['typeFilter'] -> name = 'typeFilter'; $this -> filters['typeFilter'] -> value = $type; } $language = JRequest :: getString('languageFilter'); if ($language != NULL) { $this -> filters['languageFilter'] = new JObject(); $this -> filters['languageFilter'] -> name = 'languageFilter'; $this -> filters['languageFilter'] -> value = $language; } $funder = JRequest :: getString('funderFilter'); if ($funder != NULL) { $this -> filters['funderFilter'] = new JObject(); $this -> filters['funderFilter'] -> name = 'funderFilter'; $this -> filters['funderFilter'] -> value = $funder; } $fundingStream = JRequest :: getString('fundingStreamFilter'); if ($fundingStream != NULL) { $this -> filters['fundingStreamFilter'] = new JObject(); $this -> filters['fundingStreamFilter'] -> name = 'fundingStreamFilter'; $this -> filters['fundingStreamFilter'] -> value = $fundingStream; } $scientificArea = JRequest :: getString('scientificAreaFilter'); if ($scientificArea != NULL) { $this -> filters['scientificAreaFilter'] = new JObject(); $this -> filters['scientificAreaFilter'] -> name = 'scientificAreaFilter'; $this -> filters['scientificAreaFilter'] -> value = $scientificArea; } $year = JRequest :: getString('yearFilter'); if ($year != NULL) { $this -> filters['yearFilter'] = new JObject(); $this -> filters['yearFilter'] -> name = 'yearFilter'; $this -> filters['yearFilter'] -> value = $year; } $accessMode = JRequest :: getString('accessModeFilter'); if ($accessMode != NULL) { $this -> filters['accessModeFilter'] = new JObject(); $this -> filters['accessModeFilter'] -> name = 'accessModeFilter'; $this -> filters['accessModeFilter'] -> value = $accessMode; } $datasource = JRequest :: getString('datasourceFilter'); if ($datasource != NULL) { $this -> filters['datasourceFilter'] = new JObject(); $this -> filters['datasourceFilter'] -> name = 'datasourceFilter'; $this -> filters['datasourceFilter'] -> value = $datasource; } $this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); $this -> size = JRequest :: getUInt('size', self :: MIN_SIZE); if ((($this -> keywords != NULL) && ($this -> fields != NULL) && ($this -> constraints != NULL)) || ($this -> types != NULL) || ($this -> languages != NULL) || ($this -> funders != NULL) || ($this -> fundingStreams != NULL) || ($this -> scientificAreas != NULL) || ($this -> date != -1) || ($this -> accessModes != NULL) || ($this -> datasources != NULL)) { JView :: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('advancedSearchPublications', 'keywords=' . urlencode(implode(',', $this -> keywords)) . '&fields=' . urlencode(implode(',', $this -> fields)) . '&constraints=' . urlencode(implode(',', $this -> constraints)) . '&types=' . urlencode(implode(',', $this -> types)) . '&languages=' . urlencode(implode($this -> languages)) . '&funders=' . urlencode(implode(',', $this -> funders)) . '&fundingStreams=' . urlencode(implode(',', $this -> fundingStreams)) . '&scientificAreas=' . urlencode(implode(',', $this -> scientificAreas)) . '&date=' . urlencode($this -> date) . '&fromMonth=' . urlencode($this -> fromMonth) . '&fromYear=' . urlencode($this -> fromYear) . '&toMonth=' . urlencode($this -> toMonth) . '&toYear=' . urlencode($this -> toYear) . '&accessModes=' . urlencode(implode(',', $this -> accessModes)) . '&datasources=' . urlencode(implode($this -> datasources)) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&scientificArea=' . urlencode($scientificArea) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); $this -> result = $model -> advancedSearchPublications($this -> keywords, $this -> fields, $this -> constraints, $this -> types, $this -> languages, $this -> funders, $this -> fundingStreams, $this -> scientificAreas, $this -> date, $this -> fromMonth, $this -> fromYear, $this -> toMonth, $this -> toYear, $this -> accessModes, $this -> datasources, $type, $language, $funder, $fundingStream, $scientificArea, $year, $accessMode, $datasource, $this -> page, $this -> size, $locale); $this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPublications / $this -> size); if ($this -> totalPages == NULL) $this -> totalPages = 1; $this -> pagingStart = $this -> page; $this -> pagingEnd = $this -> page; while (($this -> pagingEnd - $this -> pagingStart < self :: MAX_PAGES - 1) && (($this -> pagingStart != 1) || ($this -> pagingEnd != $this -> totalPages))) { if ($this -> pagingStart > 1) $this -> pagingStart --; if ($this -> pagingEnd < $this -> totalPages) $this -> pagingEnd++; } } else $this -> result = NULL; if (count($errors = $this -> get('Errors')) > 0) { JLog :: add('Error viewing advancedsearchpublications: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } private function getParameter($name) { $values = JFactory :: getApplication() -> input -> get($name, NULL, NULL); if ($values == NULL) $values = array(); else if (!is_array($values)) { $value = $values; $values = array(); $values[] = $value; } return $values; } }