PHP Class Backend\Modules\Pages\Engine\Model

Author: Tijs Verkoyen ([email protected])
Author: Davy Hellemans ([email protected])
Author: Matthias Mullie ([email protected])
Author: Jeroen Desloovere ([email protected])
Afficher le fichier Open project: forkcms/forkcms Class Usage Examples

Méthodes publiques

Méthode Description
buildCache ( string $language = null ) Build the cache
copy ( string $from, string $to ) Copy pages
createHtml ( string $type = 'page', integer $depth, integer $parentId = 1, string $html = '' ) : string Creates the html for the menu
delete ( integer $id, string $language = null, integer $revisionId = null ) : boolean Delete a page
exists ( integer $id ) : boolean Check if a page exists
get ( integer $id, integer $revisionId = null, string $language = null ) : mixed Get the data for a record
getBlocks ( integer $id, integer $revisionId = null, string $language = null ) : array Get blocks for a certain page/revision
getByTag ( integer $tagId ) : array Get all items by a given tag id
getCacheBuilder ( ) : CacheBuilder
getEncodedRedirectURL ( string $redirectURL ) : string Get encoded redirect URL
getFirstChildId ( integer $pageId ) : mixed Get the first child for a given parent
getFullURL ( integer $id ) : string Get the full-URL for a given menuId
getLatestRevision ( integer $id, string $language = null ) : integer Get latest revision id for a page.
getMaximumBlockId ( ) : integer Get the maximum unique id for blocks
getMaximumPageId ( string $language = null ) : integer Get the maximum unique id for pages
getMaximumSequence ( integer $parentId, string $language = null ) : integer Get the maximum sequence inside a leaf
getPagesForDropdown ( string $language = null ) : array Get the pages for usage in a dropdown menu
getSubtree ( array $navigation, integer $parentId ) : string Get the subtree for a root element
getTree ( array $ids, array $data = null, integer $level = 1, string $language = null ) : array Get all pages/level
getTreeHTML ( ) : string Get the tree
getTypes ( ) : array Get the possible block types
getURL ( string $url, integer $id = null, integer $parentId, boolean $isAction = false ) : string Get an unique URL for a page
insert ( array $page ) : integer Insert a page
insertBlocks ( array $blocks ) Insert multiple blocks at once
move ( integer $id, integer $droppedOn, string $typeOfDrop, string $tree, string $language = null ) : boolean Move a page
update ( array $page ) : integer Update a page
updatePagesTemplates ( integer $oldTemplateId, integer $newTemplateId, boolean $overwrite = false ) Switch templates for all existing pages

Method Details

buildCache() public static méthode

Build the cache
public static buildCache ( string $language = null )
$language string The language to build the cache for, if not passed we use the working language.

copy() public static méthode

Copy pages
public static copy ( string $from, string $to )
$from string The language code to copy the pages from.
$to string The language code we want to copy the pages to.

createHtml() public static méthode

Creates the html for the menu
public static createHtml ( string $type = 'page', integer $depth, integer $parentId = 1, string $html = '' ) : string
$type string The type of navigation.
$depth integer The maximum depth to show.
$parentId integer The Id to start from.
$html string Will hold the created HTML.
Résultat string

delete() public static méthode

Delete a page
public static delete ( integer $id, string $language = null, integer $revisionId = null ) : boolean
$id integer The id of the page to delete.
$language string The language wherein the page will be deleted, if not provided we will use the working language.
$revisionId integer If specified the given revision will be deleted, used for deleting drafts.
Résultat boolean

exists() public static méthode

Check if a page exists
public static exists ( integer $id ) : boolean
$id integer The id to check for existence.
Résultat boolean

get() public static méthode

Get the data for a record
public static get ( integer $id, integer $revisionId = null, string $language = null ) : mixed
$id integer The Id of the page to fetch.
$revisionId integer
$language string The language to use while fetching the page.
Résultat mixed False if the record can't be found, otherwise an array with all data.

getBlocks() public static méthode

Get blocks for a certain page/revision
public static getBlocks ( integer $id, integer $revisionId = null, string $language = null ) : array
$id integer The id of the page.
$revisionId integer The revision to grab.
$language string The language to use.
Résultat array

