ocPortal Developer's Guide: Menus
» Return to Contentssources/menus.php
Global_functions_menus.php
Function summary
| void | init__menus () |
| array | build_stored_menu_hooked (array collect, ID_TEXT type, ?integer parent) |
| array | build_management_menu () |
| array | build_community_menu () |
| array | build_zone_menu () |
| tempcode | build_stored_menu (ID_TEXT type, SHORT_TEXT menu, boolean silent_failure) |
| array | build_stored_menu_branch (array thisitem, array items) |
| tempcode | render_menu (array menu, ?MEMBER source_member, ID_TEXT type, boolean as_admin) |
| array | render_menu_branch (array branch, SHORT_TEXT codename, MEMBER source_member, integer level, ID_TEXT type, boolean as_admin, array all_branches, integer the_level) |
| integer | num_staff_icons () |
void init__menus()
Standard code module initialisation function.
Parameters…
(No return value)
array build_stored_menu_hooked(array collect, ID_TEXT type, ?integer parent)
Build a pseudo 'stored menu' out of do_next_menus hooks (we create database rows so we can render it as a normal stored menu).
Parameters…
| Name | collect |
|---|---|
| Description | The complete collection of hooks |
| Type | array |
| Name | type |
|---|---|
| Description | The encoded 'type' in the menu tree we are showing for at (textual parent) |
| Type | ID_TEXT |
| Name | parent |
|---|---|
| Description | The parent ID (NULL: no parent) |
| Default value | |
| Type | ?integer |
Returns…
| Description | Faked database rows |
|---|---|
| Type | array |
array build_management_menu()
Build management menu.
Parameters…
Returns…
| Description | Faked database rows |
|---|---|
| Type | array |
array build_community_menu()
Build community menu.
Parameters…
Returns…
| Description | Faked database rows |
|---|---|
| Type | array |
array build_zone_menu()
Build zone menu.
Parameters…
Returns…
| Description | Faked database rows |
|---|---|
| Type | array |
tempcode build_stored_menu(ID_TEXT type, SHORT_TEXT menu, boolean silent_failure)
Take a stored menu identifier, and return an XHTML menu created from it.
Parameters…
| Name | type |
|---|---|
| Description | The type of the menu (determines which templates to use) |
| Type | ID_TEXT |
| Name | menu |
|---|---|
| Description | The menu identifier to use |
| Type | SHORT_TEXT |
| Name | silent_failure |
|---|---|
| Description | Whether to silently return blank if the menu does not exist |
| Default value | boolean-false |
| Type | boolean |
Returns…
| Description | The generated tempcode of the menu |
|---|---|
| Type | tempcode |
array build_stored_menu_branch(array thisitem, array items)
Build a menu branch map from a database row.
Parameters…
| Name | thisitem |
|---|---|
| Description | The database row |
| Type | array |
| Name | items |
|---|---|
| Description | List of all the database rows for this menu |
| Type | array |
Returns…
| Description | The menu branch map |
|---|---|
| Type | array |
tempcode render_menu(array menu, ?MEMBER source_member, ID_TEXT type, boolean as_admin)
Render a stored menu to tempcode.
Parameters…
| Name | menu |
|---|---|
| Description | Menu details |
| Type | array |
| Name | source_member |
|---|---|
| Description | The member the menu is being built as (NULL: current member) |
| Type | ?MEMBER |
| Name | type |
|---|---|
| Description | The menu type (determines what templates get used) |
| Type | ID_TEXT |
| Name | as_admin |
|---|---|
| Description | Whether to generate Comcode with admin privilege |
| Default value | boolean-false |
| Type | boolean |
Returns…
| Description | The generated tempcode of the menu |
|---|---|
| Type | tempcode |
array render_menu_branch(array branch, SHORT_TEXT codename, MEMBER source_member, integer level, ID_TEXT type, boolean as_admin, array all_branches, integer the_level)
Render a menu branch to tempcode.
Parameters…
| Name | branch |
|---|---|
| Description | The menu branch map |
| Type | array |
| Name | codename |
|---|---|
| Description | An identifier for the menu (will be used as a unique id by menu javascript code) |
| Type | SHORT_TEXT |
| Name | source_member |
|---|---|
| Description | The member the menu is being built as |
| Type | MEMBER |
| Name | level |
|---|---|
| Description | The depth into the menu that this branch resides at |
| Type | integer |
| Name | type |
|---|---|
| Description | The menu type (determines what templates get used) |
| Type | ID_TEXT |
| Name | as_admin |
|---|---|
| Description | Whether to generate Comcode with admin privilege |
| Type | boolean |
| Name | all_branches |
|---|---|
| Description | Array of all other branches |
| Type | array |
| Name | the_level |
|---|---|
| Description | The level |
| Default value | 1 |
| Type | integer |
Returns…
| Description | A pair: array of parameters of the menu branch (or NULL if unrenderable, or Tempcode of something to attach), and whether it is expanded |
|---|---|
| Type | array |
integer num_staff_icons()
Find the number of icons the member of staff has.
Parameters…
Returns…
| Description | The count |
|---|---|
| Type | integer |
sources/menus2.php
Global_functions_menus2.php
Function summary
| void | init__menus2 () |
| void | menu_management_script () |
| AUTO_LINK | add_menu_item_simple (SHORT_TEXT menu, ?mixed parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY expanded, BINARY check_permissions, boolean dereference_caption, SHORT_TEXT caption_long, BINARY new_window) |
| void | delete_menu_item_simple (SHORT_TEXT url) |
| AUTO_LINK | add_menu_item (SHORT_TEXT menu, integer order, ?AUTO_LINK parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY check_permissions, SHORT_TEXT page_only, BINARY expanded, BINARY new_window, SHORT_TEXT caption_long) |
| void | edit_menu_item (AUTO_LINK id, SHORT_TEXT menu, integer order, ?AUTO_LINK parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY check_permissions, SHORT_TEXT page_only, BINARY expanded, BINARY new_window, SHORT_TEXT caption_long) |
| void | delete_menu_item (AUTO_LINK id) |
void init__menus2()
Standard code module initialisation function.
Parameters…
(No return value)
void menu_management_script()
Move a menu branch.
Parameters…
(No return value)
AUTO_LINK add_menu_item_simple(SHORT_TEXT menu, ?mixed parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY expanded, BINARY check_permissions, boolean dereference_caption, SHORT_TEXT caption_long, BINARY new_window)
Add a menu item, without giving tedious/unnecessary detail.
Parameters…
| Name | menu |
|---|---|
| Description | The name of the menu to add the item to. |
| Type | SHORT_TEXT |
| Name | parent |
|---|---|
| Description | The menu item ID of the parent branch of the menu item (AUTO_LINK) / the URL of something else on the same menu (URLPATH) (NULL: is on root). |
| Type | ?mixed |
| Name | caption |
|---|---|
| Description | The caption. |
| Type | SHORT_TEXT |
| Name | url |
|---|---|
| Description | The URL (in entry point form). |
| Default value | |
| Type | SHORT_TEXT |
| Name | expanded |
|---|---|
| Description | Whether it is an expanded branch. |
| Default value | 0 |
| Type | BINARY |
| Name | check_permissions |
|---|---|
| Description | Whether people who may not view the entry point do not see the link. |
| Default value | 0 |
| Type | BINARY |
| Name | dereference_caption |
|---|---|
| Description | Whether the caption is a language code. |
| Default value | boolean-true |
| Type | boolean |
| Name | caption_long |
|---|---|
| Description | The tooltip (blank: none). |
| Default value | |
| Type | SHORT_TEXT |
| Name | new_window |
|---|---|
| Description | Whether the link will open in a new window. |
| Default value | 0 |
| Type | BINARY |
Returns…
| Description | The ID of the newly added menu item. |
|---|---|
| Type | AUTO_LINK |
void delete_menu_item_simple(SHORT_TEXT url)
Delete a menu item, without giving tedious/unnecessary detail.
Parameters…
| Name | url |
|---|---|
| Description | The URL (in entry point form). |
| Type | SHORT_TEXT |
(No return value)
AUTO_LINK add_menu_item(SHORT_TEXT menu, integer order, ?AUTO_LINK parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY check_permissions, SHORT_TEXT page_only, BINARY expanded, BINARY new_window, SHORT_TEXT caption_long)
Add a menu item.
Parameters…
| Name | menu |
|---|---|
| Description | The name of the menu to add the item to. |
| Type | SHORT_TEXT |
| Name | order |
|---|---|
| Description | The relative order of this item on the menu. |
| Type | integer |
| Name | parent |
|---|---|
| Description | The menu item ID of the parent branch of the menu item (NULL: is on root). |
| Type | ?AUTO_LINK |
| Name | caption |
|---|---|
| Description | The caption. |
| Type | SHORT_TEXT |
| Name | url |
|---|---|
| Description | The URL (in entry point form). |
| Type | SHORT_TEXT |
| Name | check_permissions |
|---|---|
| Description | Whether people who may not view the entry point do not see the link. |
| Type | BINARY |
| Name | page_only |
|---|---|
| Description | Match-keys to identify what pages the item is shown on. |
| Type | SHORT_TEXT |
| Name | expanded |
|---|---|
| Description | Whether it is an expanded branch. |
| Type | BINARY |
| Name | new_window |
|---|---|
| Description | Whether the link will open in a new window. |
| Type | BINARY |
| Name | caption_long |
|---|---|
| Description | The tooltip (blank: none). |
| Type | SHORT_TEXT |
Returns…
| Description | The ID of the newly added menu item. |
|---|---|
| Type | AUTO_LINK |
void edit_menu_item(AUTO_LINK id, SHORT_TEXT menu, integer order, ?AUTO_LINK parent, SHORT_TEXT caption, SHORT_TEXT url, BINARY check_permissions, SHORT_TEXT page_only, BINARY expanded, BINARY new_window, SHORT_TEXT caption_long)
Edit a menu item.
Parameters…
| Name | id |
|---|---|
| Description | The ID of the menu item to edit. |
| Type | AUTO_LINK |
| Name | menu |
|---|---|
| Description | The name of the menu to add the item to. |
| Type | SHORT_TEXT |
| Name | order |
|---|---|
| Description | The relative order of this item on the menu. |
| Type | integer |
| Name | parent |
|---|---|
| Description | The menu item ID of the parent branch of the menu item (NULL: is on root). |
| Type | ?AUTO_LINK |
| Name | caption |
|---|---|
| Description | The caption. |
| Type | SHORT_TEXT |
| Name | url |
|---|---|
| Description | The URL (in entry point form). |
| Type | SHORT_TEXT |
| Name | check_permissions |
|---|---|
| Description | Whether people who may not view the entry point do not see the link. |
| Type | BINARY |
| Name | page_only |
|---|---|
| Description | Match-keys to identify what pages the item is shown on. |
| Type | SHORT_TEXT |
| Name | expanded |
|---|---|
| Description | Whether it is an expanded branch. |
| Type | BINARY |
| Name | new_window |
|---|---|
| Description | Whether the link will open in a new window. |
| Type | BINARY |
| Name | caption_long |
|---|---|
| Description | The tooltip (blank: none). |
| Type | SHORT_TEXT |
(No return value)
void delete_menu_item(AUTO_LINK id)
Delete a menu item.
Parameters…
| Name | id |
|---|---|
| Description | The ID of the menu item to delete. |
| Type | AUTO_LINK |
(No return value)




0 reviews: Unrated (average)
There have been no comments yet