ZenphotoCMS 1.6.3

menu_manager.php

Lets you create custom menus and place them on your theme pages.

Use the Menu tab to create your menus. Use printCustomMenu() to place them on your pages.

This plugin is recommend for customized themes only that do not use the standard Zenphoto display structure. Standard Zenphoto functions like the breadcrumb functions or the next_album() loop for example will NOT take care of this menu's structure!

Tags
author

Stephen Billard (sbillard), Malte Müller (acrylian)

Table of Contents

Classes

menu_manager
option handler

Functions

menu_admin_toolbox_global()  : mixed
Add menu to the admin toolbox
menu_tabs()  : unknown
Adds menu manager to admin tabs
getMenuItems()  : array<string|int, mixed>
Gets the menu items
getItem()  : array<string|int, mixed>
Gets a menu item by its id
checkChosenMenuset()  : string
Checks which menu set is chosen via $_GET. If none is explicity chosen the "default" one (create initially) is used.
checkChosenItemStatus()  : string
Checks if the menu item is set visible or not
getItemTitleAndURL()  : array<string|int, mixed>
Gets the title, url and name of a menu item
getMenuVisibility()  : string
Gets the menu visibility
inventMenuItem()  : int|array<string|int, mixed>|string
"invents" a menu item for the current page (for when one does not exist) Adds the item to the current menuset and modifies its "parent" as needed
getCurrentMenuItem()  : int|array<string|int, mixed>|string
Returns the data of the current menu item
getMenumanagerPredicessor()  : string
Returns the link to the predicessor of the current menu item
printMenumanagerPrevLink()  : mixed
Prints the previous link of the current menu item
getMenumanagerSuccessor()  : string
Returns the successor link of the current menu item
printMenumanagerNextLink()  : mixed
Gets the link to the next menu item
printMenuemanagerPageListWithNav()  : mixed
Prints a list of all pages.
printMenuemanagerPageList()  : mixed
Prints a full page navigation including previous and next page links with a list of all pages in between.
getParentMenuItems()  : array<string|int, mixed>|false
Gets the parent menu items of the current menu item. Returns the array of the items or false.
printMenumanagerBreadcrumb()  : mixed
Prints the breadcrumbs of the current page
getMenuFromLink()  : array<string|int, mixed>
Returns the menu item corresponding to $link
submenuOf()  : bool
Returns true if the current menu item is a sub item of $link
createMenuIfNotExists()  : mixed
Creates a menu set from the items passed. But only if the menu set does not already exist
getMenuItemChilds()  : array<string|int, mixed>|false
Gets the direct child menu items of the current menu item. Returns the array of the items or false.
isCurrentitemParent()  : bool
Checks if the item $item is a parent item of the current item
isPublicMenuItem()  : bool
Checks if the actual object the menu item represents is actually public
printCustomMenu()  : string
Prints a context sensitive menu of all pages as a unordered html list

Functions

menu_admin_toolbox_global()

Add menu to the admin toolbox

menu_admin_toolbox_global(mixed $zf) : mixed
Parameters
$zf : mixed

menu_tabs()

Adds menu manager to admin tabs

menu_tabs( $tabs) : unknown
Parameters
$tabs :

array Admin tabs

Return values
unknown

getMenuItems()

Gets the menu items

getMenuItems(string $menuset, string $visible) : array<string|int, mixed>
Parameters
$menuset : string

the menu tree desired

$visible : string
Return values
array<string|int, mixed>

getItem()

Gets a menu item by its id

getItem(int $id) : array<string|int, mixed>
Parameters
$id : int

id of the item

Return values
array<string|int, mixed>

checkChosenMenuset()

Checks which menu set is chosen via $_GET. If none is explicity chosen the "default" one (create initially) is used.

checkChosenMenuset([mixed $default = 'default' ]) : string
Parameters
$default : mixed = 'default'
Return values
string

checkChosenItemStatus()

Checks if the menu item is set visible or not

checkChosenItemStatus() : string
Return values
string

getItemTitleAndURL()

Gets the title, url and name of a menu item

getItemTitleAndURL(mixed $item) : array<string|int, mixed>
Parameters
$item : mixed
Return values
array<string|int, mixed>

getMenuVisibility()

Gets the menu visibility

getMenuVisibility() : string
Return values
string

inventMenuItem()

"invents" a menu item for the current page (for when one does not exist) Adds the item to the current menuset and modifies its "parent" as needed

inventMenuItem(string $menuset, string $visibility[, string $field = 'sort_order' ]) : int|array<string|int, mixed>|string

returns a contrived sort_order for the item.

Parameters
$menuset : string
$visibility : string
$field : string = 'sort_order'

The field of the array item to get, "all" for the full item array, "key" for the array index of the item within the items array (old default value)

Return values
int|array<string|int, mixed>|string

getCurrentMenuItem()

Returns the data of the current menu item

getCurrentMenuItem(string $menuset[, string $field = 'sort_order' ]) : int|array<string|int, mixed>|string
Parameters
$menuset : string

current menu set

$field : string = 'sort_order'

The field of the array item to get, "all" for the full item array, "key" for the array index of the item within the items array (old default value). Default 'sort_order'

Tags
since
1.5.7

Return values changed to match function name and doc, parameter $field added to help

Return values
int|array<string|int, mixed>|string

getMenumanagerPredicessor()

Returns the link to the predicessor of the current menu item

getMenumanagerPredicessor([string $menuset = 'default' ]) : string
Parameters
$menuset : string = 'default'

current menu set

Return values
string

Prints the previous link of the current menu item

printMenumanagerPrevLink(string $text[, string $menuset = 'default' ][, string $title = NULL ][, string $class = NULL ][, string $id = NULL ]) : mixed
Parameters
$text : string
$menuset : string = 'default'
$title : string = NULL
$class : string = NULL
$id : string = NULL

getMenumanagerSuccessor()

Returns the successor link of the current menu item

getMenumanagerSuccessor([string $menuset = 'default' ]) : string
Parameters
$menuset : string = 'default'
Return values
string

Gets the link to the next menu item

printMenumanagerNextLink(string $text[, string $menuset = 'default' ][, string $title = NULL ][, string $class = NULL ][, string $id = NULL ]) : mixed
Parameters
$text : string
$menuset : string = 'default'

current menu set

$title : string = NULL
$class : string = NULL
$id : string = NULL

printMenuemanagerPageListWithNav()

Prints a list of all pages.

printMenuemanagerPageListWithNav(string $prevtext, mixed $nexttext[, string $menuset = 'default' ][, string $class = 'pagelist' ][, string $nextprev = true ][, string $id = NULL ][, bool $firstlast = true ][, int $navlen = 9 ]) : mixed
Parameters
$prevtext : string

Insert here the linktext like 'previous page'

$nexttext : mixed
$menuset : string = 'default'

current menu set

$class : string = 'pagelist'

the css class to use, "pagelist" by default

$nextprev : string = true

set to true to get the 'next' and 'prev' links printed

$id : string = NULL

the css id to use

$firstlast : bool = true

Add links to the first and last pages of you gallery

$navlen : int = 9

Number of navigation links to show (0 for all pages). Works best if the number is odd.

printMenuemanagerPageList()

Prints a full page navigation including previous and next page links with a list of all pages in between.

printMenuemanagerPageList([mixed $menuset = 'default' ][, string $class = 'pagelist' ][, string $id = NULL ][, bool $firstlast = true ][, int $navlen = 9 ]) : mixed
Parameters
$menuset : mixed = 'default'
$class : string = 'pagelist'

Insert here the CSS-class name you want to style the link with (default is "pagelist")

$id : string = NULL

Insert here the CSS-ID name if you want to style the link with this

$firstlast : bool = true

Add links to the first and last pages of you gallery

$navlen : int = 9

Number of navigation links to show (0 for all pages). Works best if the number is odd.

getParentMenuItems()

Gets the parent menu items of the current menu item. Returns the array of the items or false.

getParentMenuItems([string $menuset = 'default' ][, array<string|int, mixed> $currentitem = null ]) : array<string|int, mixed>|false
Parameters
$menuset : string = 'default'

current menu set

$currentitem : array<string|int, mixed> = null

Optional array of the menu item to get parents of. Default null for the current item

Return values
array<string|int, mixed>|false

