getModel(self :: MODEL); $locale = JFactory :: getLanguage() -> getTag(); $this -> itemId = JRequest :: getUInt('Itemid', 0); $this -> keyword = JRequest :: getString('keyword'); $this -> articles = (JRequest :: getString('articles') == 'true') ? TRUE : FALSE; $this -> books = (JRequest :: getString('books') == 'true') ? TRUE : FALSE; $this -> theses = (JRequest :: getString('theses') == 'true') ? TRUE : FALSE; $this -> reports = (JRequest :: getString('reports') == 'true') ? TRUE : FALSE; $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; } $community = JRequest :: getString('community'); if ($community != NULL) { $this -> filters['community'] = new JObject(); $this -> filters['community'] -> name = 'community'; $this -> filters['community'] -> value = $community; } $project = JRequest :: getString('project'); if ($project != NULL) { $this -> filters['project'] = new JObject(); $this -> filters['project'] -> name = 'project'; $this -> filters['project'] -> value = $project; } $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 -> getPublicationStatistics($locale,false); else { JViewLegacy:: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('searchPublications', 'keyword=' . urlencode($this -> keyword) . '&articles=' . urlencode($this -> articles) . '&books=' . urlencode($this -> books) . '&theses=' . urlencode($this -> theses) . '&reports=' . urlencode($this -> reports) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&funder=' . urlencode($funder) . '&fundingStream=' . urlencode($fundingStream) . '&fundingStreamLevel2=' . urlencode($fundingStreamLevel2) . '&year=' . urlencode($year) . '&accessMode=' . urlencode($accessMode) . '&datasource=' . urlencode($datasource) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); $this -> result = $model -> searchPublications($this -> keyword, $this -> articles, $this -> books, $this -> theses, $this-> reports, $type, $language, $funder, $fundingStream, $fundingStreamLevel1, $fundingStreamLevel2, $year, $accessMode, $datasource, $community, $this -> page, $this -> size, $locale,$project,TRUE); $this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalPublications / $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 searchpublications: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }