KWeb  6.4
KWebStructure Class Reference

Structures are objects, that define object relations in the system, and handle actions on those objects. More...

Inheritance diagram for KWebStructure:
KWebStructure_Interface KWebStructure_Adapter KWebStructure_Foreign KWebStructure_Comment KWebStructure_Item

Public Member Functions

 __construct ($id, $object)
 __destruct ()
 getStructureId ()
 getStructureObject ()
 getStructureUrl (array $params=array(), $lang=false, array $options=array())
 Returns standard url to this structure.
 handleStructureAction ($action, $data, $confirmed, array $options=array())
 Handles actions on this structure.
 handleObjectAction ($object, $action, $data, $confirmed, array $options=array())
 Handles actions on a single object.
 handleUnknownObjectAction ($object, $action, $data, $confirmed, array $options=array())
 Handles unknown object actions...
 prepareDataFilters ($object, $navbar, array &$filters, $adapter)
 Prepares the navbar and a list of post-fetch filters for this structure.

Data Fields

const MENU_SELF = 'self'
 Menu item depicting this structure object.
const MENU_OBJECT = 'object'
 Menu for the single object in context.
const MENU_LIST = 'list'
 Menu for the list of objects.
const ACTION_ADD = 'add'
 Object creation.
const ACTION_REMOVE = 'remove'
 Objects removal.
const ACTION_PUBLISH = 'publish'
 Accepts DATA_OBJECTS to publish.
const ACTION_PENDING = 'pending'
 Accepts DATA_OBJECTS to pending.
const ACTION_DRAFT = 'draft'
 Accepts DATA_OBJECTS to draft.
const ACTION_PREVIEW = 'preview'
const ACTION_PUBLISH_PREVIEW = 'publish_preview'
const ACTION_ADDLINK = 'addlink'
 Creating relationships between objects (add existing item to this one, add tag to the item, etc.)
const ACTION_ADDLOCATION = 'addlocation'
 Creating relationships between objects (add this item to another ones)
const ACTION_COPY = 'copy'
 Copy objects into this item.
const ACTION_MOVE = 'move'
 Move objects into this item.
const ACTION_CANCEL = 'cancel'
const ACTION_CONFIRM = 'confirm'
const OPT_ERRORSTACK = "errorstack"
const MENU_OPT_ACTION = "action"
 Menu for specified action.
const MENU_OPT_OBJECT = "object"
 Menu for specified object.
const OPT_URL_VIEW = "url_view"
const OPT_URL_PAGE = "url_page"
const OPT_URL_PARAMS = "url_params"
const ID_STRUCTURE = 'structure'
const ID_FOREIGN = 'foreign'
 Foreign structure is one, that will handle actions on behalf of the other structure.
const ID_PUBLISHED = 'published'
const ID_PUBLIC = 'public'
const ID_OWNS = 'owns'
const ID_ATTRIBUTE_PREFIX = 'attr_'
const ID_ATTRIBUTE_NONE = 'attr_none'
const RESULT_CONFIRM = 'confirm'
const RESULT_SUCCESS = 'success'
const RESULT_OBJECTS = 'objects'
const RESULT_ERRORSTACK = 'errorstack'
const DATA_OBJECTS = 'objects'
const DATA_LIST = 'list'
const DATA_STATUS = 'status'
const DATA_OPTIONS = 'options'
const EVENT_STRUCTURE_ACTION = 'kweb.structure.structure_action'
const EVENT_OBJECT_ACTION = 'kweb.structure.object_action'
 $id
 $options

Protected Member Functions

 handleStructureActionOnObjects ($action, $data, $confirmMenu, $options, &$result)
 Will traverse the list of objects in data ($data[DATA_OBJECTS]) and call handleObjectAction for every one of them.

Protected Attributes

 $object

Detailed Description

Structures are objects, that define object relations in the system, and handle actions on those objects.

Single object can have many defining structures, with default one - ID_STRUCTURE.

To get structures of the object, use KWebObject::getStructures(), or KWebObject::getStructure(). If you want to implement structures for the object, you should override only KWebObject::getStructures() and check $filter parameter to return only currently needed structures.

Structure does couple of things:


Constructor & Destructor Documentation

KWebStructure::__construct ( id,
object 
)

Reimplemented in KWebStructure_Foreign.

KWebStructure::__destruct ( )

Member Function Documentation

KWebStructure::getStructureId ( )
KWebStructure::getStructureObject ( )
Returns:
KWebObject

Implements KWebStructure_Interface.

Reimplemented in KWebStructure_Item.

KWebStructure::getStructureUrl ( array $  params = array(),
lang = false,
array $  options = array() 
)

Returns standard url to this structure.

Implements KWebStructure_Interface.

KWebStructure::handleObjectAction ( object,
action,
data,
confirmed,
array $  options = array() 
)

Handles actions on a single object.

Typically called during processing handleStructureAction, and not by itself

Parameters:
$action- action id
$data- array with action data. Action dependent. See KWebStructure::DATA_*
$confirmed- if FALSE, the action should return array(KWebStructure::RESULT_CONFIRM => Menu_Item()) with items to confirm. if TRUE, the actions should be handled.
$options- general options for action handling and/or specific action (see KWebStructure::OPT_*)

Implements KWebStructure_Interface.