printMenumanagerBreadcrumb()

Prints the breadcrumbs of the current page

printMenumanagerBreadcrumb([string $menuset = 'default' ][, string $before = '' ][, string $between = ' | ' ][, string $after = ' | ' ]) : mixed

NOTE: this function is entirely dependedn on the menu tree you have generated. It will work only with static menu trees. That is, if the page upon which you call this function is not present in your menu tree it will not have any parent pages. Thus, menu items generated for instance by function calls cannot have parents in the printMenumanagerBreadcrumb sense.

Likewise if you have non exclusive menu links to a page the parentage of that page with respect to breadcrumbs may not reflect on the menu transitions that the user used to arrive on the page.

Parameters
$menuset : string = 'default'

current menu set

$before : string = ''

before text

$between : string = ' | '

between text

$after : string = ' | '

after text

Returns the menu item corresponding to $link

getMenuFromLink(string $link[, string $menuset = 'default' ]) : array<string|int, mixed>
Parameters
$link : string
$menuset : string = 'default'
Return values
array<string|int, mixed>

submenuOf()

Returns true if the current menu item is a sub item of $link

submenuOf(string $link[, string $menuset = 'default' ]) : bool
Parameters
$link : string

possible parent

$menuset : string = 'default'

current menuset

Return values
bool

createMenuIfNotExists()

Creates a menu set from the items passed. But only if the menu set does not already exist

createMenuIfNotExists(array<string|int, mixed> $menuitems[, string $menuset = 'default' ]) : mixed
Parameters
$menuitems : array<string|int, mixed>

items for the menuset array elements: 'type'=>menuset type 'title'=>title for the menu item 'link'=>URL or other data for the item link 'show'=>set to 1:"visible" or 0:"hidden", 'nesting'=>nesting level of this item in the menu heirarchy

$menuset : string = 'default'

current menuset

getMenuItemChilds()

Gets the direct child menu items of the current menu item. Returns the array of the items or false.

getMenuItemChilds([string $menuset = 'default' ][, bool $allchilds = false ][, mixed $currentitem = null ]) : array<string|int, mixed>|false
Parameters
$menuset : string = 'default'

current menu set

$allchilds : bool = false

Set to false (default) for the next level childs, true for childs of all further levels

$currentitem : mixed = null
Return values
array<string|int, mixed>|false

isCurrentitemParent()

Checks if the item $item is a parent item of the current item

isCurrentitemParent([string $menuset = 'default' ][, array<string|int, mixed> $item = array() ]) : bool
Parameters
$menuset : string = 'default'

Name of the menuset to use

$item : array<string|int, mixed> = array()

Array of the item to check

Return values
bool

isPublicMenuItem()

Checks if the actual object the menu item represents is actually public

isPublicMenuItem(string $menuset, array<string|int, mixed> $item, array<string|int, mixed> $itemarray) : bool
Parameters
$menuset : string
$item : array<string|int, mixed>

The menu item array of the menu item to check

$itemarray : array<string|int, mixed>

The item array of the menu item to check as returned by getItemTitleAndURL()

Tags
since
1.6.1
Return values
bool

printCustomMenu()

Prints a context sensitive menu of all pages as a unordered html list

printCustomMenu([string $menuset = 'default' ][, string $option = 'list' ][, string $css_id = '' ][, string $css_class_topactive = '' ][, string $css_class = '' ][, string $css_class_active = '' ][, int $showsubs = 0 ][, bool $counter = false ]) : string
Parameters
$menuset : string = 'default'

the menu tree to output

$option : string = 'list'

The mode for the menu: "list" context sensitive toplevel plus sublevel pages, "list-top" only top level pages, "omit-top" only sub level pages "list-sub" lists only the current pages direct offspring

$css_id : string = ''

CSS id of the top level list

$css_class_topactive : string = ''

class of the active item in the top level list

$css_class : string = ''

CSS class of the sub level list(s)

$css_class_active : string = ''

CSS class of the sub level list(s)

$showsubs : int = 0

Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".

$counter : bool = false

TRUE (FALSE default) if you want the count of articles for Zenpage news categories or images/subalbums for albums.

Return values
string

        
On this page

Search results