getTag(); $model = $this -> getModel(self :: MODEL); $this -> statistics = $model -> getDatasourceStatistics($locale); $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('language'); $this -> contents = $this -> getParameter('content'); $this -> compatibilities = $this -> getParameter('compatibility'); $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; } $content = JRequest :: getString('contentFilter'); if ($content != NULL) { $this -> filters['contentFitler'] = new JObject(); $this -> filters['contentFilter'] -> name = 'contentFilter'; $this -> filters['contentFilter'] -> value = $content; } $compatibility = JRequest :: getString('compatibilityFilter'); if ($compatibility != NULL) { $this -> filters['compatibilityFilter'] = new JObject(); $this -> filters['compatibilityFilter'] -> name = 'compatibilityFilter'; $this -> filters['compatibilityFilter'] -> value = $compatibility; } $this -> page = JRequest :: getUInt('page', self :: DEFAULT_PAGE); $this -> size = JRequest :: getUInt('size', self :: MIN_SIZE); $this -> size = ($this -> size > self :: MAX_SIZE || $this -> size < 1) ? self :: MIN_SIZE : $this -> size; if ((($this -> keywords != NULL) && ($this -> fields != NULL) && ($this -> constraints != NULL)) || ($this -> types != NULL) || ($this -> languages != NULL) || ($this -> contents != NULL) || ($this -> compatibilities != NULL)) { JViewLegacy :: loadHelper('PiwikHelper'); PiwikHelper :: logPageView('advancedSearchDatasources', '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)) . '&contents=' . urlencode(implode(',', $this -> contents)) . '&compatibilities=' . urlencode(implode(',', $this -> compatibilities)) . '&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 -> advancedSearchDatasources($this -> keywords, $this -> fields, $this -> constraints, $this -> types, $this -> languages, $this -> contents, $this -> compatibilities, $type, $language, $content, $compatibility, $this -> page, $this -> size, $locale); $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++; } } else $this -> result = NULL; if (count($errors = $this -> get('Errors')) > 0) { JLog :: add('Error viewing advancedsearchdatasources: ' . 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; } }