Updates parent and positiong properties of all records of current content type

@param array $sorting array [recordId=>parentId]
3652
public function sortRecords(array $sorting)
    {
        $this->flushCacheBeforeChange();

        $result = parent::sortRecords($sorting);
        $this->flushCacheAfterChange();

        return $result;
    }
668065
function set_sort_order($sort_col, $sort_order = null)
    {
        if ($this->coltypes[$sort_col]['attributes'])
            $this->sort_col = $this->coltypes[$sort_col]['attributes'][0];
    }
485622
public function set_sortorder($sortorder) {
        if ($this->sortorder == $sortorder) {
            return;
        }
        $this->sortorder = $sortorder;
        $this->update();
    }
383028
public function orderBy(string $sort, string $order = 'ASC'): self
    {
        $order = 'ASC' === strtoupper($order) ? 'ASC' : 'DESC';
        $this->orderBy = [$sort => $order];
        return $this;
    }
1246210
private function incrementPositions(array $conditions, ?int $startPosition = null, ?int $endPosition = null): void
    {
        $columnName = $conditions['column'];

        $query = $this->connection->createQueryBuilder();

        $query
            ->update($conditions['table'])
            ->set($columnName, $columnName . ' + 1');

        if ($startPosition !== null) {
            $query->andWhere($query->expr()->gte($columnName, ':start_position'));
            $query->setParameter('start_position', $startPosition, Type::INTEGER);
        }

        if ($endPosition !== null) {
            $query->andWhere($query->expr()->lte($columnName, ':end_position'));
            $query->setParameter('end_position', $endPosition, Type::INTEGER);
        }

        $this->applyConditions($query, $conditions['conditions']);

        $query->execute();
    }
267161
public function move(array $data, $position = 0, $insertType = self::INSERT_NODE)
    {
        // get key of node we are moving.
        $id = $data[$this->getPrimaryKey()];

        $this->getHydrator()->addDepth();

        // node and it's children
        $select = $this->getDecendentsByParentId($id, false);
        $nodes = $this->fetchResult($select);

        // get the width of the node.
        $width = $nodes->current()->width();

        // take out the left and right values of list from database.
        $where = new Where();
        $where->between(self::COLUMN_LEFT, $nodes->current()->getLft(), $nodes->current()->getRgt());
        $result = $this->update([
            'lft' => null,
            'rgt' => null,
        ], $where);

        // update left and right values.
        $this->updateTree($nodes->current()->getRgt(), '-', $width);

        // get the new parent and it's children
        // and make room for moved node
        if ($position != 0) {
            /* @var $parent \UthandoCommon\Model\NestedSet */
            $parent = $this->getById($position);
            $lft_rgt = ($insertType === self::INSERT_NODE) ? $parent->getRgt() : $parent->getLft();
        } else {
            $lft_rgt = 0;
        }

        // update left and right values
        $this->updateTree($lft_rgt, '+', $width);

        // insert moved category.
        $reduce = $nodes->current()->getRgt() - $width;
        $getter = 'get' . ucfirst($this->getPrimaryKey());

        /* @var $row \UthandoCommon\Model\NestedSet */
        foreach ($nodes as $row) {
            $lft = ($row->getLft() - $reduce);
            $rgt = ($row->getRgt() - $reduce);

            if ($position != 0) {
                $rgt += $lft_rgt;
                $lft += $lft_rgt;
            }

            $result = $this->update([
                'rgt' => $rgt,
                'lft' => $lft,
            ], [$this->getPrimaryKey() => $row->$getter()]);
        }

        return $result;
    }
366242
protected function ensureSortOrder(
        array $sortOrderCondition = [],
        string $sortOrderAttribute = 'sortOrder'
    ) {
        if ($this->getAttribute($sortOrderAttribute) === null) {
            $this->setAttribute(
                $sortOrderAttribute,
                $this->nextSortOrder(
                    $sortOrderCondition,
                    $sortOrderAttribute
                )
            );
        }
    }
