A container item is one that gathers multiple sub menu items, but does not have it's own controller/action pair but selects the first sub item instead.

Sub menu items "masks" three type of items:

  • plain simple menu items with an controller/action.
  • container items without controller/action taking those from their first active child.
    • button items with a controller/action

Menu items are displayed when:

  • the current user has the correct privilige
  • the parameters needed for display are given
  • the parameter filter is true or show disabled is on

The parameter values must be supplied when requesting to draw a menu item. Valid sources for parameter values are:

  • \Gems_Menu_ParameterSourceInterface objects
  • \Zend_Controller_Request_Abstract objects
  • \MUtil_Lazy_RepeatableInterface objects
  • array's

Button items are only displayed through toActionLink()

package Gems
subpackage Menu
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.5.5
inherited_from \Gems_Menu_SubMenuItem

 Methods

Copy from \Zend_Translate_Adapter

_(string $text, string|\Zend_Locale $locale = null) : string
Inherited

Translates the given string returns the translation

Parameters

$text

string

Translation string

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

__construct()

__construct(\GemsEscort $escort) 
Inherited

Parameters

$escort

__toString()

__toString() 
Inherited

Add an action to the current subMenuItem

addAction(string $label, string $privilege = null, string $action = 'index', array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

The label to display for the menu item

$privilege

string

The privilege for the item

$action

string

The name of the action

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubMenuItem

Add a button only action to the current subMenuItem

addActionButton(string $label, string $privilege = null, string $action = 'index', array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

The label to display for the menu item

$privilege

string

The privilege for the item

$action

string

The name of the action

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubMenuItem

Add a agenda setup menu tree to the menu

addAgendaSetupMenu(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

Returns

\Gems_Menu_SubMenuItem

Add a browse / ceate / edit / show / / sleanup etc.

addAgendaSetupPage(string $label, string $privilege, string $controller, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

. menu item

Parameters

$label

string

$privilege

string

$controller

string

$other

array

Returns

\Gems_Menu_SubMenuItem

Add invisible autofilet action to the current subMenuItem

addAutofilterAction() : \Gems_Menu_SubMenuItem
Inherited

Returns

\Gems_Menu_SubMenuItem

Add a browse / ceate / edit / show / etc.

addBrowsePage(string $label, string $privilege, string $controller, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

. menu item

Parameters

$label

string

$privilege

string

$controller

string

$other

array

Returns

\Gems_Menu_SubMenuItem

Add a menu item that is never added to the navigation tree and only shows up as a button.

addButtonOnly(string $label, string $privilege, string $controller, string $action = 'index', array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

$privilege

string

$controller

string

$action

string

$other

array

Returns

\Gems_Menu_SubMenuItem

Add a calendar page to the menu

addCalendarPage(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

Returns

\Gems_Menu_SubMenuItem

Add a Mail menu tree to the menu

addCommSetupMenu(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

Returns

\Gems_Menu_SubMenuItem

addContainer()

addContainer($label, $privilege = null, array $other = array()
Inherited

Parameters

$label

$privilege

$other

Add an "Create new" action to the current subMenuItem

addCreateAction(string $privilege = null, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$privilege

string

The privilege for the item, defaults to parent + .create when not specified

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubMenuItem

Add a standard deactivate action and optional reactivate action to the current menu item

addDeReactivateAction(string $checkField, string $deactivateOn = 1, string $reactivateOn = 1, array $otherDeact = array(), array $otherReact = array()) : array
Inherited

Parameters

$checkField

string

The name of the field to filter on for deactivation

$deactivateOn

string

The value to check against for deactivation, no menu item when null

$reactivateOn

string

The value to check against for reactivation, no menu item when null

$otherDeact

array

Array of extra options for deactivate item, e.g. 'visible', 'allowed', 'class', 'icon', 'privilege', 'target', 'type', 'button_only'.

$otherReact

array

Array of extra options for reactivate item, e.g. 'visible', 'allowed', 'class', 'icon', 'privilege', 'target', 'type', 'button_only'.

Returns

arrayof \Gems_Menu_SubmenuItem

Add a standard delete action to the current menu item

addDeleteAction(string $privilege = null, array $other = array()) : \Gems_Menu_SubmenuItem
Inherited

Parameters

$privilege

string

A privilege name, defaults to parent + .delete when not specified

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', target', 'type', 'button_only'.

Returns

\Gems_Menu_SubmenuItem

Add a standard edit action to the current menu item

addEditAction(string $privilege = null, array $other = array()) : \Gems_Menu_SubmenuItem
Inherited

Parameters

$privilege

string

A privilege name, defaults to parent + .edit when not specified

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubmenuItem

Add a standard edit action to the current menu item

addExcelAction() : \Gems_Menu_SubmenuItem
Inherited

Returns

\Gems_Menu_SubmenuItem

Add a standard edit action to the current menu item

addExportAction() : \Gems_Menu_SubmenuItem
Inherited

Returns

\Gems_Menu_SubmenuItem

Shortcut function to create the export container.

addExportContainer(string $label) : \Gems_Menu_MenuAbstract
Inherited

Parameters

$label

string

Label for the container

Returns

\Gems_Menu_MenuAbstractThe new contact page

Add a file upload/download page to the menu

addFilePage(string $label, string $privilege, string $controller, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

The label to display for the menu item, null for access without display

$privilege

string

The privilege for the item, null is always, 'pr.islogin' must be logged in, 'pr.nologin' only when not logged in.

$controller

string

What controller to use

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubMenuItem

Add a roles browse edit page to the menu,

addGroupsPage(string $label, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

$other

array

Returns

\Gems_Menu_SubMenuItem

Add parameter values that should not show in the url but that must be added to the request when this menu item is current.

addHiddenParameter(string $name, mixed $value = null) : \Gems_Menu_SubMenuItem
Inherited
see

Parameters

$name

string

Name of parameter

$value

mixed

Returns

\Gems_Menu_SubMenuItem(continuation pattern

Add a standard import action to the current menu item

addImportAction(string $privilege = null, array $other = array()) : \Gems_Menu_SubmenuItem
Inherited

Parameters

$privilege

string

A privilege name, defaults to parent + .import when not specified

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubmenuItem

Shortcut function to create the import container.

addImportContainer(string $label) : \Gems_Menu_MenuAbstract
Inherited

Parameters

$label

string

Label for the container

Returns

\Gems_Menu_MenuAbstractThe new contact page

Add the log menu items

addLogControllers() 
Inherited

Add required parameters - shown in the url - for this menu item.

addNamedParameters(mixed $arrayOrKey1 = null, $altName1 = null) : \Gems_Menu_SubMenuItem
Inherited

Numeric array keys are changed into the same string as the array value.

Parameters

$arrayOrKey1

mixed

\MUtil_Ra::pairs named array

$altName1

Returns

\Gems_Menu_SubMenuItem(continuation pattern)

addOptionalParameters()

addOptionalParameters($arrayOrKey1 = null, $altName1 = null
Inherited

Parameters

$arrayOrKey1

$altName1

Add a page to the menu

addPage(string $label, string $privilege, string $controller, string $action = 'index', array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

The label to display for the menu item, null for access without display

$privilege

string

The privilege for the item, null is always, 'pr.islogin' must be logged in, 'pr.nologin' only when not logged in.

$controller

string

What controller to use

$action

string

The name of the action

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubMenuItem

addParameterFilter()

addParameterFilter($arrayOrKey1 = null, $value1 = null
Inherited

Parameters

$arrayOrKey1

$value1

addParameters()

addParameters($arrayOrKey1 = null, $key2 = null
Inherited

Parameters

$arrayOrKey1

$key2

addPdfButton()

addPdfButton($label, $privilege, $controller = null, $action = 'pdf', array $other = array()
Inherited

Parameters

$label

$privilege

$controller

$action

$other

Add a list of report pages

addPlanPage(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

The label to display for the menu item, null for access without display

Returns

\Gems_Menu_SubMenuItem

Add pages that show the user technical information about the installation in the project.

addProjectInfoPage(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

Returns

\Gems_Menu_SubMenuItem

Add pages that show the user an overview of the tracks / surveys used in the project.

addProjectPage(string $label) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

Returns

\Gems_Menu_SubMenuItem

Add a standard show action to the current menu item

addShowAction(string $privilege = null, array $other = array()) : \Gems_Menu_SubmenuItem
Inherited

Parameters

$privilege

string

A privilege name, defaults to parent + .show when not specified

$other

array

Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'

Returns

\Gems_Menu_SubmenuItem

Add a staff browse edit page to the menu,

addStaffPage(string $label, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

$other

array

Returns

\Gems_Menu_SubMenuItem

Add a Trackbuilder menu tree to the menu

addTrackBuilderMenu(string $label, array $other = array()) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$label

string

$other

array

Returns

\Gems_Menu_SubMenuItem

applyHiddenParameters()

applyHiddenParameters(\Zend_Controller_Request_Abstract $request, \Gems_Menu_ParameterSource $source) 
Inherited

Parameters

$request

$source

applyToRequest()

applyToRequest(\Zend_Controller_Request_Abstract $request) 
Inherited

Parameters

$request

Check if a menu item contains these parameter settings

checkParameterFilter(mixed $arrayOrKey1, mixed $value1 = null) : boolean
Inherited

Parameters

$arrayOrKey1

mixed

\MUtil_Ra:pairs() name => value argument pairs

$value1

mixed

The value should be identical or when null, should not exist or be null

Returns

booleanTrue if all values where set

get()

get($key, $default = null
Inherited

Parameters

$key

$default

getChildren()

getChildren() : array
Inherited

Returns

arrayof type \Gems_Menu_SubMenuItem

getParameters()

getParameters() 
Inherited

getParent()

getParent() : \Gems_Menu_MenuAbstract
Inherited

Returns

\Gems_Menu_MenuAbstract

has()

has(string $key) : boolean
Inherited

Parameters

$key

string

Returns

boolean

hasChildren()

hasChildren() 
Inherited

is()

is($key, $value) 
Inherited

Parameters

$key

$value

True when allowed

isAllowed() : boolean
Inherited

Returns

boolean

isTopLevel()

isTopLevel() 
Inherited

isVisible()

isVisible() 
Inherited

Copy from \Zend_Translate_Adapter

plural(string $singular, string $plural, integer $number, string|\Zend_Locale $locale = null) : string
Inherited

Translates the given string using plural notations Returns the translated string

see

Parameters

$singular

string

Singular translation string

$plural

string

Plural translation string

$number

integer

Number for detecting the correct plural

$locale

string\Zend_Locale

(Optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

removeParameters()

removeParameters() 
Inherited

set()

set($key, $value) 
Inherited

Parameters

$key

$value

Set the organization id of the org parameter that can remain hidden.

setHiddenOrgId(\type $orgId) : \Gems_Menu_SubMenuItem
Inherited

Parameters

$orgId

\type

Returns

\Gems_Menu_SubMenuItem(continuation pattern)

Defines the number of named parameters using the model naming convention: id=x or id1=x id2=y

setModelParameters(integer $idCount) : \Gems_Menu_SubMenuItem
Inherited
see

Parameters

$idCount

integer

The number of parameters to define

Returns

\Gems_Menu_SubMenuItem(continuation pattern)

Set the required parameters - shown in the url - for this menu item.

setNamedParameters(mixed $arrayOrKey1 = null, mixed $key2 = null) : \Gems_Menu_SubMenuItem
Inherited

Numeric array keys are changed into the same string as the array value.

Parameters

$arrayOrKey1

mixed

\MUtil_Ra::pairs named array

$key2

mixed

Returns

\Gems_Menu_SubMenuItem(continuation pattern)

setParameterFilter()

setParameterFilter($arrayOrKey1 = null, $value1 = null
Inherited

Parameters

$arrayOrKey1

$value1

Sorts the childeren on their order attribute (instead of the order the were added)

sortByOrder() : \Gems_Menu_MenuAbstract
Inherited

Returns

\Gems_Menu_MenuAbstract(continuation pattern)

uasort() function for sortByOrder()

sortOrder(self $aItem, self $bItem) : integer
InheritedStatic
see

Parameters

$aItem

self

$bItem

self

Returns

integer

toActionLinkLower()

toActionLinkLower(mixed $parameterSources_args = null) : \MUtil_Html_AElement
Inherited

Parameters

$parameterSources_args

mixed

Returns

\MUtil_Html_AElement

toHRefAttribute()

toHRefAttribute(mixed $parameterSources_args = null) : \MUtil_Html_HrefArrayAttribute
Inherited

Parameters

$parameterSources_args

mixed

Returns

\MUtil_Html_HrefArrayAttribute

toRouteUrl()

toRouteUrl($parameterSources_args = null
Inherited

Parameters

$parameterSources_args

toUl()

toUl($actionController = null
Inherited

Parameters

$actionController

Adds privileges that are used in this menu item to the array

_addUsedPrivileges(array $privileges, $label) 
Inherited

Parameters

$privileges

array

$label

Get tge request to use for menu building

_getOriginalRequest() : \Zend_Controller_Request_Abstract
Inherited

Returns

\Zend_Controller_Request_Abstract

Returns a \Zend_Navigation creation array for this menu item, with sub menu items in 'pages'

_toNavigationArray(\Gems_Menu_ParameterCollector $source) : array
inherited_from \Gems_Menu_SubMenuItem::_toNavigationArray()

Parameters

$source

\Gems_Menu_ParameterCollector

Returns

array

Returns a \Zend_Navigation creation array for this menu item, with sub menu items in 'pages'

_toNavigationArray(\Gems_Menu_ParameterCollector $source) : array
Inherited

Parameters

$source

\Gems_Menu_ParameterCollector

Returns

array

_toRouteArray()

_toRouteArray(\Gems_Menu_ParameterCollector $source) 
Inherited

Parameters

$source

Add a sub item to this item.

add(array $args_array) : \Gems_Menu_SubMenuItem
Inherited

The argumenets can be any of those used for \Zend_Navigation_Page as well as some Gems specials.

  • 'action' The name of the action.
  • 'allowed' Is the user allowed to access this menu item. Is checked against ACL using 'privilige'.
  • 'button_only' Never in the menu, only shown as a button by the program.
  • 'class' Display class for the menu link.
  • 'controller' What controller to use.
  • 'icon' Icon to display with the label.
  • 'label' The label to display for the menu item.
  • 'privilege' The privilege needed to choose the item.
  • 'target' Optional target attribute for the link.
  • 'type' Optional content type for the link
  • 'visible' Is the item visible. Is checked against ACL using 'privilige'.

see

Parameters

$args_array

array

\MUtil_Ra::args array with defaults 'visible' and 'allowed' true.

Returns

\Gems_Menu_SubMenuItem

Set the visibility of the menu item and any sub items in accordance with the specified user role.

applyAcl(\Zend_Acl $acl, string $userRole) : \Gems_Menu_MenuAbstract

Parameters

$acl

\Zend_Acl

$userRole

string

Returns

\Gems_Menu_MenuAbstract(continuation pattern)

Set the visibility of the menu item and any sub items in accordance with the specified user role.

applyAcl(\Zend_Acl $acl, string $userRole) : \Gems_Menu_MenuAbstract
Inherited

Parameters

$acl

\Zend_Acl

$userRole

string

Returns

\Gems_Menu_MenuAbstract(continuation pattern)

findItem()

findItem(\<type> $options, \<type> $findDeep = true) : \Gems_Menu_SubMenuItem | null
Inherited

Parameters

$options

\<type>

$findDeep

\<type>

Returns

\Gems_Menu_SubMenuItemnull

findItemPath()

findItemPath($options) 
Inherited

Parameters

$options

findItems()

findItems($options, array $results) 
Inherited

Parameters

$options

$results

notSet()

notSet($key_args) 
Inherited

Parameters

$key_args

Make sure only the active branch is visible

setBranchVisible(array $activeBranch) : \Gems_Menu_MenuAbstract

Parameters

$activeBranch

array

Of \Gems_Menu_Menu Abstract items

Returns

\Gems_Menu_MenuAbstract(continuation pattern)

Make sure only the active branch is visible

setBranchVisible(array $activeBranch) : \Gems_Menu_MenuAbstract
Inherited

Parameters

$activeBranch

array

Of \Gems_Menu_Menu Abstract items

Returns

\Gems_Menu_MenuAbstract(continuation pattern)

setForChildren()

setForChildren($key, $value) 
Inherited

Parameters

$key

$value

Return true when then $source does NOT contain all items in the parameterFilter

_applyParameterFilter(\Gems_Menu_ParameterCollector $source, boolean $raiseConditions, mixed $condition) : boolean
Inherited

Parameters

$source

\Gems_Menu_ParameterCollector

$raiseConditions

boolean

$condition

mixed

Returns

boolean

_applyParameterSource()

_applyParameterSource(\Gems_Menu_ParameterCollector $source, array $parameters) 
Inherited

Parameters

$source

$parameters

A function that determines the parameters that this menu item should have using these paramter sources.

_applyParameterSources(\Gems_Menu_ParameterCollector $source, array $parameters, boolean $raiseConditions) : boolean
Inherited

Parameters

$source

\Gems_Menu_ParameterCollector

A source of parameter values

$parameters

array

A usually empty array of parameters that is filled from the sources

$raiseConditions

boolean

When true, no lazyness is returned

Returns

booleanOr lazy condition. When true menu item is enabled otherwise false

_getSessionStore()

_getSessionStore($label) : \Zend_Session_Namespace
Static

Parameters

$label

Returns

\Zend_Session_Namespace

Generate a hrf attribute using these sources

_toHRef(\Gems_Menu_ParameterCollector $source, boolean $condition) : \MUtil_Html_HrefArrayAttribute
Inherited

Parameters

$source

\Gems_Menu_ParameterCollector

A parameter source collection

$condition

boolean

When true the system may create a Lazy condition for the url

Returns

\MUtil_Html_HrefArrayAttribute

_toLi()

_toLi(\Gems_Menu_ParameterCollector $source) 
Inherited

Parameters

$source

check()

check(array $options) 
Inherited

Parameters

$options

 Properties

 

$escort

$escort : \GemsEscort

Default

 

$_subItems

$_subItems 

Default

array()
 

$translateAdapter

$translateAdapter : \Zend_Translate_Adapter

Default

 

$user

$user : \Gems_User_User

Default

 

$_hiddenOrgId

$_hiddenOrgId 

Default

 

$_hiddenParameters

$_hiddenParameters 

Default

 

$_itemOptions

$_itemOptions 

Default

 

$_parameterFilter

$_parameterFilter 

Default

 

$_parameters

$_parameters 

Default

true
 

$_parent

$_parent 

Default

 

$_requiredParameters

$_requiredParameters 

Default

 

$_sessionStore

$_sessionStore : \Zend_Session_Namespace

Default

Static