WTType Class
The class representing wtType Nodes
Item Index
Methods
- approveChanges
- copyModerationFrom
- copyModerationToChildren
- copyPage
- copyPermissionsFrom
- copyPermissionsToChildren
- create
- createChild
- createChildFromForm
- createTranslationNode
- deleteNode
- export
- forceSecure
- getAncestors
- getAttribute
- getAttributes
- getCreator
- getDepth
- getFormHTML
- getKeywords
- getLanguageID
- getModerationChainGuid
- getName
- getNextModerationGroupID
- getParent
- getParents
- getPath
- getTranslationNode
- getType
- getURI
- getVisibleTextFromHtml static
- hasPermission
- insert
- insertAfter
- isAncestorOf
- isDescendantOf
- isLockedForModeration
- linkedToParent
- logEvent
- move
- moveToTop
- preEvaluateTemplate
- preRender
- rejectChanges
- removeModerationChain
- render
- restore
- restoreNode
- sendModerationApprovedEmail
- sendModerationRejectedEmail
- sendModerationRequiredEmail
- setAttributes
- setAttributesFromForm
- setCreatedBy creatorGuid The guid of the contact
- setHidden
- setKeywords
- setModerationChain
- setName
- setNodeParents
- setParent
- setPermission
- setURI
- unlinkedFromParent
- userHasPermission
Methods
approveChanges
-
[sendEmail=false]
Approve changes made
Parameters:
-
[sendEmail=false]Boolean optional
copyModerationFrom
-
copyFrom
Copy the moderation settings from a node
Parameters:
-
copyFromStringThe guid, path or object to copy the moderation from
copyModerationToChildren
-
excludeTypes
Copy the node's moderation settings to its children
Parameters:
-
excludeTypesStringA comma separated list of types to exclude from the copy
copyPage
-
parentPath -
menuText -
[copySubPages=false]
Copy the page
Parameters:
-
parentPathStringThe page will be created as a child of this path
-
menuTextStringThe Menu Text for the new page
-
[copySubPages=false]Boolean optionalIf set to true, subpages will also be copied
Returns:
copyPermissionsFrom
-
copyFrom
Copy the permissions from a node
Parameters:
-
copyFromStringThe guid, path or object of the node to copy permissions from
copyPermissionsToChildren
-
[excludeTypes=""]
Copy the node's permissions to its children
Parameters:
-
[excludeTypes=""]String optionalA comma seperated list of type to exclude from the copy
create
-
parentGuid -
nodeType -
attributes
Create a wtType node, creates the associated database tables
Parameters:
-
parentGuidIntegerthe guid of the parent node
-
nodeTypeStringthe type of the node to create - should be "wtType"
-
attributesArraythe attributes for the node
createChild
-
typeName -
[attributes=NULL]
Create a child node
Parameters:
-
typeNameString -
[attributes=NULL]Array optionalThe attributes of the child node
Returns:
createChildFromForm
-
typeName -
attributes
Create a node from a form submission in the office
Parameters:
-
typeNameStringThe name of the type to create
-
attributesArrayThe attributes from the form
Returns:
createTranslationNode
-
languageID
Create a node containing a translation of this node
Parameters:
-
languageIDIntThe guid for the language
Returns:
deleteNode
()
Delete the node, drop the associated table
export
()
Array
Create an associative array of a nodes properties and its childrens properties
Useful for saving the state of a page
Returns:
forceSecure
()
Force a page to switch to secure mode
getAncestors
-
args
Get all the ancestors of a node as their guid's in an array
Parameters:
-
argsArrayPossible keys are "directAncestors", "type", "useCache"
Returns:
getAttribute
-
attributeName -
[latest=false]
Get an attribute of the node
Parameters:
-
attributeNameStringThe name of the attribute
-
[latest=false]Boolean optionalSet to true to get the latest version (possibly draft or unapproved version)
getAttributes
-
[latest=false]
Get the attributes of the node as an associative array
Parameters:
-
[latest=false]Boolean optionalSet to true to get the latest version (could be a draft or unapproved version)
Returns:
getCreator
()
Object
Get the contact who created this node
Returns:
getDepth
-
[stopPath=""]
Get the depth of a node above a path
Parameters:
-
[stopPath=""]Object optionalThe path to find the depth from
Returns:
getFormHTML
-
typeName -
values -
args
Get the HTML of a form for the node, used by the office
Parameters:
-
typeNameStringThe type to get the form for
-
valuesArrayValues to use in the form
-
argsArrayExtra arguments to create the form with
Returns:
getKeywords
()
Get the keywords for the page
Useful for indexing the page
getLanguageID
()
Int
Get the ID of the language for this node
Returns:
getModerationChainGuid
()
Int
Get the guid of the Moderation Chain for the node
Returns:
getName
()
String
Get the name of the node
Returns:
getNextModerationGroupID
()
Int
If the node is being moderated, get the next group in the moderation chain
Returns:
getParent
()
Object
Get the parent node
Returns:
getParents
-
[type=""]
Get the parents of the node as an array of guids
A node may have more than one parent if it has been linked
Parameters:
-
[type=""]String optionalLimit the parents to a certain type
Returns:
getPath
-
[separator=/] -
[template] -
[stopPath] -
[includeSelf=true]
Return the path to the object as a string
Optionally stop at a node instead of the root
Parameters:
-
[separator=/]String optionalThe separator to use to construct the path
-
[template]String optionalIf set, the template to use to construct each element in the path
-
[stopPath]String optionalThe node to stop at when constructing the path
-
[includeSelf=true]Bool optionalSet to true to include the node in the path
Returns:
getTranslationNode
-
languageID -
[createIfNotExist=false]
Get the translation node for this node
Parameters:
-
languageIDIntThe id of the language to get the translation for
-
[createIfNotExist=false]Boolean optionalSet to true to create a translation node if it doesn't exist
Returns:
getType
()
String
Get the type of the node as a string
Returns:
getURI
-
[absolute=false] -
[latest=false]
Get the URI for the page
Parameters:
-
[absolute=false]Boolean optionalIf true, return the absolute URI
-
[latest=false]Boolean optionalIf true, return the latest URI (possibly draft version or non approved)
Returns:
getVisibleTextFromHtml
-
text
Get the visible text from a HTML document
This is used for generating search text
Parameters:
-
textStringthe HTML to get the text from
Returns:
hasPermission
-
group -
permissionType
Test if a group has a certain permission for the node
Parameters:
-
groupStringThe guid or name of the Group (or "__all" to test for public permission)
-
permissionTypeStringThe type of permission to test for "read", "write" or "list"
Returns:
insert
-
placeNode -
relation
Insert the node above or below another node
Parameters:
-
placeNodeStringThe node to place the node in relation to (may be guid, path or object)
-
relationInt0 for above, 1 for below
insertAfter
-
node
Insert this node after another node, keeping the same parent
Parameters:
-
nodeStringThe node to insert this node after (may be guid, path or object)
isAncestorOf
-
child
Test if the node is an ancestor of another node
Parameters:
-
childStringThe guid or path of the child node to test
Returns:
isDescendantOf
-
parent
Test is a node is a descendant of another node
Parameters:
-
parentStringThe guid or path of the parent node to test return {boolean} Returns true if the node is a descendant of the parent node
isLockedForModeration
()
Boolean
Test if the node is locked for moderation
Returns:
linkedToParent
-
parentNode
This function will be called whenever a node is linked to a parent
It can be overridden by subclasses to provide custom functionality
Parameters:
-
parentNodeObjectThe parent node this node is being linked to
logEvent
-
eventType -
[moderationChainGuid=0] -
changes
Log an event
Parameters:
-
eventTypeIntThe type of event: 1 create, 2 edit, 3 delete
-
[moderationChainGuid=0]Int optionalThe id of the moderation chain for the node
-
changesStringThe changes made
move
-
[direction=1] -
[moveWithinType=false]
Move this node up or down within its siblings
Parameters:
-
[direction=1]Int optional1 for down, -1 for up
-
[moveWithinType=false]Boolean optionalSet to true to move in relation to its siblings of the same node type
moveToTop
()
Move this node to the top of its siblings
preEvaluateTemplate
-
template -
templateData -
args
This function is called just before a template is rendered
It can be overridden and used to send custom data to the template
Parameters:
-
templateStringThe template about to be evaluated
-
templateDataArrayThe data to send to the template. Modify this array to change the data to be passed to the template
-
argsArrayExtra Data
preRender
()
This function is called just before the output for the page is to be produced
It can be overridden to provide custom functionality before a page is shown
rejectChanges
-
[reason] -
[sendEmail=false]
Reject the changes
Parameters:
-
[reason]String optionalThe reason for the rejection
-
[sendEmail=false]Boolean optionalSet to true to send the moderation email
removeModerationChain
()
Remove the moderation chain from a node
render
()
String
Return the HTML for the page
Returns:
restore
-
eventID
Restore a page from a previous version
Parameters:
-
eventIDIntThe id of the event representing the version
restoreNode
-
node
restore a node to a previous version from its exported node
Parameters:
-
nodeArrayThe data structure representing an exported node
sendModerationApprovedEmail
-
eventID
Send the email informing the editor the edit has been approved by the moderators
Parameters:
-
eventIDIntThe id of the moderation event
sendModerationRejectedEmail
-
eventID -
[reason=""]
Send the email informing the editor their edit was rejected by the moderator
Parameters:
-
eventIDIntThe id related to the moderation event
-
[reason=""]String optionalThe reason for the rejection
sendModerationRequiredEmail
-
eventID
Send an email to a moderator informing them moderation is required
Parameters:
-
eventIDIntThe moderation event
setAttributes
-
attributes
Set the attributes for the node, alter the database table if necessary
Parameters:
-
attributesArrayan associated array of the attributes for the node
setAttributesFromForm
-
attributes
Set the attributes from form submission in the office
Parameters:
-
attributesArray
setCreatedBy creatorGuid The guid of the contact
()
Set the creator of the node
setHidden
-
[hidden=true]
Hide a node, the node will only be accessible through WebTemplate::getNode
Parameters:
-
[hidden=true]Boolean optionalSet to true to hide the node
setKeywords
()
Set the keywords for the node. Used for search
setModerationChain
-
moderationChain
Set the moderation chain for the node
Parameters:
-
moderationChainIntThe guid, path, or object for the moderation chain
setName
()
String
Set the name of the node
Returns:
setNodeParents
()
private
Internal function to allow quick searching of all descendants of a node
setParent
-
parent
Change the parent of a node
Parameters:
-
parentStringThe guid or path of the new parent node
setPermission
-
group -
permissionType -
[set=1] -
[overwritecurrent=false]
Set the permissions on the node for a group
Parameters:
-
groupStringThe guid or name of the group (or "__all" for public)
-
permissionTypeStringEither "read", "write" or "list"
-
[set=1]Int optionalSet to 1 to add the permission, set to 0 to remove it
-
[overwritecurrent=false]Boolean optionalSet to true to remove all permissions on the node of the permissionType apart from the one being set
setURI
-
[base=""] -
[uriAttribute="Menu
Set the uri for the page using the Menu Text
Parameters:
-
[base=""]String optionalA value to attach to the base of the URI
-
[uriAttribute="MenuStringText"] The attribute of the page to use to generate the URI
unlinkedFromParent
-
parentNode
This function will be called whenever a node is unlinked from a parent
It can be overridden by subclasses to provide custom functionality
Parameters:
-
parentNodeObjectThe parent node this node is being unlinked from
userHasPermission
-
permissionType
Test if the current user has a permission for the node
Parameters:
-
permissionTypeStringCan be "read", "write", "list"