1076995
public function setOrder($sortParam)
    {

        if (!isset($sortParam) || !is_string($sortParam)) return;

        if (substr($sortParam, 0, 1) == '-') {
            $direction = SORT_DESC;
            $sortParam = substr($sortParam, 1);
        } else {
            $direction = SORT_ASC;
        }
        if (array_key_exists($sortParam, $this->attributes)) {
            $this->orderBy = [$sortParam => $direction];
        }
    }
789527
public function applySort()
    {
        parent::applySort();

        if ($this->getSortBy() && $this->itemCreate) {
            //Remove previous click handler to Add new Item button and attach new one using sort argument.
            $this->container->js(true, $this->itemCreate->js()->off('click.atk_CRUD'));
            $this->container->js(true,
                                 $this->itemCreate->js()->on('click.atk_CRUD',
                                 new jsFunction([
                                     new jsModal('Add new', $this->pageCreate, [$this->name.'_sort' => $this->getSortBy()]),
                                 ]))
            );
        }
    }
1325274
protected function setActiveSorting()
    {
        $this->sSorting = Input::get('sort');
        if (empty($this->sSorting)) {
            $this->sSorting = $this->property('sorting');
        }
    }
707300
protected function set_new_sortorder() {
        $search = array('parentid' => $this->get('parentid'), 'competencyframeworkid' => $this->get('competencyframeworkid'));
        $this->raw_set('sortorder', $this->count_records($search));
    }
1289453
public function setSorts(array $sorts)
    {
        $this->sorts = array();

        foreach ($sorts as $sort) {
            $this->addSort($sort);
        }
        
        return $this;
    }
1161897
protected function applySorting(QueryBuilder $queryBuilder, array $sorting = null)
    {
        if (null === $sorting) {
            return;
        }

        foreach ($sorting as $property => $order) {
            if (!empty($order)) {
                $queryBuilder->orderBy($this->getPropertyName($property), $order);
            }
        }
    }
750634
public function addOrderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
    }
1074554
protected function addSort($qb, $sort)
    {
        foreach ($sort as $property => $direction) {
            $qb->addOrderBy($property, $direction);
        }
    }
721691
public function arSort($sort = null)
    {
        if ($sort !== null && ! is_int($sort)) {
            throw new \InvalidArgumentException(
                'Invalid sort type. Sort type must ne integer.',
                E_USER_ERROR
            );
        }

        return $sort === null
            ? arsort($this->storedData)
            : arsort($this->storedData, $sort);
    }
227749
public function setBasicCriteria(array $archives, $sorting = null)
    {
        $archives = $this->parseIds($archives);

        if (0 === \count($archives)) {
            throw new NoNewsException();
        }

        $t = $this->getNewsModelAdapter()->getTable();

        $this->columns[] = "$t.pid IN(".\implode(',', \array_map('intval', $archives)).')';

        // Set the sorting
        switch ($sorting) {
            case 'order_headline_asc':
                $this->options['order'] = "$t.headline";
                break;
            case 'order_headline_desc':
                $this->options['order'] = "$t.headline DESC";
                break;
            case 'order_random':
                $this->options['order'] = 'RAND()';
                break;
            case 'order_date_asc':
                $this->options['order'] = "$t.date";
                break;
            default:
                $this->options['order'] = "$t.date DESC";
                break;
        }

        // Never return unpublished elements in the back end, so they don't end up in the RSS feed
        if (!BE_USER_LOGGED_IN || TL_MODE === 'BE') {
            /** @var Date $dateAdapter */
            $dateAdapter = $this->framework->getAdapter(Date::class);

            $time = $dateAdapter->floorToMinute();
            $this->columns[] = "($t.start=? OR $t.start<=?) AND ($t.stop=? OR $t.stop>?) AND $t.published=?";
            $this->values = \array_merge($this->values, ['', $time, '', ($time + 60), 1]);
        }
    }