Bitrix Site Manager

Administrative menu

The menu of administrative section is displayed by the standard function CMain::GetMenuHtmlEx.

The menu template is stored in the file:

/bitrix/modules/main/interface/.left.menu_template.php

The main file that builds the menu items is:

/bitrix/modules/main/interface/.left.menu.php

This file enumerates all files in /bitrix/modules/module ID/admin/menu.php. Each of these files contains the definition of array $aModuleMenuLinks which contains menu items of the corresponding module. All these arrays will be further combined into a standard array $arMenuSections containing the information of all menu items (see also Menu).

The array $aModuleMenuLinks structure:

Array
(
    [0] => Array
        (
            [0] => menu item title
            [1] => menu item link
            [2] => Array
                (
                    [0] => additional links for highlighting the menu item 1
                    [1] => additional links for highlighting the menu item 2
                    ...
                    [N] =>  additional links for highlighting the menu item N
                )
            [3] => Array
                (
                    [ALT] => menu item tooltip text
                    [SECTION_ID] => the unique ID of a menu section,
                                    has the value of the module ID,
                                    or one of the following:
                                       FAVORITE - the Favorites section
                                       GENERAL - the Users section
                                       MAIN - the System Settings section

                    [SEPARATOR] => "Y" - menu item is a menu section title
                    [SORT] => menu section sort weight
                              relative to other menu section (only if SEPARATOR is "Y")
                    [ICON] => link to a small icon used
                              in a menu section title (only if SEPARATOR is "Y")
                    [BIG_ICON] => link to a large icon used
                                  on the Desktop page (only if SEPARATOR is "Y")
                    [INDEX_PAGE] => link for the icon BIG_ICON (only if SEPARATOR is "Y")
                )

        )
    [1] => Array( -//- )
    [2] => Array( -//- )
    ...
    [M] => Array( -//- )
)

Example

The following is the example of file /bitrix/modules/support/admin/menu.php which builds the Techsupport module menu:

<?
// include language file
IncludeModuleLangFile(__FILE__);

// determine the current user permissions
$SUP_RIGHT = $APPLICATION->GetGroupRight("support");

// if access is allowed
if($SUP_RIGHT>"D")
{
    // add menu items according to permissions

    $aModuleMenuLinks[] = Array(
            GetMessage("SUP_M_SUPPORT"), 
            "",
            Array(),
            Array(
                "SEPARATOR"  => "Y",
                "SORT"       => 1000,
                "ICON"       => "/bitrix/images/support/mnu_support.gif",
                "BIG_ICON"   => "/bitrix/images/support/support.gif",
                "INDEX_PAGE" => "/bitrix/admin/ticket_desktop.php?lang=".
                                LANGUAGE_ID."&set_default=Y"
                )
            );

    if ($SUP_RIGHT>="T")
    {
        $aModuleMenuLinks[] = Array(
                GetMessage("SUP_M_REPORT_TABLE"), 
                "/bitrix/admin/ticket_desktop.php?lang=".
                LANGUAGE_ID."&set_default=Y",
                Array("/bitrix/admin/ticket_desktop.php"),
                Array("ALT"=>GetMessage("SUP_M_REPORT_TABLE_ALT"))
                );
    }

    $aModuleMenuLinks[] = Array(
            GetMessage("SUP_M_TICKETS"), 
            "/bitrix/admin/ticket_list.php?lang=".
            LANGUAGE_ID."&set_default=Y",
            Array(
                "/bitrix/admin/ticket_list.php", 
                "/bitrix/admin/ticket_edit.php", 
                "/bitrix/admin/ticket_message_edit.php"
                ),
            Array("ALT"=>GetMessage("SUP_M_TICKETS_ALT"))
            );

    if ($SUP_RIGHT>="T")
    {
        $aModuleMenuLinks[] = Array(
                GetMessage("SUP_M_REPORT_GRAPH"), 
                "/bitrix/admin/ticket_report_graph.php?lang=".
                LANGUAGE_ID."&set_default=Y",
                Array("/bitrix/admin/ticket_report_graph.php"),
                Array("ALT"=>GetMessage("SUP_M_REPORT_GRAPH_ALT"))
                );
    }

    if ($SUP_RIGHT>="V")
    {
        $aModuleMenuLinks[] = Array(
                GetMessage("SUP_M_CATEGORY"), 
                "/bitrix/admin/ticket_dict_list.php?lang=".
                LANGUAGE_ID."&find_type=C&set_filter=Y",
                Array(
                    "/bitrix/admin/ticket_dict_edit.php?find_type=C",
                    "/bitrix/admin/ticket_dict_list.php?find_type=C"
                    )
                );
    }
}
?>

If you need to add an item to the administrative menu, even if you are not developing your own module, initialise the array $aMenuLinks with the corresponding values in the file /bitrix/admin/.left.menu.php.

Example

The file /bitrix/admin/.left.menu.php adds an arbitrary menu item.

<?
// add menu item "Import equipment" 
// to section "Information blocks"
$aMenuLinks = Array(
    Array(
        "Import equipment", 
        "/bitrix/admin/equipment_import.php?lang=ru", 
        Array(), 
        Array(
            "ALT" => "Import equipment from DBF files", 
            "SECTION_ID" => "iblock",
            "SORT" => "100"
        )
    )
);
?>

See Also