@@ 211-220 (lines=10) @@ | ||
208 | $this->applyRootCondition($nodeCountCondition); |
|
209 | $nodeChildren = $this->getChildIds($nodeCountCondition); |
|
210 | $siblingsDelta = count($nodeChildren) * 2; |
|
211 | if ($position == 0) { |
|
212 | $compareRight = $this->parent->{$this->leftAttribute} + 1; |
|
213 | } else { |
|
214 | if (false === isset($siblings[$position - 1])) { |
|
215 | return ['error' => Yii::t('jstw', 'New previous sibling not exists')]; |
|
216 | } |
|
217 | $newPrevSiblingId = $siblings[$position - 1]; |
|
218 | $newPrevSiblingData = $this->getLr($newPrevSiblingId); |
|
219 | $compareRight = $newPrevSiblingData[$newPrevSiblingId][$this->rightAttribute]; |
|
220 | } |
|
221 | if ($this->node->{$this->leftAttribute} > $compareRight) { |
|
222 | //move node up |
|
223 | if ($position == 0) { |
|
@@ 358-367 (lines=10) @@ | ||
355 | ]; |
|
356 | $nodeChildren = $this->getChildIds($nodeCountCondition); |
|
357 | $siblingsDelta = count($nodeChildren) * 2; |
|
358 | if ($position == 0) { |
|
359 | $leftFrom = $this->parent->{$this->leftAttribute} + 1; |
|
360 | } else { |
|
361 | if (false === isset($siblings[$position - 1])) { |
|
362 | return ['error' => Yii::t('jstw', 'New previous sibling not exists')]; |
|
363 | } |
|
364 | $newPrevSiblingId = $siblings[$position - 1]; |
|
365 | $newPrevSiblingData = $this->getLr($newPrevSiblingId); |
|
366 | $leftFrom = $newPrevSiblingData[$newPrevSiblingId][$this->rightAttribute] + 1; |
|
367 | } |
|
368 | if ($this->node->{$this->leftAttribute} > $leftFrom) { |
|
369 | $nodeDelta = $this->node->{$this->leftAttribute} - $leftFrom; |
|
370 | $nodeOperator = '-'; |