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; } $content = JRequest :: getString('content'); if ($content != NULL) { $this -> filters['content'] = new JObject(); $this -> filters['content'] -> name = 'content'; $this -> filters['content'] -> value = $content; } $compatibility = JRequest :: getString('compatibility'); if ($compatibility != NULL) { $this -> filters['compatibility'] = new JObject(); $this -> filters['compatibility'] -> name = 'compatibility'; $this -> filters['compatibility'] -> value = $compatibility; } $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 -> getDatasourceStatistics($locale); else { JViewLegacy:: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('searchDatasources', 'keyword=' . urlencode($this -> keyword) . '&type=' . urlencode($type) . '&language=' . urlencode($language) . '&content=' . urlencode($content) . '&compatibility=' . urlencode($compatibility) . '&page=' . urlencode($this -> page) . '&size=' . urlencode($this -> size) . '&locale=' . urlencode($locale)); $this -> result = $model -> searchDatasources($this -> keyword, $type, $language, $content, $compatibility, $this -> page, $this -> size, $locale, TRUE); $this -> totalPages = ($this -> result == NULL) ? NULL : ceil($this -> result -> totalDatasources / $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 searchdatasources: ' . implode("\n", $errors), JLog :: ERROR, self :: LOG); return FALSE; } parent :: display($template); } }