Reimplemented in KWebStructure_Item, KWebStructure_Comment, and KWebStructure_Foreign.

KWebStructure::handleStructureAction ( action,
data,
confirmed,
array $  options = array() 
)

Handles actions on this structure.

Parameters:
$action- action id
$data- array with action data, like list of id's, etc. Action dependent. See KWebStructure::DATA_*
$confirmed- if false, the action should return array(KWebStructure::RESULT_CONFIRM => Menu_Item()) with items to confirm. if true, the actions should be handled.
$options- general options for action handling and/or specific action (see KWebStructure::OPT_*)

Implements KWebStructure_Interface.

Reimplemented in KWebStructure_Item, KWebStructure_Comment, and KWebStructure_Foreign.

KWebStructure::handleStructureActionOnObjects ( action,
data,
confirmMenu,
options,
&$  result 
) [protected]

Will traverse the list of objects in data ($data[DATA_OBJECTS]) and call handleObjectAction for every one of them.

KWebStructure::handleUnknownObjectAction ( object,
action,
data,
confirmed,
array $  options = array() 
)

Handles unknown object actions...

Asks the object for the ID_FOREIGN structure. Calling structure will be passed in KWebObject::STRUCTUREOPT_FOREIGN. Created structure should use the same structure object as the calling structure.

KWebStructure::prepareDataFilters ( object,
navbar,
array &$  filters,
adapter 
)

Prepares the navbar and a list of post-fetch filters for this structure.

Parameters:
KWebObject$object
KWebNavbar$navbar
KWebAdapter$adapter

Implements KWebStructure_Interface.

Reimplemented in KWebStructure_Adapter.


Field Documentation

KWebStructure::$id
KWebStructure::$object [protected]
KWebStructure::$options

Object creation.

Accepts DATA_LIST as array(array(genre=> , type=> ),...) Returns RESULT_OBJECTS

const KWebStructure::ACTION_ADDLINK = 'addlink'

Creating relationships between objects (add existing item to this one, add tag to the item, etc.)

Accepts DATA_OBJECTS to link to this item. May accept DATA_STATUS of new relations May return RESULT_OBJECTS

const KWebStructure::ACTION_ADDLOCATION = 'addlocation'

Creating relationships between objects (add this item to another ones)

Accepts DATA_OBJECTS to link this item to. May accept DATA_STATUS of new relations May return RESULT_OBJECTS

const KWebStructure::ACTION_CANCEL = 'cancel'
const KWebStructure::ACTION_CONFIRM = 'confirm'

Copy objects into this item.

Accepts DATA_OBJECTS to copy Accepts DATA_STATUS of new objects May return RESULT_OBJECTS

const KWebStructure::ACTION_DRAFT = 'draft'

Accepts DATA_OBJECTS to draft.

Move objects into this item.

Accepts DATA_OBJECTS to move May return RESULT_OBJECTS

const KWebStructure::ACTION_PENDING = 'pending'

Accepts DATA_OBJECTS to pending.

const KWebStructure::ACTION_PREVIEW = 'preview'
const KWebStructure::ACTION_PUBLISH = 'publish'

Accepts DATA_OBJECTS to publish.

const KWebStructure::ACTION_PUBLISH_PREVIEW = 'publish_preview'
const KWebStructure::ACTION_REMOVE = 'remove'

Objects removal.

Depending on context, may mean removing objects, or breaking relationship (eg. remove item vs remove item from tag)

Accepts DATA_OBJECTS to remove

const KWebStructure::DATA_LIST = 'list'
const KWebStructure::DATA_OBJECTS = 'objects'
const KWebStructure::DATA_OPTIONS = 'options'
const KWebStructure::DATA_STATUS = 'status'
const KWebStructure::EVENT_OBJECT_ACTION = 'kweb.structure.object_action'
const KWebStructure::EVENT_STRUCTURE_ACTION = 'kweb.structure.structure_action'
const KWebStructure::ID_ATTRIBUTE_NONE = 'attr_none'
const KWebStructure::ID_FOREIGN = 'foreign'

Foreign structure is one, that will handle actions on behalf of the other structure.

See also:
KWebStructure::handleUnknownObjectAction()
const KWebStructure::ID_OWNS = 'owns'
const KWebStructure::ID_PUBLIC = 'public'
const KWebStructure::ID_PUBLISHED = 'published'
const KWebStructure::ID_STRUCTURE = 'structure'
const KWebStructure::MENU_LIST = 'list'

Menu for the list of objects.

const KWebStructure::MENU_OBJECT = 'object'

Menu for the single object in context.

Menu for specified action.

Menu for specified object.

const KWebStructure::MENU_SELF = 'self'

Menu item depicting this structure object.

const KWebStructure::OPT_ERRORSTACK = "errorstack"
const KWebStructure::OPT_URL_PAGE = "url_page"
const KWebStructure::OPT_URL_PARAMS = "url_params"
const KWebStructure::OPT_URL_VIEW = "url_view"
const KWebStructure::RESULT_CONFIRM = 'confirm'
const KWebStructure::RESULT_ERRORSTACK = 'errorstack'
const KWebStructure::RESULT_OBJECTS = 'objects'
const KWebStructure::RESULT_SUCCESS = 'success'

The documentation for this class was generated from the following file: