Returns the array of criteria sortations based on the given parameters

@param array $params List of criteria data with condition, sorting and paging
@return array Associative list of criteria sortations
495701
protected function getCriteriaSortations( array $params )
	{
		$sortation = [];

		foreach( $params as $sort )
		{
			if( $sort[0] === '-' ) {
				$sortation[substr( $sort, 1 )] = '-';
			} else {
				$sortation[$sort] = '+';
			}
		}

		return $sortation;
	}
1170074
public function getRealParams(array $params)
    {
        foreach ($params as $k => $p) {
            if (is_array($p)) {
                $params[$k] = $p[1];
            }
        }

        return $params;
    }
310207
protected function parseSort($params)
    {
        foreach (explode(',', $params) as $sort) {
            // Check if ascending or descending(-) sort
            if (preg_match('/^-.+/', $sort)) {
                $direction = 'desc';
            } else {
                $direction = 'asc';
            }

            $sort = preg_replace('/^-/', '', $sort);
            if (! $this->canSort($sort)) {
                return;
            }

            // Only add the sorts that are on the base resource
            if (! Str::contains($sort, '.')) {
                $this->getHandler()->orderBy($sort, $direction);
            } else {
                $this->additionalSorts[$sort] = $direction;
            }
        }
    }
616084
protected function evaluateParams($params)
    {
        foreach ($params as $name => $value)
        {
            if (is_callable($value))
                $params[$name] = $this->evaluateExpression($value, array('data' => $this->owner));
        }
        return $params;
    }
555442
public static function all( $sort = array() , $fields = array())
    {
        $criteria = array();
        self::processCriteriaWithType($criteria);
        return self::find($criteria, self::mapFields($sort), self::mapFields($fields));
    }
571979
public function getListeRuesCompletes($params=array())
	{
		$pagination = new paginationObject();
		$adresse = new archiAdresse();
		$nbEnregistrementsParPage=10;


		$paginationHTML="";

		$sqlLimit="";

		if (isset($params['sqlLimit'])) {
			$sqlLimit = $params['sqlLimit'];
		}

		$titre = "";
		if (isset($params['setTitre'])) {
			$titre = $params['setTitre']."<br><br>";
		}


		if (!isset($params['noPagination']) || $params['noPagination']==false) {
			$reqRuesCount="
					SELECT r.idRue,  count(distinct ae.idAdresse) as nbAdresses
					FROM rue r
					LEFT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
					LEFT JOIN _adresseEvenement ae ON ae.idAdresse = ha.idAdresse
					WHERE ha.numero<>'0' and ha.numero<>'' AND ha.idAdresse IS NOT NULL
					GROUP BY r.idRue
					";

			$resRuesCount = $this->connexionBdd->requete($reqRuesCount);
			$nbEnregistrementTotaux = mysql_num_rows($resRuesCount);


			$arrayPagination=$pagination->pagination(
					array(
							'nomParamPageCourante'=>'archiPageCouranteRue',
							'nbEnregistrementsParPage'=>$nbEnregistrementsParPage,
							'nbEnregistrementsTotaux'=>$nbEnregistrementTotaux,
							'typeLiens'=>'noformulaire'
					)
			);
			$sqlLimit = "LIMIT ".$arrayPagination['limitSqlDebut'].", ".$nbEnregistrementsParPage;
		}

		// liste des rues les plus completes
		$reqRues = "
		SELECT r.idRue,  count(distinct ae.idAdresse) as nbAdresses
		FROM rue r
		LEFT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
		LEFT JOIN _adresseEvenement ae ON ae.idAdresse = ha.idAdresse
		WHERE ha.numero<>'0' AND ha.numero<>'' AND ha.idAdresse IS NOT NULL
		GROUP BY r.idRue
		ORDER BY nbAdresses DESC
		$sqlLimit
		";


		$resRues = $this->connexionBdd->requete($reqRues);

		if (!isset($params['noPagination']) || $params['noPagination']==false) {
			$paginationHTML = $arrayPagination['html']."<br>";
		}

		$tableau = new tableau();

		while ($fetchRues = mysql_fetch_assoc($resRues)) {
			$intituleRue = $adresse->getIntituleAdresseFrom($fetchRues['idRue'], 'idRue');
			$tableau->addValue("<a href='".$this->creerUrl('', 'listeAdressesFromRue', array('recherche_rue'=>$fetchRues['idRue'], 'noAdresseSansNumero'=>1))."'>".$intituleRue."</a>&nbsp;(".$fetchRues['nbAdresses'].")");

			$tableau->addValue("<img src='".$adresse->getUrlImageFromRue($fetchRues['idRue'], 'mini')."' alt=\"".$intituleRue."\" title=\"".$intituleRue."\" >");
		}

		return $titre.$paginationHTML.$tableau->createHtmlTableFromArray(2, "", "tableau");
	}
