@@ 219-228 (lines=10) @@ | ||
216 | $this->applyRootCondition($nodeCountCondition); |
|
217 | $nodeChildren = $this->getChildIds($nodeCountCondition); |
|
218 | $siblingsDelta = count($nodeChildren) * 2; |
|
219 | if ($position == 0) { |
|
220 | $compareRight = $this->parent->{$this->leftAttribute} + 1; |
|
221 | } else { |
|
222 | if (false === isset($siblings[$position - 1])) { |
|
223 | return ['error' => Yii::t('jstw', 'New previous sibling does not exist')]; |
|
224 | } |
|
225 | $newPrevSiblingId = $siblings[$position - 1]; |
|
226 | $newPrevSiblingData = $this->getLr($newPrevSiblingId); |
|
227 | $compareRight = $newPrevSiblingData[$newPrevSiblingId][$this->rightAttribute]; |
|
228 | } |
|
229 | if ($this->node->{$this->leftAttribute} > $compareRight) { |
|
230 | //move node up |
|
231 | if ($position == 0) { |
|
@@ 369-378 (lines=10) @@ | ||
366 | ]; |
|
367 | $nodeChildren = $this->getChildIds($nodeCountCondition); |
|
368 | $siblingsDelta = count($nodeChildren) * 2; |
|
369 | if ($position == 0) { |
|
370 | $leftFrom = $this->parent->{$this->leftAttribute} + 1; |
|
371 | } else { |
|
372 | if (false === isset($siblings[$position - 1])) { |
|
373 | return ['error' => Yii::t('jstw', 'New previous sibling does not exist')]; |
|
374 | } |
|
375 | $newPrevSiblingId = $siblings[$position - 1]; |
|
376 | $newPrevSiblingData = $this->getLr($newPrevSiblingId); |
|
377 | $leftFrom = $newPrevSiblingData[$newPrevSiblingId][$this->rightAttribute] + 1; |
|
378 | } |
|
379 | if ($this->node->{$this->leftAttribute} > $leftFrom) { |
|
380 | $nodeDelta = $this->node->{$this->leftAttribute} - $leftFrom; |
|
381 | $nodeOperator = '-'; |