ContentManager View code

Extends \ContentOperations

A simple alias for the ContentOperations class

package

CMS

ignore

Methods

get_instance() : \ContentOperations

Return a reference to the only allowed instance of this singleton object

inherited static
getContentObject() : \getContentObject()

Return a content object for the currently requested page.

inherited

Response

\getContentObject()

LoadContentFromSerializedData(array &$data) : \ContentBase

Given an array of content_type and seralized_content, reconstructs a content object. It will handled loading the content type if it hasn't already been loaded.

inherited

Expects an associative array with 2 elements: content_type: string A content type name serialized_content: string Serialized form data

Arguments

array $data

Response

\ContentBase

A content object derived from ContentBase

CreateNewContent(mixed $type) : \ContentBase

Creates a new, empty content object of the given type.

inherited

if the content type is registered with the system, and the class does not exist, the appropriate filename will be included and then, if possible a new object of the designated type will be instantiated.

Arguments

mixed $type

The type. Either a string, or an instance of CmsContentTypePlaceHolder

Response

\ContentBase

(A valid object derived from ContentBase)

LoadContentFromId(integer $id, boolean $loadprops = false) : mixed

Given a content id, load and return the loaded content object.

inherited

Arguments

integer $id

The id of the content object to load

boolean $loadprops

Also load the properties of that content object. Defaults to false.

Response

mixed

The loaded content object. If nothing is found, returns FALSE.

LoadContentFromAlias(integer $alias, boolean $only_active = false) : \ContentBase

Given a content alias, load and return the loaded content object.

inherited

Arguments

integer $alias

The alias of the content object to load

boolean $only_active

If true, only return the object if it's active flag is true. Defaults to false.

Response

\ContentBase

The loaded content object. If nothing is found, returns NULL.

GetDefaultContent() : integer

Returns the id of the content marked as default.

inherited

Response

integer

The id of the default content page

register_content_type(\CmsContentTypePlaceHolder &$obj) 

Register a new content type

inherited

Arguments

\CmsContentTypePlaceHolder $obj

ListContentTypes(boolean $byclassname = false, boolean $allowed = false, boolean $system = FALSE) : array

Returns a hash of valid content types (classes that extend ContentBase) The key is the name of the class that would be saved into the database. The value would be the text returned by the type's FriendlyName() method.

inherited

Arguments

boolean $byclassname

optionally return keys as class names.

boolean $allowed

optionally trim the list of content types that are allowed by the site preference.

boolean $system

return only system content types.

Response

array

List of content types registered in the system.

SetAllHierarchyPositions() 

Updates the hierarchy position of all content items.

inherited

This is an expensive operation on the database, but must be called once each time one or more content pages are updated if positions have changed in the page structure.

GetLastContentModification() : \unix

Get the date of last content modification

inherited

Response

\unix

timestamp representing the last time a content page was modified.

GetAllContentAsHierarchy(boolean $loadcontent = false) : \cms_content_tree

Loads a set of content objects into the cached tree.

inherited deprecated

Arguments

boolean $loadcontent

If false, only create the nodes in the tree, don't load the content objects

Response

\cms_content_tree

The cached tree of content

LoadAllContent(boolean $loadprops = FALSE, boolean $inactive = FALSE, boolean $showinmenu = FALSE) 

Load All content in thedatabase into memory Use with caution this can chew up alot of memory on larger sites.

inherited

Arguments

boolean $loadprops

Load extended content properties or just the page structure and basic properties

boolean $inactive

Load inactive pages as well

boolean $showinmenu

Load pages marked as show in menu

LoadChildren(integer $id, boolean $loadprops = false, boolean $all = false, array $explicit_ids = array()) 

Loads additional, active children into a given tree object

inherited

Arguments

integer $id

The parent of the content objects to load into the tree

boolean $loadprops

If true, load the properties of all loaded content objects

boolean $all

If true, load all content objects, even inactive ones.

array $explicit_ids

(optional) array of explicit content ids to load

SetDefaultContent(integer $id) 

Sets the default content to the given id

inherited

Arguments

integer $id

The id to set as default

GetAllContent(boolean $loadprops = true) : array

Returns an array of all content objects in the system, active or not.

inherited

Caution: it is entirely possible that this method (and other similar methods of loading content) will result in a memory outage if there are large amounts of content objects AND/OR large amounts of content properties. Use with caution.

Arguments

boolean $loadprops

Not implemented

Response

array

The array of content objects