550687
public static function decodeParams($params)
    {
        if(!$params) {
            return [];
        }
        $paramsArrayList = json_decode(json_encode($params), true);
        $decodedParams = [];
        foreach($paramsArrayList as $paramKey=>$paramValue){
            if(is_array($paramValue)) {
                foreach($paramValue as $languageSlug=>$langParamValue){
                    if($languageSlug == App::getLocale()) {
                        $decodedParams[$paramKey] = $langParamValue;
                        break;
                    }else{
                        $decodedParams[$paramKey] = "";
                    }
                }
            }else{
                $decodedParams[$paramKey] = $paramValue;
            }
        }
        return $decodedParams;
    }
832269
public function setParamsSort(array $params) {
        if (is_numeric(key($params)) && key($params) == 0) {
            $tmp = [];
            foreach ($params as $key => $value) {
                $tmp[$key + 1] = $value;
            }
            $params = $tmp;
        }

        return $params;
    }
1337029
private function determineSortCriteria($arguments)
    {
        $sortCriteria = [];

        if (array_key_exists('sort', $arguments)) {
            // Sort order has been set by select on the page.
            $criteria = explode('--', $arguments['sort']);
            foreach ($criteria as $criterion) {
                $parts = explode('-', $criterion);
                if (count($parts) == 2) {
                    $sortCriteria[] = [
                            'fieldName' => $parts[0],
                            'direction' => ($parts[1] == 'd') ? 'descending' : 'ascending'
                    ];
                }
            }
        } else {
            // Use default sort order.
            $sortCriteria = $this->conf['sortOrder'];
        }

        return $sortCriteria;
    }
476285
public function search($params)
    {
        $query = (\Yii::$app->user->can('viewCompleteProductList')) ?
            Product::find()->joinWith('translations')->orderBy(['category_id' => SORT_ASC, 'position' => SORT_ASC]) :
            Product::find()->joinWith('translations')->where(['owner' => \Yii::$app->user->id])->orderBy(['category_id' => SORT_ASC, 'position' => SORT_ASC]);

        $this->load($params);

        $query->andFilterWhere([
            'shop_product.category_id' => $this->category,
        ])->andFilterWhere(['like', 'shop_product_translation.title', $this->title
        ])->andFilterWhere(['shop_product.status' => $this->status]);


        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pagesize' => 10,
            ],
        ]);

        if (!$this->validate()) {

            return $dataProvider;
        }

        return $dataProvider;
    }
511136
public function get(array $params) {
        $this->_requireDataType($params);

        if (array_get($params, 'datatype') === self::METHOD_DICTIONARY) {
            return $this->getDictionary();
        } elseif (array_get($params, 'relatedType') && array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getRelatedResults($params);
        } elseif (array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getSingleResult($params);
        } else {
            list($response, $httpCode) = $this->_getIndex($params);
        }

        return $this->_formatResponse($response, $httpCode);
    }
251349
protected function getFilterCriteria(array $parameters)
    {
        /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */
        $location = $parameters['location'];

        $criteria = [];
        $criteria[] = new SubtreeCriterion($location->pathString);

        if ($parameters['exclude_self']) {
            $criteria[] = new LogicalNot(new LocationId($location->id));
        }

        return $criteria;
    }
581404
private function extractSorting(array $params)
    {
        if (false === $this->issetNotEmpty(self::PARAM_SORTING, $params)) {
            return $this;
        }
        $sort = explode(',', $params[self::PARAM_SORTING]);
        $this->sorting = [];
        foreach ($sort as $field) {
            $direction = 1;
            if (0 === strpos($field, '-')) {
                $direction = -1;
                $field = str_replace('-', '', $field);
            }
            $this->sorting[$field] = $direction;
        }
        return $this;
    }
75006
public function index($params = [])
    {
        // Set the filters
        $params = (!empty($params))? $params : $this->app->request->input();

        // Get records
        $this->model->params = $params;
        $result = $this->model->search($params)->get();

        // Get pagination and number of records
        $pagination = array_merge(
            ['records' => $this->model->search($params)->count()],
            $this->model->pagination()
        );

        // Return results
        return [
            'success' => true,
            'paging' => $pagination,
            'data' => $result
        ];
    }
870339
protected function formatKVLists(array $params)
    {
        $formatted = [];

        foreach ($params as $name => $value) {
            $formatted[] = [
                'key' => $name,
                'value' => strval($value),
            ];
        }

        return $formatted;
    }
1196575
public function buildSearchArray($queryParameters)
    {
        $allowedStringCriteria = array('name', 'dateFrom', 'dateTo');
        $allowedArrayCriteria = array('types');
        $criteria = array();

        foreach ($queryParameters as $parameter => $value) {
            if (in_array($parameter, $allowedStringCriteria) && is_string($value)) {
                $criteria[$parameter] = $value;
            } elseif (in_array($parameter, $allowedArrayCriteria) && is_array($value)) {
                $criteria[$parameter] = $value;
            }
        }

        return $criteria;
    }
1122987
protected function _normalizeParams(array &$params)
    {
        ksort($params, \SORT_STRING);
        array_walk($params, function (&$value) {
            if (is_numeric($value)) {
                $value = (string)$value;
            }
        });

        if (isset($params['?'])) {
            $this->_normalizeParams($params['?']);
        }
    }