Views: 15218
Last Modified: 18.06.2019

Administrative Scripts - are the scripts used by the module in the administrative part of the system. They must be located in the catalog /bitrix/modules/module ID/admin/.

It must be taken into account that administrative scripts cannot be accessed directly in the browser (like any scripts of the /bitrix/modules/). That is why additional homonymous access scripts are used in order to access administrative scripts. Access scripts are located in the catalog /bitrix/admin/. As a rule, they only contain the connection of the administrative script of the same name:

require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/module ID/admin/script");

When installing the module, access scripts must be copied from the catalog /bitrix/modules/module ID/install/admin/ to the catalog /bitrix/admin/. Upon deinstallation of the module access scripts must be deleted from this catalog.

Note: It must be taken into account that access scripts of all installed modules are located in the same catalog /bitrix/admin/; that is why it is recommended that their names start with a prefix characteristic only for the relevant module to avoid duplication.

Each administrative script must have a defined constant ADMIN_MODULE_NAME, before connecting a visual part of administrative prologue. This constant is required to generate an icon above the page header. The constant is also required to jump quickly to the module settings when clicking the Settings button. It is usually set in prolog.php.

Example of the definitions of such constants:

define("ADMIN_MODULE_NAME", "statistic");
define("ADMIN_MODULE_ICON", "<a href=\"stat_list.php?lang=".LANGUAGE_ID."\">
<img src=\"/bitrix/images/statistic/statistic.gif\" 
width=\"48\" height=\"48\" border=\"0\" alt=\"".GetMessage("STAT_MODULE_TITLE")."\"

Language Files for Administrative Scripts of the Module

Language files must be located in the catalog /bitrix/modules/module ID/lang/language ID/. The particularity of their location inside this catalog is that they must be located strictly following the same path from the catalog /bitrix/modules/module ID/ as the homonymous files in which they are connected. In this case, language files can only be connected using the function IncludeModuleLangFile.

For example, for the script /bitrix/modules/module ID/admin/body/my_script.php the language file must be located here: /bitrix/modules/module ID/lang/language ID/admin/body/my_script.php.

And connected using the code:

Courses developed by Bitrix24