CreateHierarchyDropdown(string $current = '', string $value = '', string $name = 'parent_id', boolean $allowcurrent, boolean $use_perms, boolean $ignore_current, boolean $allow_all = false, boolean $for_child = false) : string

Create a hierarchical ordered dropdown of all the content objects in the system for use in the admin and various modules. If $current or $parent variables are passed, care is taken to make sure that children which could cause a loop are hidden, in cases of when you're creating a dropdown for changing a content object's parent.

inherited deprecated

This method was rewritten for 2.0 to use the jquery hierselector plugin to better accommodate larger websites.

Since many parameters are now ignored, A new method needs to be writtent o replace this archaic method... so consider this method to be deprecateed.

Arguments

string $current

The currently selected content object. If none is given, we show all items (ignored since 2.0).

string $value

The id of the currently selected content object.

string $name

The html name of the dropdown.

boolean $allowcurrent

Overrides the logic if $current and/or $parent are passed. Defaults to false.

boolean $use_perms

If true, checks authorship permissions on pages and only shows those the current user has authorship of (can edit)

boolean $ignore_current

(ignored as of 2.0) (Before 2.2 this parameter was called ignore_current and

boolean $allow_all

If true, show all items, even if the content object doesn't have a valid link. Defaults to false.

boolean $for_child

If true, assume that we want to add a new child and obey the WantsChildren flag of each content page. (new in 2.2).

Response

string

The html dropdown of the hierarchy.

GetDefaultPageID() : integer

Gets the content id of the page marked as default

inherited

Response

integer

The id of the default page. false if not found.

GetPageIDFromAlias(string $alias) : integer

Returns the content id given a valid content alias.

inherited

Arguments

string $alias

The alias to query

Response

integer

The resulting id. null if not found.

GetPageIDFromHierarchy(string $position) : integer

Returns the content id given a valid hierarchical position.

inherited

Arguments

string $position

The position to query

Response

integer

The resulting id. false if not found.

GetPageAliasFromID(integer $id) : string

Returns the content alias given a valid content id.

inherited

Arguments

integer $id

The content id to query

Response

string

The resulting content alias. false if not found.

CheckAliasError(string $alias, string $content_id = -1) : string

Checks to see if a content alias is valid and not in use.

inherited

Arguments

string $alias

The content alias to check

string $content_id

The id of the current page, for used alias checks on existing pages

Response

string

The error, if any. If there is no error, returns FALSE.

CreateFriendlyHierarchyPosition(string $position) : string

Converts a friendly hierarchy (1.1.1) to an unfriendly hierarchy (00001.00001.00001) for use in the database.

inherited

Arguments

string $position

The hierarchy position to convert

Response

string

The unfriendly version of the hierarchy string

CreateUnfriendlyHierarchyPosition(string $position) : string

Converts an unfriendly hierarchy (00001.00001.00001) to a friendly hierarchy (1.1.1) for use in the database.

inherited

Arguments

string $position

The hierarchy position to convert

Response

string

The friendly version of the hierarchy string

CheckParentage(integer $test_id, integer $base_id = null) : boolean

Check if the supplied page id is a parent of the specified base page (or the current page)

inherited

Arguments

integer $test_id

Page ID to test

integer $base_id

(optional) Page ID to act as the base page. The current page is used if not specified.

Response

boolean

GetOwnedPages(integer $userid) : array

Return a list of pages that the user is owner of.

inherited

Arguments

integer $userid

The userid

Response

array

Array of integer page id's

CheckPageOwnership(integer $userid, integer $pageid) : boolean

Test if the user specified owns the specified page

inherited

Arguments

integer $userid

integer $pageid

Response

boolean

GetPageAccessForUser(integer $userid) : array<mixed,integer>

Return a list of pages that the user has edit access to.

inherited

Arguments

integer $userid

The userid

Response

array<mixed,integer>

Array of page id's

CheckPageAuthorship(integer $userid, integer $contentid) : boolean

Check if the specified user has the ability to edit the specified page id

inherited

Arguments

integer $userid

integer $contentid

Response

boolean

CheckPeerAuthorship(integer $userid, integer $contentid) : boolean

Test if the specified user account has edit access to all of the peers of the specified page id

inherited

Arguments

integer $userid

integer $contentid

Response

boolean

quickfind_node_by_id(integer $id) : \cms_content_tree

A convenience function to find a hierarchy node given the page id This method will be moved to cms_content_tree at a later date.

inherited

Arguments

integer $id

The page id

Response

\cms_content_tree