Sets the ordering based on the established request variables

@param   string  $orderBy   The request variable used to denote ordering column
@param   string  $orderDir  The request variable used to denote ordering direction
@return  $this
@since   2.0.0
329329
public function ordered($orderBy = 'orderby', $orderDir = 'orderdir')
	{
		// Look for our request vars of interest
		$this->orderBy  = \Request::getCmd($orderBy, $this->getState('orderby', $this->orderBy));
		$this->orderDir = \Request::getCmd($orderDir, $this->getState('orderdir', $this->orderDir));

		$qualifiedOrderBy = $this->orderBy;

		// If we have a '.' we'll assume the prefix is a relationship name
		if (strpos($this->orderBy, '.') !== false)
		{
			list($relationship, $field) = explode('.', $this->orderBy);

			// We have to join to apply the order by clause
			$relationship     = $this->$relationship()->join();
			$qualifiedOrderBy = $relationship->getQualifiedFieldName($field);
		}

		// Apply order clause
		$this->order($qualifiedOrderBy, $this->orderDir);

		// Set state for future use
		$this->setState('orderby', $this->orderBy);
		$this->setState('orderdir', $this->orderDir);

		return $this;
	}
270072
public function set_sortorder($sortorder) {
        $oldorder = $this->file_record->sortorder;
        $filerecord = new stdClass;
        $filerecord->sortorder = $sortorder;
        $this->update($filerecord);
        if (!$this->is_directory()) {
            // Callback for file sort order change.
            if ($pluginsfunction = get_plugins_with_function('after_file_sorted')) {
                foreach ($pluginsfunction as $plugintype => $plugins) {
                    foreach ($plugins as $pluginfunction) {
                        $pluginfunction($this->file_record, $oldorder, $sortorder);
                    }
                }
            }
        }
    }
831246
public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
657780
public function setOrderBy(array $orderBy)
    {
        // Validate and force the case for the direction.
        foreach ($orderBy as $attribute => $direction) {
            if (!in_array(strtoupper($direction), self::ORDER)) {
                throw new \InvalidArgumentException(sprintf(
                    'Order direction "%s" is invalid. Valid values are ASC and DESC',
                    $direction
                ));
            }
            $orderBy[$attribute] = strtoupper($direction);
        }
        $this->orderBy = $orderBy;

        return $this;
    }
532639
public function setOrder($mode, $direction = self::DIRECTION_ASC)
    {
        $this->orderMode = $mode;
        $this->orderDirection = $direction;
    }
67863
final public function orderBy($orderby, $direction = '')
    {
        if (strtolower($direction) == 'random') {
            $orderby = ''; // Random results want or don't need a field name
            $direction = $this->_randomKeyword;
        } elseif (trim($direction) != '') {
            $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' ' . $direction : ' ASC';
        }


        if (strpos($orderby, ',') !== FALSE) {
            $temp = array();
            foreach (explode(',', $orderby) as $part) {
                $part = trim($part);
                if (!in_array($part, $this->arrayAliasedTables)) {
                    $part = $this->identifiers(trim($part));
                }
                $temp[] = $part;
            }

            $orderby = implode(', ', $temp);
        } else if ($direction != $this->_randomKeyword) {
            $orderby = $this->identifiers($orderby);
        }

        $orderbyStatement = $orderby . $direction;

        $this->arrayOrderBy[] = $orderbyStatement;
        if ($this->arrayCaching === TRUE) {
            $this->arrayCacheOrderBy[] = $orderbyStatement;
            $this->arrayCacheExists[] = 'orderby';
        }

        return $this;
    }
393065
public function sortable(
        array $orderColumns = [],
        string $orderByKey = 'order_by',
        string $directionKey = 'direction'
    ): void {
        $model = $this->resolveQueryBuilderFromModel($this->model);
        $request = $this->app->make('request');

        $orderByValue = $request->input($orderByKey);
        $directionValue = $request->input($directionKey);

        $this->set('filter.order_by', ['key' => $orderByKey, 'value' => $orderByValue]);
        $this->set('filter.direction', ['key' => $directionKey, 'value' => $directionValue]);
        $this->set('filter.columns', $orderColumns);

        $this->model = $this->setupBasicQueryFilter($model, [
            'order_by' => $orderByValue,
            'direction' => $directionValue,
            'columns' => $orderColumns,
        ]);
    }
1294824
public function orderBy($orderBy, $direction='asc')
    {
        if($direction == 'desc')
            return $this->model->orderBy($orderBy, 'desc');
        else
            return $this->model->orderBy($orderBy, 'asc');
    }
896682
public function setOrderId($orderId)
    {
        if (!empty($orderId) && ctype_print($orderId)) {
            $this->orderId = trim($orderId);
        }

        return $this;
    }
967264
public function setOrderBy($sort, $direction = 'ASC')
    {
        $this->sort = $sort;
        $this->direction = $direction;
        return $this;
    }
816211
public function setDefaultOrder($defaultOrderField, $defaultOrderDirection = 'ASC')
    {
        $this->defaultOrderField = $defaultOrderField;
        $this->defaultOrderDirection = $defaultOrderDirection;
        return $this;
    }
2310
public function byFunction(
        string $function,
        string $order
    ): SortBy {
        $this->sortsBy[] = [
            'type' => self::TYPE_FUNCTION,
            'function' => $function,
            'order' => $order,
        ];

        return $this;
    }
715259
public function setOrderParameters($idAttr, $orderAttr, $labelAttr)
    {
        $this->orderParameters = [
            'idAttr' => $idAttr,
            'orderAttr' => $orderAttr,
            'labelAttr' => $labelAttr
        ];

        return $this;
    }
1135261
public function order($by, $dir = 'asc', $manual = null, $sort_flags = null)
    {
        $this->items = $this->pages->sortCollection($this, $by, $dir, $manual, $sort_flags);

        return $this;
    }
108924
public function orderby($orderBy = null): Update
    {
        if (!\is_string($orderBy) && !\is_array($orderBy)) {
            throw new InvalidArgumentException('$orderBy has to be an array or a string');
        }
        $this->orderBy = $this->namesClass->parse($orderBy);

        return $this;
    }
374679
private function setOrderBy()
    {
        if (isset($this->requestParams['order']) && count($this->requestParams['order'])) {
            $counter = count($this->requestParams['order']);

            for ($i = 0; $i < $counter; ++$i) {
                $columnIdx = (integer) $this->requestParams['order'][$i]['column'];
                $requestColumn = $this->requestParams['columns'][$columnIdx];

                if ('true' == $requestColumn['orderable']) {
                    $this->qb->addOrderBy(
                        $this->orderColumns[$columnIdx],
                        $this->requestParams['order'][$i]['dir']
                    );
                }
            }
        }

        return $this;
    }
501735
public function setOrderVAT($orderVAT)
    {
        if (!is_array($orderVAT)) {
            $this->orderVAT = null;

            return false;
        }
        $isValid = true;
        $index = 0;
        while ($isValid && $index < count($orderVAT)) {
            if (is_numeric($orderVAT[$index]) && $orderVAT[$index] >= 0 && $orderVAT[$index] < 100) {
                $isValid = true;
            } else {
                $isValid = false;
            }
            $index++;
        }
        if (!$isValid) {
            $this->orderVAT = null;

            return false;
        }
        $this->orderVAT = $orderVAT;

        return true;
    }