Изменение порядкового номера структуры в дереве

@param int $navID селектор-ИД структуры
@param     $direction - вид изменения

@return array - AJAX - response
434799
public function __async_priority($navID = 0, $direction = 1, $parentId = 0)
    {
        /** @var CMSNav $data */
        $data = null;
        $response = array('status' => 0);

        if (dbQuery('\samson\cms\web\navigation\CMSNav')->id($navID)->first($data)) {
            $data->priority($direction);
            $response['status'] = 1;
        }

        // return Ajax response
        return $this->__async_tree($parentId);
    }
890457
public function getRealDirection($direction)
    {
        if ($direction == 'in' || $direction == 'out')
        {
            $direction = ucfirst($direction);

        } elseif ($direction == 'any')
        {
            $direction = 'All';

        } else
        {
            throw new UnknownDirectionException($direction);
        }

        $direction = "Direction". $direction;

        return constant("Everyman\Neo4j\Relationship::". $direction);
    }
236598
public function getEncoding($direction)
    {
        if (!isset($this->encoding[$direction])) {
            throw new Exception("Encoding direction invalid");
        }

        return $this->encoding[$direction];
    }
471499
public function exitTo($direction)
    {
        $this->setupKeyframes();

        $this->animate($this->keyframes->exitTo($this->getLines(), $direction));
    }
891937
private function pad($padding = 1, $direction = STR_PAD_BOTH): string
    {
        return str_pad($this->number, $padding, 0, $direction);
    }
843525
public function getPointByDirection($direction, $width = 0, $height = 0) {
		if (empty($width) || empty($height)) {
			$width = $this->getWidth() / 3;
			$height = $this->getHeight() / 3;
			return array(
				$direction % 3 * $width,
				$direction / 3 * $height,
				$width,
				$height
			);
		}
		switch ($direction) {
			case self::Center:
				return array(
					($this->getWidth() - $width) / 2,
					($this->getHeight() - $height) / 2,
					$width,
					$height
				);
			case self::Left:
				return array(
					0,
					($this->getHeight() - $height) / 2,
					$width,
					$height
				);
			case self::Top:
				return array(
					($this->getWidth() - $width) / 2,
					0,
					$width,
					$height
				);
			case self::RightTop:
				return array(
					$this->getWidth() - $width,
					0,
					$width,
					$height
				);
			case self::Right:
				return array(
					$this->getWidth() - $width,
					($this->getHeight() - $height) / 2,
					$width,
					$height
				);
			case self::RightBottom:
				return array(
					$this->getWidth() - $width,
					$this->getHeight() - $height,
					$width,
					$height
				);
			case self::Bottom:
				return array(
					($this->getWidth() - $width) / 2,
					$this->getHeight() - $height,
					$width,
					$height
				);
			case self::LeftBottom:
				return array(
					0,
					$this->getHeight() - $height,
					$width,
					$height
				);

			case self::LeftTop:
			default:
				return array(
					0,
					0,
					$width,
					$height
				);
		}
	}
740744
public function getCursor($direction)
    {
        if (isset($this->metaData['paging']['cursors'][$direction])) {
            return $this->metaData['paging']['cursors'][$direction];
        }

        return null;
    }
61442
protected function _getUpdateExpression($direction = '+')
    {
        $field = $this->_config['order'];

        return $this->_table->query()->newExpr()
            ->add(new IdentifierExpression($field))
            ->add('1')
            ->setConjunction($direction);
    }
1111185
private function getFirstLastEvent(string $direction): string
    {
        $row    = $this->eventQuery($direction);
        $result = I18N::translate('This information is not available.');

        if ($row) {
            $record = GedcomRecord::getInstance($row->id, $this->tree);

            if ($record && $record->canShow()) {
                $result = $record->formatList();
            } else {
                $result = I18N::translate('This information is private and cannot be shown.');
            }
        }

        return $result;
    }
637388
public function exitTo($lines, $direction)
    {
        $lines       = $this->adjustLines($lines, $direction);
        $line_method = $this->getLineMethod($direction);

        $direction_keyframes = $this->getDirectionFrames($direction, $lines, $line_method);

        $keyframes   = array_fill(0, 4, $lines);
        $keyframes   = array_merge($keyframes, $direction_keyframes);
        $keyframes[] = array_fill(0, count($lines), '');

        return $keyframes;
    }
240615
public function __async_form($parentID = 0, $navID = 0)
    {
        /** @var CMSNav $data */
        $data = null;

        if (dbQuery('\samson\cms\web\navigation\CMSNav')->StructureID($navID)->first($data)) {
            if (dbQuery('\samson\cms\CMSMaterial')->id($data->MaterialID)->first($mat)) {
                m()->cmsmaterial($mat);
            }
            $parent_id = $parentID;
        } else {
            $parent_id = 0;
            if (dbQuery('\samson\cms\web\navigation\CMSNav')->id($parentID)->first($nav)) {
                if (isset($nav->parent()->id)) {
                    $parent_id = $nav->parent()->id;
                }
            }
        }

        // Render form
        $html = m()->view('form/form')
            ->parent_select(CMSNav::createSelect($parentID))
            ->cmsnav($data)
            ->parent_id($parent_id)
            ->output();

        return array(
            'status'=>1,
            'html'=>$html
        );
    }
394423
public function setDirection($direction)
    {
        if ($direction !== self::DIRECTION_FORWARD && $direction !== self::DIRECTION_REVERSE && $direction !== self::DIRECTION_BOTH) {
            throw new InvalidArgumentException('Invalid direction given');
        }
        $this->direction = $direction;

        return $this;
    }
672751
public function orderBy($fields, $direction = false)
    {
        $this->orderBy->addFields($fields, $direction);

        return $this;
    }
45489
public function groupBy($fields, $direction = false)
    {
        $this->groupBy->addFields($fields, $direction);

        return $this;
    }
269857
public static function get_move_tour_link($tourid, $direction = self::MOVE_DOWN) {
        $link = new \moodle_url('/admin/tool/usertours/configure.php');

        $link->param('action', manager::ACTION_MOVETOUR);
        $link->param('id', $tourid);
        $link->param('direction', $direction);
        $link->param('sesskey', sesskey());

        return $link;
    }
1013990
private function navigate(
        $data,
        $direction,
        $format,
        ContextInterface $context = null,
        TypeMetadataInterface $type = null
    ) {
        $visitor = $this->visitorRegistry->getVisitor($direction, $format);

        $context = $context ?: new Context();
        $context->initialize($this->navigator, $visitor, $direction, $format);
        $this->navigator->navigate($visitor->prepare($data, $context), $context, $type);

        return $visitor->getResult();
    }
74648
public function withDirection(Direction $direction)
    {
        return new static($direction, $this->forced, $this->dryRun, $this->exceptionOnSkip, $this->custom);
    }