Move an item before an existing item.

@param integer $moveItemId
@param integer $droppedBeforeItemId
@return array
427690
public function actionMoveBefore($moveItemId, $droppedBeforeItemId)
    {
        $result = Nav::moveToBefore($moveItemId, $droppedBeforeItemId);
        
        if ($result !== true) {
            Yii::$app->response->setStatusCode(422, 'Found URL alias duplication in drop target "'.$result['title'].'".');
        }
        
        return ['success' => $result];
    }
365866
func (all *assetLruList) MoveBefore(alle, mark *assetLruListElement) {
	if alle.list != all || alle == mark || mark.list != all {
		return
	}
	all.insert(all.remove(alle), mark.prev)
}
1112559
public function getItemsRaw($limit = null, $offset = null, array $uids = [], array $skipItemIds = [])
    {
        throw new Exception(new Phrase(self::NOT_ENABLED_ERROR));
    }
849918
public void moveItem(Point oldCoordinates, Point newCoordinates) {
	assertEDT();
	if (oldCoordinates == null || newCoordinates == null) {
	    throw new IllegalArgumentException("Coordinates cannot be null");
	}
	if (getPanelAt(newCoordinates).hasModel()) {
	    throw new IllegalStateException(
		    "New position contains a model in the UI already. New position = " + newCoordinates);
	}
	if (!getPanelAt(oldCoordinates).hasModel()) {
	    throw new IllegalStateException("Old position doesn't contain a model in the UI. Old position = "
		    + oldCoordinates);
	}
	// all good
	Drawable item = getPanelAt(oldCoordinates).getModel();
	removeItem(oldCoordinates);
	addItem(newCoordinates, item);

    }
1059303
public static function moveToChild($moveNavId, $droppedOnItemId)
    {
        $move = self::findOne($moveNavId);
        $on = self::findOne($droppedOnItemId);
        
        if (!$move || !$on) {
            return false;
        }

        $response = self::checkDuplicateAlias($move->id, $on->id);
        
        if ($response !== true) {
            return $response;
        }

        $move->nav_container_id = $on->nav_container_id;
        $move->parent_nav_id = $on->id;
        $move->update();

        foreach ($move->getRecursiveChildren() as $child) {
            $child->updateAttributes(['nav_container_id' => $on->nav_container_id]);
        }
        
        return true;
    }
408591
public void insertBefore(String name, FormItem... newItem) {
		int index = indexOf(name);
		if (index >= 0) {
			addAll(index, Arrays.asList(newItem));
		}
	}
1335853
protected function moveNode(Node\NodeInterface $item, $moveLeft, $moveRight, $moveLevel)
	{
//		$newLeft = $item->getLeftValue() + (int) $moveLeft;
//		$newRight = $item->getRightValue() + (int) $moveRight;
//		$newLevel = $item->getLevel() + (int) $moveLevel;
//
// Call original local move method for items not in the database yet
		parent::moveNode($item, $moveLeft, $moveRight, $moveLevel);

// In case of entity update, make the new nested set values to be ignored
		$insert = $this->entityManager->getUnitOfWork()->isScheduledForInsert($item);
		if ( ! $insert) {
			$oid = spl_object_hash($item);
			$this->entityManager->getUnitOfWork()->setOriginalEntityProperty($oid, 'level', $item->getLevel());
			$this->entityManager->getUnitOfWork()->setOriginalEntityProperty($oid, 'right', $item->getRightValue());
			$this->entityManager->getUnitOfWork()->setOriginalEntityProperty($oid, 'left', $item->getLeftValue());
		}

//
//		if ($insert) {
//			// Call original local move method for items not in the database yet
//			parent::moveNode($item, $moveLeft, $moveRight, $moveLevel);
//		} else {
//			// Refresh so additional UPDATE-s are not executed on the server
//			$this->entityManager->refresh($item);
//		}
//		// Double check the values, should not happen
//		if ($item->getLeftValue() != $newLeft) {
//			$item->setLeftValue($newLeft);
//		}
//		if ($item->getRightValue() != $newRight) {
//			$item->setRightValue($newRight);
//		}
//		if ($item->getLevel() != $newLevel) {
//			$item->setLevel($newLevel);
//		}
	}
