Detailed Description

SortController is used to change the order of nodes.

Nodes can either be sorted in a list of nodes of the same type (moveBefore action) or in a list of child nodes of a container node (insertBefore action).

The controller supports the following actions:

Action moveBefore
Insert an object before a reference object in the list of all objects of the same type.
Parameter Description
in insertOid The object id of the object to insert/move
in referenceOid The object id of the object to insert the inserted object before. If the inserted object should be the last in the container order, the referenceOid contains the special value ORDER_BOTTOM
Response Actions
ok In all cases
Action insertBefore
Insert an object before a reference object in the order of a container object.
Parameter Description
in containerOid The oid of the container object
in insertOid The oid of the object to insert/move
in referenceOid The object id of the object to insert the inserted object before. If the inserted object should be the last in the container order, the referenceOid contains the special value ORDER_BOTTOM
in role The role, that the inserted object should have in the container object.
Response Actions
ok In all cases
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 60 of file SortController.php.

+ Inheritance diagram for SortController:

Public Attributes

const ORDER_BOTTOM = 'ORDER_BOTTOM'
 
const UNBOUND = 'UNBOUND'
 
- Public Attributes inherited from Controller
const CSRF_TOKEN_PARAM = 'csrf_token'
 

Protected Member Functions

 validate ()
 
 doExecute ($method=null)
 
 doMoveBefore ()
 
 doInsertBefore ()
 
 loadPreviousObject ($type, $sortkeyName, $sortkeyValue, $sortDirection)
 
 loadLastObject ($type, $sortkeyName, $sortDirection)
 
 checkObjects ($objectMap)
 
 isOrderBotton ($request)
 
 getSortkeyValue ($object, $valueName)
 
- Protected Member Functions inherited from Controller
 executeSubAction ($action)
 
 redirect ($location, $key=null, $data=null)
 
 getLogger ()
 
 getSession ()
 
 getPersistenceFacade ()
 
 getPermissionManager ()
 
 getActionMapper ()
 
 getLocalization ()
 
 getMessage ()
 
 getConfiguration ()
 
 requireTransaction ()
 
 endTransaction ($commit)
 
 isLocalizedRequest ()
 
 checkLanguageParameter ()
 
 generateCsrfToken ($name, $refresh=true)
 
 validateCsrfToken ($name, $invalidate=true)
 
 getLocalSessionValue ($key, $default=null)
 
 setLocalSessionValue ($key, $value)
 
 clearLocalSessionValues ()
 

Additional Inherited Members

- Public Member Functions inherited from Controller
 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
 
 initialize (Request $request, Response $response)
 
 execute ($method=null)
 
 getRequest ()
 
 getResponse ()
 

Member Function Documentation

◆ validate()

validate ( )
protected
See also
Controller::validate()

Reimplemented from Controller.

Definition at line 68 of file SortController.php.

◆ doExecute()

doExecute (   $method = null)
protected
See also
Controller::doExecute()

Reimplemented from Controller.

Definition at line 135 of file SortController.php.

◆ doMoveBefore()

doMoveBefore ( )
protected

Execute the moveBefore action.

Definition at line 154 of file SortController.php.

◆ doInsertBefore()

doInsertBefore ( )
protected

Execute the insertBefore action.

Definition at line 197 of file SortController.php.

◆ loadPreviousObject()

loadPreviousObject (   $type,
  $sortkeyName,
  $sortkeyValue,
  $sortDirection 
)
protected

Load the object which order position is before the given sort value.

Parameters
$typeThe type of objects
$sortkeyNameThe name of the sortkey attribute
$sortkeyValueThe reference sortkey value
$sortDirectionThe sort direction used with the sort key

Definition at line 249 of file SortController.php.

◆ loadLastObject()

loadLastObject (   $type,
  $sortkeyName,
  $sortDirection 
)
protected

Load the last object regarding the given sort key.

Parameters
$typeThe type of objects
$sortkeyNameThe name of the sortkey attribute
$sortDirectionThe sort direction used with the sort key

Definition at line 264 of file SortController.php.

◆ checkObjects()

checkObjects (   $objectMap)
protected

Check if all objects in the given array are not null and add an OID_INVALID error to the response, if at least one is.

Parameters
$objectMapAn associative array with the controller parameter names as keys and the objects to check as values
Returns
Boolean

Definition at line 279 of file SortController.php.

◆ isOrderBotton()

isOrderBotton (   $request)
protected

Check if the node should be moved to the bottom of the list.

Parameters
$requestThe request
Returns
Boolean

Definition at line 300 of file SortController.php.

◆ getSortkeyValue()

getSortkeyValue (   $object,
  $valueName 
)
protected

Get the sortkey value of an object.

Defaults to the object's id, if the value is null

Parameters
$objectThe object
$valueNameThe name of the sortkey attribute
Returns
String

Definition at line 311 of file SortController.php.

Member Data Documentation

◆ ORDER_BOTTOM

const ORDER_BOTTOM = 'ORDER_BOTTOM'

Definition at line 62 of file SortController.php.

◆ UNBOUND

const UNBOUND = 'UNBOUND'

Definition at line 63 of file SortController.php.