public function moveAction()
	{
		$this->isPostRequest();
		
		$localization = $this->getPageLocalization();

		$page = $localization->getMaster();
		
		$input = $this->getRequestInput();

		$this->lockNestedSet($page);

		try {
			if ($input->has('reference_id')) {
				$sibling = $this->getPageByRequestKey('reference_id');

				if ($sibling === null) {
					throw new CmsException(null, sprintf('Sibling page [%s] not found.', $input->get('reference_id')));
				}

				if ($input->get('reference_type', 'before') === 'after') {
					$page->moveAsNextSiblingOf($sibling);
				} else {
					$page->moveAsPrevSiblingOf($sibling);
				}
				
			} elseif ($input->has('parent_id')) {

				$parent = $this->getPageByRequestKey('parent_id');

				if ($parent === null) {
					throw new CmsException(null, sprintf('Parent page [%s] not found.', $input->get('parent_id')));
				}

				$parent->addChild($page);
			} else {
				throw new \RuntimeException('Move destination is unknown.');
			}

		} catch (DuplicatePagePathException $e) {
			throw new CmsException('sitemap.error.duplicate_path');
		}

		$this->unlockNestedSet($page);

		return new SupraJsonResponse();
	}
public function moveAction()
	{
		$this->isPostRequest();
		
		$localization = $this->getPageLocalization();

		$page = $localization->getMaster();
		
		$input = $this->getRequestInput();

		$this->lockNestedSet($page);

		try {
			if ($input->has('reference_id')) {
				$sibling = $this->getPageByRequestKey('reference_id');

				if ($sibling === null) {
					throw new CmsException(null, sprintf('Sibling page [%s] not found.', $input->get('reference_id')));
				}

				if ($input->get('reference_type', 'before') === 'after') {
					$page->moveAsNextSiblingOf($sibling);
				} else {
					$page->moveAsPrevSiblingOf($sibling);
				}
				
			} elseif ($input->has('parent_id')) {

				$parent = $this->getPageByRequestKey('parent_id');

				if ($parent === null) {
					throw new CmsException(null, sprintf('Parent page [%s] not found.', $input->get('parent_id')));
				}

				$parent->addChild($page);
			} else {
				throw new \RuntimeException('Move destination is unknown.');
			}

		} catch (DuplicatePagePathException $e) {
			throw new CmsException('sitemap.error.duplicate_path');
		}

		$this->unlockNestedSet($page);

		return new SupraJsonResponse();
	}
public function moveAction ( ) { $ this -> isPostRequest ( ) ; $ localization = $ this -> getPageLocalization ( ) ; $ page = $ localization -> getMaster ( ) ; $ input = $ this -> getRequestInput ( ) ; $ this -> lockNestedSet ( $ page ) ; try { if ( $ input -> has ( 'reference_id' ) ) { $ sibling = $ this -> getPageByRequestKey ( 'reference_id' ) ; if ( $ sibling === null ) { throw new CmsException ( null , sprintf ( 'Sibling page [%s] not found.' , $ input -> get ( 'reference_id' ) ) ) ; } if ( $ input -> get ( 'reference_type' , 'before' ) === 'after' ) { $ page -> moveAsNextSiblingOf ( $ sibling ) ; } else { $ page -> moveAsPrevSiblingOf ( $ sibling ) ; } } elseif ( $ input -> has ( 'parent_id' ) ) { $ parent = $ this -> getPageByRequestKey ( 'parent_id' ) ; if ( $ parent === null ) { throw new CmsException ( null , sprintf ( 'Parent page [%s] not found.' , $ input -> get ( 'parent_id' ) ) ) ; } $ parent -> addChild ( $ page ) ; } else { throw new \ RuntimeException ( 'Move destination is unknown.' ) ; } } catch ( DuplicatePagePathException $ e ) { throw new CmsException ( 'sitemap.error.duplicate_path' ) ; } $ this -> unlockNestedSet ( $ page ) ; return new SupraJsonResponse ( ) ; }
Handles Page move request.
Handles Page move request .