1238318
public function move_item_right($id) {
        global $DB;

        $peers = $this->get_items_peers($id);
        $itemkey = array_search($id, $peers);
        if (!isset($peers[$itemkey-1])) {
            print_error('listcantmoveright');
        } else {
            $DB->set_field($this->table, "parent", $peers[$itemkey-1], array("id"=>$peers[$itemkey]));
            $newparent = $this->find_item($peers[$itemkey-1]);
            if (isset($newparent->children)) {
                $newpeers = $newparent->children->get_child_ids();
            }
            if ($newpeers) {
                $newpeers[] = $peers[$itemkey];
                $this->reorder_peers($newpeers);
            }
        }
    }
603821
def move_item(self, item, origin, destination):
        
        if self.equality:
            item_index = 0
            for i, element in enumerate(origin):
                if self.equality(element, item):
                    item_index = i
                    break
        else:
            item_index = origin.index(item)

        destination.append(origin.pop(item_index))
902609
protected void moveChild(BaseUIComponent child, BaseUIComponent before) {
        child.getParent().addChild(child, before);
    }
224547
public function update($itemData, $createIfAbsent = false)
    {
        $newData = $this->preUpdate($itemData, $createIfAbsent);
        $result = $this->dataStore->update($newData, $createIfAbsent);

        return $this->postUpdate($result, $newData, $createIfAbsent);
    }
897389
private void doMoveSelectedEntriesInList(int moveBy)
	{
		PlayListEntry [] selected = playList.getSelectedEntries();
		if (selected!=null)
		{
			playlistUpdateThread.halt();
			try
			{
				if (moveBy < 0)
				{
					// Moveup --> Still possible?
					if ((selected[0].getIndexInPlaylist() + moveBy) < 0)
						moveBy = selected[0].getIndexInPlaylist();
					if (moveBy == 0) return;
					
					for (int i=0; i<selected.length; i++)
					{
						int fromIndex = selected[i].getIndexInPlaylist();
						playList.move(fromIndex, fromIndex + moveBy);
					}
				}
				else
				{
					// Movedown --> Still possible?
					int lastIndex = selected.length - 1;
					if ((selected[lastIndex].getIndexInPlaylist() + moveBy) >= playList.size())
						moveBy = playList.size() - 1 - selected[lastIndex].getIndexInPlaylist();
					if (moveBy == 0) return;
					
					for (int i=lastIndex; i>=0; i--)
					{
						int fromIndex = selected[i].getIndexInPlaylist();
						playList.move(fromIndex, fromIndex + moveBy);
					}
				}
				int showIndex = (moveBy<0)?selected[0].getIndexInPlaylist()-PLUS_LINES_VISABLE:selected[selected.length-1].getIndexInPlaylist()+PLUS_LINES_VISABLE;   
				createList(showIndex);
				firePlaylistChanged();
			}
			finally
			{
				playlistUpdateThread.restart();
			}
		}
	}
433748
func (l *PacketIntervalList) MoveBefore(e, mark *PacketIntervalElement) {
	if e.list != l || e == mark || mark.list != l {
		return
	}
	l.insert(l.remove(e), mark.prev)
}
161257
protected function sortListBefore($packageKey, array $packagesToLoadBefore)
    {
        $unresolvedDependencies = 0;
        foreach ($packagesToLoadBefore as $composerNameToLoadBefore) {
            if (!$this->packageRequirementIsComposerPackage($composerNameToLoadBefore)) {
                continue;
            }

            if (isset($this->sortedPackages[$packageKey])) {
                // "Success" case: a required package is already sorted in front of our current $packageKey.
                continue;
            }

            if (isset($this->unsortedPackages[$composerNameToLoadBefore])) {
                $resolved = $this->sortPackage($composerNameToLoadBefore);
                if (!$resolved) {
                    $unresolvedDependencies++;
                }
            }
        }

        return $unresolvedDependencies;
    }
558717
private function getDroppedColumns(Table $oldTable, Table $newTable)
    {
        $droppedColumns = array();

        foreach ($oldTable->getColumns() as $column) {
            if (!$newTable->hasColumn($column->getName())) {
                $droppedColumns[] = $column;
            }
        }

        return $droppedColumns;
    }
785023
public int moveIt(boolean bDisplayOption, int iMoveMode)
    {
        if (m_convCheckMark != null) if (m_convCheckMark.getState() == false)
            return DBConstants.NORMAL_RETURN;       // If check mark is false (or no check mark), don't move
        return super.moveIt(bDisplayOption, iMoveMode);
    }
128002
public function copyItem(string $targetId, string $itemId, bool $overwrite = false):array
    {
        $parameters = $this->buildHttpQuery(
            [
                'targetid'  => $targetId,
                'overwrite' => $overwrite,
            ]
        );

        return $this->post("Items({$itemId})/Copy?{$parameters}");
    }