Changes the sort order for a node

@param int $nodeID
@param string $sortingField
@param bool $sortingOrder

@return array An array with operation status, always true
760176
static public function changeSortOrder( $nodeID, $sortingField, $sortingOrder = false )
    {
        $curNode = eZContentObjectTreeNode::fetch( $nodeID );
        if ( is_object( $curNode ) )
        {
             $db = eZDB::instance();
             $db->begin();
             $curNode->setAttribute( 'sort_field', $sortingField );
             $curNode->setAttribute( 'sort_order', $sortingOrder );
             $curNode->store();
             $db->commit();
             $object = $curNode->object();
             eZContentCacheManager::clearContentCacheIfNeeded( $object->attribute( 'id' ) );
        }
        return array( 'status' => true );
    }
24030
protected function _sortResult(array &$result, $sort = 'asort')
    {
        // Sorting
        switch ($sort) {
            case 'asort':
                asort($result);
                break;

            case 'ksort':
                ksort($result);
                break;

            case 'natsort':
                natsort($result);
                break;

            default:
                $sort($result);
        }
    }
553821
public function applySorter($qb, SorterInterface $sorter, QueryObjectInterface $queryObject)
    {
        if ($queryObject instanceof SortableQueryObjectInterface) {
            // default sorting if no sorter rules exists
            if (0 === $sorter->count() && 0 < \count($queryObject->getDefaultSort())) {
                $sorter->setSorterRules($queryObject->getDefaultSort());
            }

            $this->getBuilderFor($qb)->applySorter($qb, $sorter, $queryObject->getSorterMap());
        }
    }
361561
public function sort(Sorting $sorting)
	{
		if (is_callable($sorting->getSortCallback())) {
			call_user_func(
				$sorting->getSortCallback(),
				$this->data_source,
				$sorting->getSort()
			);

			return $this;
		}

		$sort = $sorting->getSort();

		if (!empty($sort)) {
			foreach ($sort as $column => $order) {
				$this->data_source = $this->data_source->orderBy($this->prepareColumn($column), $order);
			}
		} else {
			/**
			 * Has the statement already a order by clause?
			 */
			$order = $this->data_source->getQueryBuilder()->getClause('order');

			if (ArraysHelper::testEmpty($order)) {
				$this->data_source = $this->data_source->orderBy($this->prepareColumn($this->primary_key));
			}
		}

		return $this;
	}
193447
boolean handleSortOrder(final List<SortMeta> sortOrder) {
		boolean changed = false;

		if (sortOrder == null) {
			if (multiSortBy != null) {
				adaptee.clearSorting();
				multiSortBy = null;
				lastSorting = null;
				changed = true;
			}
		} else {
			final List<SortProperty> newSorting = convert2SortProperty(sortOrder);
			if (!newSorting.equals(lastSorting)) {
				adaptee.setSorting(newSorting);
				multiSortBy = sortOrder;
				lastSorting = newSorting;
				changed = true;
			}
		}

		return changed;
	}
485622
public function set_sortorder($sortorder) {
        if ($this->sortorder == $sortorder) {
            return;
        }
        $this->sortorder = $sortorder;
        $this->update();
    }
313617
public function getSort($sortName): ?OrderBy
    {
        [$name, $sorts] = $this->getArrayAndKeyName($sortName, 'sorts');

        return array_first($sorts, function ($sort) use ($name) {
            return $sort->getName() === $name;
        });
    }
1093536
public function setItemSorting($sortIdent, $sortBy, $sortDir = null)
    {
        $sorting = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('aSorting');
        $sorting[$sortIdent]['sortby'] = $sortBy;
        $sorting[$sortIdent]['sortdir'] = $sortDir ? $sortDir : null;

        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('aSorting', $sorting);
    }
46148
public function sort($sort_flags = SORT_REGULAR)
        {
            $array = $this->get();
            sort($array, $sort_flags);
            $this->update($array);
            return $this;
        }
405216
public static function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() )
    {
        $searchEngine = eZSearch::getEngine();

        if ( $searchEngine instanceof ezpSearchEngine && method_exists( $searchEngine, 'swapNode' ) )
        {
            return $searchEngine->swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() );
        }

        return false;
    }
805379
protected function _order($unsortedArray, $sortField, $sortWay = 'SORT_ASC')
	{
		$sortedArray = array();
		foreach ($unsortedArray as $uniqid => $row) {
			foreach ($this->getAttributes() as $attr) {
				if (isset($row[$attr])) {
					$sortedArray[$attr][$uniqid] = $unsortedArray[$uniqid][$attr];
				} else {
					$sortedArray[$attr][$uniqid] = null;
				}
			}
		}
		if ($sortWay) {
			array_multisort($sortedArray[$sortField], constant($sortWay), $unsortedArray);
		}
		return $unsortedArray;
	}
363601
public function sort(Sorting $sorting)
	{
		/**
		 * there is only one iteration
		 */
		foreach ($sorting->getSort() as $column => $order) {
			$this->sort_column = $column;
			$this->order_column = $order;
		}

		return $this;
	}
766543
protected function addSorting(QueryBuilder $queryBuilder, array $sorting = [])
    {
        foreach ($sorting as $field => $sortOrder) {
            if (!$this->isFieldSortable($field)) {
                // Skip: invalid field
                continue;
            }
            if (!$this->isSortOrderValid($sortOrder)) {
                // Skip: invalid sort order
                continue;
            }

            $methodName = sprintf('add%sSorting', ucfirst($field));
            if (method_exists($this, $methodName)) {
                $this->$methodName($queryBuilder, $sortOrder);
                continue;
            }

            $queryBuilder->addOrderBy($this->addEntityAlias($field), strtolower($sortOrder));
        }

        return $queryBuilder;
    }
1214027
public function byFieldValue(
        string $field,
        string $order
    ): SortBy {
        $this->sortsBy[] = [
            'type' => self::TYPE_FIELD,
            'field' => Item::getPathByField($field),
            'order' => $order,
        ];

        return $this;
    }
910964
public function setSortingField($sort, $write = true)
    {
        Symphony::Configuration()->set('section_' . $this->get('handle') . '_sortby', $sort, 'sorting');

        if ($write) {
            Symphony::Configuration()->write();
        }
    }
174528
public function sort ($sort_on, $order = 'desc') {
		$queryString = '<FieldRef Name="'  .$sort_on . '" Ascending="' . $this->api->getSortFromValue($order) . '" />';
		$this->sort_caml = '<OrderBy>' . $queryString . '</OrderBy>';

		return $this;
	}
225252
public void setSortOrder(final java.lang.String sortOrder) {
        // when updating, make sure we store off the original so it may be
        // restored
        final String orig = (String) getStateHelper().get(PropertyKeys.origSortOrder);
        if (orig == null) {
            // do not call getSortOrder as it defaults to ascending, we want
            // null
            // if this is the first call and there is no previous value.
            getStateHelper().put(PropertyKeys.origSortOrder, getStateHelper().eval(PropertyKeys.sortOrder));
        }
        getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
    }