getModel(self :: MODEL); $locale = JFactory :: getLanguage() -> getTag(); $this -> itemId = JRequest :: getUInt('Itemid', 0); $this -> keyword = JRequest :: getString('keyword'); $this -> filters = array(); $type = JRequest :: getString('type'); if ($type != NULL) { $this -> filters['type'] = new JObject(); $this -> filters['type'] -> name = 'type'; $this -> filters['type'] -> value = $type; } $language = JRequest :: getString('language'); if ($language != NULL) { $this -> filters['language'] = new JObject(); $this -> filters['language'] -> name = 'language'; $this -> filters['language'] -> value = $language; } $funder = JRequest :: getString('funder'); if ($funder != NULL) { $this -> filters['funder'] = new JObject(); $this -> filters['funder'] -> name = 'funder'; $this -> filters['funder'] -> value = $funder; } $fundingStream = JRequest :: getString('fundingStream'); if ($fundingStream != NULL) { $this -> filters['fundingStream'] = new JObject(); $this -> filters['fundingStream'] -> name = 'fundingStream'; $this -> filters['fundingStream'] -> value = $fundingStream; } $fundingStreamLevel1 = JRequest :: getString('fundingStreamLevel1'); if ($fundingStreamLevel1 != NULL) { $this -> filters['fundingStreamLevel1'] = new JObject(); $this -> filters['fundingStreamLevel1'] -> name = 'fundingStreamLevel1'; $this -> filters['fundingStreamLevel1'] -> value = $fundingStreamLevel1; } $fundingStreamLevel2 = JRequest :: getString('fundingStreamLevel2'); if ($fundingStreamLevel2 != NULL) { $this -> filters['fundingStreamLevel2'] = new JObject(); $this -> filters['fundingStreamLevel2'] -> name = 'fundingStreamLevel2'; $this -> filters['fundingStreamLevel2'] -> value = $fundingStreamLevel2; } $year = JRequest :: getUInt('year', NULL); if ($year != NULL) { $this -> filters['year'] = new JObject(); $this -> filters['year'] -> name = 'year'; $this -> filters['year'] -> value = $year; } $accessMode = JRequest :: getString('accessMode'); if ($accessMode != NULL) { $this -> filters['accessMode'] = new JObject(); $this -> filters['accessMode'] -> name = 'accessMode'; $this -> filters['accessMode'] -> value = $accessMode; } $datasource = JRequest :: getString('datasource'); if ($datasource != NULL) { $this -> filters['datasource'] = new JObject(); $this -> filters['datasource'] -> name = 'datasource'; $this -> filters['datasource'] -> value = $datasource; } $this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); $this -> size = self :: DEFAULT_SIZE; //JRequest :: getUInt('size', self :: DEFAULT_SIZE); if ($this -> keyword == NULL) $this -> statistics = $model -> getDatasetStatistics($locale, false); else { JViewLegacy:: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('searchDatasets', 'keyword=' . urlencode($this -> keyword) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel1=' . urlencode($fundingStreamLevel1) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); $this -> result = $model -> searchDatasets($this -> keyword, $type, $language, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $year, $accessMode, $datasource, $this -> page, $this -> size, $locale,TRUE); $this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalDatasets / $this -> size); if ($this -> totalPages == NULL) $this -> totalPages = 1; $this -> page = ($this -> page > $this -> totalPages)? $this -> totalPages:$this -> page; $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++; } } if (count($errors = $this -> get('Errors')) > 0) { JLog :: add('Error viewing searchdatasets: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }