wCMF
3.6
|
Public Member Functions | |
hasView () | |
validate () | |
executeKernel () | |
getSortColumn () | |
swapNodes (&$node1, &$node2, $doSave) | |
sortAll () | |
![]() | |
Controller (&$delegate) | |
initialize (&$request, &$response) | |
validate () | |
hasView () | |
execute () | |
executeKernel () | |
getErrorMsg () | |
setErrorMsg ($msg) | |
appendErrorMsg ($msg) | |
& | getRequest () |
& | getResponse () |
& | getView () |
& | getDelegate () |
getViewTemplate ($controller, $context, $action) | |
getCacheId () | |
assignViewDefaults (&$view) | |
isLocalizedRequest () | |
Additional Inherited Members | |
![]() | |
$_request = null | |
$_response = null | |
$_errorMsg = '' | |
$_view = null | |
$_delegate = null | |
SortController is a controller that sorts Nodes of same type.
wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH
Licensed under the terms of any of the following licenses at your choice:
See the license.txt file distributed with this work for additional information.
This Controller sorts the Nodes by responding to the 'sortup', 'sortdown' action names. It requires a parameter 'sortoid' which tells to which Node the action should be applied. According to the given action the Nodes sortkey attribute will be changed the way that it either swaps with its predecessor ('prevoid') or with its successor ('nextoid') or move a given distance ('dist') in a list of nodes that is either defined by the 'filter' or the 'poid' parameter. If none of the both parameters is given, the list contains all entities that have the same type as the type defined by 'sortoid'.
After using the NodeUtil::setSortProperties method on a list of Nodes you could write the following Smarty template code to support sorting:
Input actions:
Output actions:
[in] | sortoid | The oid of the Node to change its sortkey. The Controller assumes that the given Node has a sortkey attribute (DATATYPE_IGNORE). |
[in] | prevoid | The oid of the Node to swap with on sortup action. If not given, the Node with previous sortkey is taken. |
[in] | nextoid | The oid of the Node to swap with on sortdown action. If not given, the Node with next sortkey is taken. |
[in] | dist | The distance to move the Node up or down. 'prevoid', 'nextoid' will be ignored. |
[in] | filter | A filter string to be used to filter the entities in the list, when moving by dist (see StringQuery), if no filter is defined, all entities of the type defined in sortoid are contained in the list to sort. |
[in] | poid | As alternative to the filter parameter the entity list maybe defined by a parent oid, which means that all child nodes of that parent are contained in the list to sort. |
[in] | sortcol | The name of the column to use for sorting (DATATYPE_IGNORE). If not given it defaults to 'sortkey'. |
[out] | oid | The oid of the Node that changed its sortkey (= sortoid). |
Definition at line 86 of file class.SortController.php.
SortController::hasView | ( | ) |
Definition at line 91 of file class.SortController.php.
SortController::validate | ( | ) |
Definition at line 98 of file class.SortController.php.
References Controller\setErrorMsg().
SortController::executeKernel | ( | ) |
Sort Nodes.
Definition at line 112 of file class.SortController.php.
References BUILDDEPTH_SINGLE, PersistenceFacade\getInstance(), PersistenceFacade\isValidOID(), sortAll(), and swapNodes().
SortController::getSortColumn | ( | ) |
Get the name of the column to use for sorting.
Definition at line 145 of file class.SortController.php.
Referenced by sortAll(), and swapNodes().
SortController::swapNodes | ( | & | $node1, |
& | $node2, | ||
$doSave | |||
) |
Swap sortkey of two given Nodes.
Definition at line 160 of file class.SortController.php.
References DATATYPE_IGNORE, getSortColumn(), and sortAll().
Referenced by executeKernel(), and sortAll().
SortController::sortAll | ( | ) |
Sort all Nodes.
Definition at line 191 of file class.SortController.php.
References BUILDDEPTH_SINGLE, DATATYPE_IGNORE, ObjectQuery\executeString(), PersistenceFacade\getInstance(), NodeUtil\getNodeQuery(), PersistenceFacade\getOIDParameter(), getSortColumn(), PersistenceFacade\isValidOID(), Controller\setErrorMsg(), Node\sort(), STATE_CLEAN, swapNodes(), and Obfuscator\unveil().
Referenced by executeKernel(), and swapNodes().