If the entry is being prepopulated, we may want to filter other views by this entry's
value. This function will create that filter query string.

@since Symphony 2.5.2
@return string
828
public function getFilterString()
    {
        $filter_querystring = '';

        if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) {
            foreach ($_REQUEST['prepopulate'] as $field_id => $value) {
                $handle = FieldManager::fetchHandleFromID($field_id);
                // Properly decode and re-encode value for output
                $value = rawurlencode(rawurldecode($value));
                $filter_querystring .= sprintf('filter[%s]=%s&', $handle, $value);
            }
            $filter_querystring = trim($filter_querystring, '&');
        }

        // This is to prevent the value being interpreted as an additional GET
        // parameter. eg. filter[cat]=Minx&June, would come through as:
        // $_GET['cat'] = Minx
        // $_GET['June'] = ''
        $filter_querystring = preg_replace("/&amp;$/", '', $filter_querystring);

        return $filter_querystring ? '?' . $filter_querystring : null;
    }
139020
protected function getHttpQuery()
    {
        $arguments = [];

        foreach ($this->params as $key => $value) {
            if (isset(self::$encodeParams[$key])) {
                $arguments[$key] = json_encode($value);
            } elseif (is_bool($value)) {
                $arguments[$key] = $value ? 'true' : 'false';
            } else {
                $arguments[$key] = $value;
            }
        }

        return sprintf(
            '/%s/_design/%s/_view/%s?%s',
            $this->databaseName,
            $this->designDocumentName,
            $this->viewName,
            http_build_query($arguments)
        );
    }
11945
protected function getFilter() {
		$filter = $this->getOption('query.filter');
		$negate = false;
		if ($this->hasOption('query.negate'))
			$negate = (bool) $this->getOption('query.negate');
		if (is_array($filter))
			return new Filter($filter, $negate);
		return new Filter([$filter], $negate);
	}
1153006
protected function getViewName()
    {
        $name = $this->request->getAttribute(self::VIEW);
        return $this->prefix . $name;
    }
553599
protected function _renderFiltersBefore()
    {
        $searchRequest = $this->prepareRequest();

        $this->queryResponse = $this->searchEngine->search($searchRequest);

        // Update the product count.
        $this->_totalRecords = $this->queryResponse->count();

        // Filter search results. The pagination has to be resetted since it is managed by the engine itself.
        $docIds = array_map(
            function (\Magento\Framework\Api\Search\Document $doc) {
                return (int) $doc->getId();
            },
            $this->queryResponse->getIterator()->getArrayCopy()
        );

        if (empty($docIds)) {
            $docIds[] = 0;
        }

        $this->getSelect()->where('e.entity_id IN (?)', ['in' => $docIds]);
        $this->originalPageSize = $this->_pageSize;
        $this->_pageSize = false;

        $this->isSpellchecked = $searchRequest->isSpellchecked();

        return parent::_renderFiltersBefore();
    }
44043
public function getSPARQL() {
		// add subqueries to the beginning because they are logically evaluated first
		$sparql = $this->formatSubqueries();

		foreach ( $this->conditions as $subject => $predicates ) {
			$sparql .= ' ' . $subject;
			$sparql .= $this->formatPredicates( $predicates ) . ' .';
		}

		$sparql .= $this->formatOptionals();
		$sparql .= $this->formatFilters();
		$sparql .= $this->formatUnions();

		return $sparql;
	}
413858
public function render()
    {
        $this->removeIDFilterIfNeeded();

        if (empty($this->filters)) {
            return '';
        }

        return view($this->view)->with([
            'action'   => $this->action ?: $this->urlWithoutFilters(),
            'layout'   => $this->layout,
            'filterID' => $this->filterID,
            'expand'   => $this->expand,
        ])->render();
    }
1304745
protected function getSearchFilter()
    {
        $pattern = $this->getRequest()->getQuery('pattern', null);
        $pattern = StaticFilter::filter('text', $pattern);
        $this->set('pattern', $pattern);
        
        return new SearchFilter(['pattern' => $pattern]);
    }
1202925
public function getSearchCriteria()
    {
        /* setting the default pagination for the page */
        if (!Yii::$app->session->get($this->MainModel . 'Pagination')) {
            Yii::$app->session->set($this->MainModel . 'Pagination', Yii::$app->getModule('core')->recordsPerPage);
        }
        $savedQueryParams = Yii::$app->session->get($this->MainModel . 'QueryParams');
        if (count($savedQueryParams)) {
            $queryParams = $savedQueryParams;
        } else {
            $queryParams = [substr($this->MainModelSearch, strrpos($this->MainModelSearch, "\\") + 1) => $this->defaultQueryParams];
        }
        /* use the same filters as before */
        if (count(Yii::$app->request->queryParams)) {
            $queryParams = array_merge($queryParams, Yii::$app->request->queryParams);
        }

        if (isset($queryParams['page'])) {
            $_GET['page'] = $queryParams['page'];
        }
        if (Yii::$app->request->getIsPjax()) {
            $this->layout = false;
        }
        Yii::$app->session->set($this->MainModel . 'QueryParams', $queryParams);
        $this->searchModel = new $this->MainModelSearch;
        $this->dataProvider = $this->searchModel->search($queryParams);
    }
945653
public function getListFilter()
    {
        if ($this->_aListFilter === null) {
            $this->_aListFilter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("where");
        }

        return $this->_aListFilter;
    }
815081
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = parent::GetQueryRestrictionForActiveFilter();
        if (is_null($sQuery)) {
            $aValues = $this->aActiveFilterData;
            if (is_array($aValues) && count($aValues) > 0) {
                $quotedItemFieldName = $this->getDatabaseConnection()->quoteIdentifier($this->sItemFieldName);
                $sQuery = " `shop_article`.$quotedItemFieldName = '' ";
            }
        }

        return $sQuery;
    }
381728
public function sqlFilters()
    {
        if (!$this->hasFilters()) {
            return '';
        }

        $criteria = $this->createFilter([
            'filters' => $this->filters()
        ]);

        $sql = $criteria->sql();
        if (strlen($sql) > 0) {
            $sql = ' WHERE '.$sql;
        }

        return $sql;
    }
494438
public function globalFilter()
    {
        $globalSearch = [];
        if (isset($this->request['search']) && !empty($this->request['search']['value'])) {
            for ($i = 0, $ien = count($this->request['columns']); $i<$ien; $i++) {
                if (self::isSearchable($this->columns[$i])) {
                    $where_condition = $this->toSQLColumn($this->columns[$i], 2).' LIKE '.$this->pdoLink->quote('%'.$this->request['search']['value'].'%');
                    if (!$this->setHaving($where_condition, $this->columns[$i])) {
                        $globalSearch[] = $where_condition;
                    }
                }
            }
        }

        return empty($globalSearch) ? '' : '('.implode(' OR ', $globalSearch).')';
    }
283197
protected function _prepare_filter() {
		$term = \get_queried_object();

		if ( ! empty( $term->slug ) && ! empty( $term->taxonomy ) ) {
			$this->term     = $term->slug;
			$this->taxonomy = $term->taxonomy;
		}
	}
1369115
private function filter()
    {
        if ($this->allowsFilter()) {
            if ($this->hasFilters()) {
                $tmp = [];
                foreach ($this->filters as $filter) {
                    // check, if it is a "forbidden" query parameter
                    if ($this->isExcludedParameter($filter['key'])) {
                        continue;
                    }
                    $tmp[] = $filter;
                }

                $this->filters = $tmp;

                return $this->operator->filter($this->filters);
            }
        }
    }
1165798
protected function _paginationFilter() {
		$conditions = array_filter($this->request->query, function($var) {
			return $var !== '';
		});
		unset($conditions['url'], $conditions['batch_conditions'], $conditions['batch_action']);
		foreach (array('started', 'created', 'stopped', 'modified') as $dateRangeField) {
			if (empty($conditions[$dateRangeField])) {
				continue;
			}
			if (preg_match('/^(?P<start>.*)\s(-|to)\s(?P<end>.*)$/is', $conditions[$dateRangeField], $range)) {
				$conditions[$dateRangeField . ' BETWEEN ? AND ?'] = array(
					(new DateTime($range['start']))->format('Y-m-d H:i:s'),
					(new DateTime($range['end']))->format('Y-m-d H:i:s')
				);
			}
			unset($conditions[$dateRangeField]);
		}
		return $conditions;
	}
1194097
private function jqFilterQuery()
    {
        if (($filter = \Input::get('filter')) && is_array($filter)) {
            $this->setJqGridQuery($this->jqGridQuery->where(function ($query) use ($filter) {
                foreach ($filter as $k => $val) {
                    $field = $this->getJqFilterField($k);

                    if (is_array($val)) {
                        $query->where(function ($query) use ($val, $field) {
                            foreach ($val as $v) {
                                if (!$this->isExcluded($v)) {
                                    $query->orWhere($field, '=', $v);
                                }
                            }
                        });
                    } else {
                        if (!$val) {
                            if (!$this->isExcluded($val)) {
                                $query->where($field, '=', null);
                            }
                        } else {
                            if (!$this->isExcluded($val)) {
                                $query->where($field, '=', $val);
                            }
                        }
                    }
                }
            }));
        }

        return $this;
    }