getByTag() public static méthode

Get all items by a given tag id
public static getByTag ( integer $tagId ) : array
$tagId integer The id of the tag.
Résultat array

getCacheBuilder() public static méthode

public static getCacheBuilder ( ) : CacheBuilder
Résultat CacheBuilder

getEncodedRedirectURL() public static méthode

Get encoded redirect URL
public static getEncodedRedirectURL ( string $redirectURL ) : string
$redirectURL string
Résultat string

getFirstChildId() public static méthode

Get the first child for a given parent
public static getFirstChildId ( integer $pageId ) : mixed
$pageId integer The Id of the page to get the first child for.
Résultat mixed

getFullURL() public static méthode

Get the full-URL for a given menuId
public static getFullURL ( integer $id ) : string
$id integer The Id of the page to get the URL for.
Résultat string

getLatestRevision() public static méthode

Get latest revision id for a page.
public static getLatestRevision ( integer $id, string $language = null ) : integer
$id integer The id of the page.
$language string The language to use.
Résultat integer

getMaximumBlockId() public static méthode

Get the maximum unique id for blocks
public static getMaximumBlockId ( ) : integer
Résultat integer

getMaximumPageId() public static méthode

Get the maximum unique id for pages
public static getMaximumPageId ( string $language = null ) : integer
$language string The language to use, if not provided we will use the working language.
Résultat integer

getMaximumSequence() public static méthode

Get the maximum sequence inside a leaf
public static getMaximumSequence ( integer $parentId, string $language = null ) : integer
$parentId integer The Id of the parent.
$language string The language to use, if not provided we will use the working language.
Résultat integer

getPagesForDropdown() public static méthode

Get the pages for usage in a dropdown menu
public static getPagesForDropdown ( string $language = null ) : array
$language string The language to use, if not provided we will use the working language.
Résultat array

getSubtree() public static méthode

Get the subtree for a root element
public static getSubtree ( array $navigation, integer $parentId ) : string
$navigation array The navigation array.
$parentId integer The id of the parent.
Résultat string

getTree() public static méthode

Get all pages/level
public static getTree ( array $ids, array $data = null, integer $level = 1, string $language = null ) : array
$ids array The parentIds.
$data array A holder for the generated data.
$level integer The counter for the level.
$language string The language.
Résultat array

getTreeHTML() public static méthode

Get the tree
public static getTreeHTML ( ) : string
Résultat string

getTypes() public static méthode

Get the possible block types
public static getTypes ( ) : array
Résultat array

getURL() public static méthode

Get an unique URL for a page
public static getURL ( string $url, integer $id = null, integer $parentId, boolean $isAction = false ) : string
$url string The URL to base on.
$id integer The id to ignore.
$parentId integer The parent for the page to create an url for.
$isAction boolean Is this page an action.
Résultat string

insert() public static méthode

Insert a page
public static insert ( array $page ) : integer
$page array The data for the page.
Résultat integer

insertBlocks() public static méthode

Insert multiple blocks at once
public static insertBlocks ( array $blocks )
$blocks array The blocks to insert.

move() public static méthode

Move a page
public static move ( integer $id, integer $droppedOn, string $typeOfDrop, string $tree, string $language = null ) : boolean
$id integer The id for the page that has to be moved.
$droppedOn integer The id for the page where to page has been dropped on.
$typeOfDrop string The type of drop, possible values are: before, after, inside.
$tree string The tree the item is dropped on, possible values are: main, meta, footer, root.
$language string The language to use, if not provided we will use the working language.
Résultat boolean

update() public static méthode

Update a page
public static update ( array $page ) : integer
$page array The new data for the page.
Résultat integer

updatePagesTemplates() public static méthode

Switch templates for all existing pages
public static updatePagesTemplates ( integer $oldTemplateId, integer $newTemplateId, boolean $overwrite = false )
$oldTemplateId integer The id of the new template to replace.
$newTemplateId integer The id of the new template to use.
$overwrite boolean Overwrite all pages with default blocks.