get("nikolaevevge.errormes"); $config->add("nikolaevevge.errormes",$array); $config->save(); */ use \Bitrix\Main\localization\Loc; use \Bitrix\Main\Loader; use \Bitrix\Main\Entity\Base; Class nikolaevevge_errormes extends CModule { var $MODULE_ID = "nikolaevevge.errormes"; var $MODULE_VERSION; var $MODULE_VERSION_DATE; var $MODULE_NAME; var $MODULE_DESCRIPTION; var $MODULE_CSS; function __construct() { $arModuleVersion = array(); $path = str_replace("\\", "/", __FILE__); $path = substr($path, 0, strlen($path) - strlen("/index.php")); include($path."/version.php"); if (is_array($arModuleVersion) && array_key_exists("VERSION",$arModuleVersion)) { $this->MODULE_VERSION = $arModuleVersion["VERSION"]; $this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"]; } $this->MODULE_NAME = Loc::getMessage("NIKOLAEVEVGE_ERRORMES_MODULE_NAME"); $this->MODULE_DESCRIPTION = Loc::getMessage("NIKOLAEVEVGE_ERRORMES_MODULE_DESCRIPTION");//Имя партнёра $this->PARTNER_NAME = Loc::getMessage("SPER_PARTNER");//GetMessage("Имя партнёра"); $this->PARTNER_URI = Loc::getMessage("PARTNER_URI"); // $this->MODULE_GROUP_RIGHTS = "Y"; } function InstallFiles() { CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/local/modules/nikolaevevge.errormes/install/components",$_SERVER["DOCUMENT_ROOT"]."/bitrix/components",true,true); return true; } function InstallDB() { var_dump(Loader::includeModule($this->MODULE_ID)); if (!\Bitrix\Main\Application::getConnection(\Nikolaevevge\Errormes\ErrormesTable::getConnectionName())->isTableExists(Base::getInstance('\Nikolaevevge\Errormes\ErrormesTable')->getDBTableName("" . Base::getInstance('\Nikolaevevge\Errormes\ErrormesTable')))) { Base::getInstance('\Nikolaevevge\Errormes\ErrormesTable')->createDBTable();echo "AAAAA"; } else {echo "BBBBB";} } function UnInstallFiles() { DeleteDirFilesEx("/local/components/nikolaevevge"); return true; } function DoInstall() { global $APPLICATION;//$DOCUMENT_ROOT if ($this->isVersionD7()) { // $this->InstallFiles(); \Bitrix\Main\EventManager::getInstance()->registerEventHandler("main","OnBeforeProlog",$this->MODULE_ID,"\Nikolaevevge\Errormes\AddJS","add"); \Bitrix\Main\EventManager::getInstance()->registerEventHandler("main","OnBuildGlobalMenu",$this->MODULE_ID,"\Nikolaevevge\Errormes\Event","admGlobalMenuAddItem"); RegisterModule("nikolaevevge.errormes"); $this->InstallDB(); $APPLICATION->IncludeAdminFile("Установка модуля nikolaevevge.errormes",$this->getPath()."/install/step.php"); } else { $APPLICATION->ThrowException(Loc::getMessage("NIKOLAEVEVGE_ERRORMES_ERROR_BITRIX_VERSION")); $APPLICATION->IncludeAdminFile("Установка модуля nikolaevevge.errormes",$this->getPath()."/install/step.php"); } } function DoUninstall() { global $APPLICATION;//$DOCUMENT_ROOT // $this->UnInstallFiles(); \Bitrix\Main\EventManager::getInstance()->unRegisterEventHandler("main","OnBeforeProlog",$this->MODULE_ID,"\Nikolaevevge\Errormes\AddJS","add"); \Bitrix\Main\EventManager::getInstance()->unRegisterEventHandler("main","OnBuildGlobalMenu",$this->MODULE_ID,"\Nikolaevevge\Errormes\Event","admGlobalMenuAddItem"); UnRegisterModule("nikolaevevge.errormes"); //\Bitrix\Main\Application::getConnection(\Nikolaevevge\Errormes\ErrormesTable::getConnectionName())->QueryEecute("");//https://www.youtube.com/watch?v=c8_zNdX_cWA&list=PLzPivwyXljVVdpY3tRZun3XeuI0L4bF8x&index=18 $APPLICATION->IncludeAdminFile("Деинсталляция модуля nikolaevevge.errormes",$this->getPath()."/install/unstep.php"); } function isVersionD7() { return CheckVersion(\Bitrix\Main\ModuleManager::getVersion("main"),"14.00.00"); } function getPath($notDocumentRoot=false) { if ($notDocumentRoot) { return str_ireplace(Application::getDocumentRoot(),"",dirname(__DIR__)); } else { return dirname(__DIR__); } } } step.php getException()) { echo CAdminMessage::ShowMessage(array( "TYPE" => "ERROR", "MESSAGE" => "A123", "DETAILS" => $ex->getString(), "HTML" => true )); } else { echo CAdminMessage::ShowNote(Loc::getMessage("NIKOLAEVEVGE_TESTM_BACK_INSTALLED_SUCCESSFULLY")); } ?> "> unstep.php&f=t "0.0.1", "VERSION_DATE" => "2023-05-22 22:18:00" ); lib/errormes.php true, "autocomplete" => true )), new Entity\StringField("URL",array( "required" => true )) ); } } addJs("/local/modules/nikolaevevge.errormes/script.js"); return true; } public static function admGlobalMenuAddItem(&$aGlobalMenu, &$aModuleMenu) { var_dump($aGlobalMenu); $aGlobalMenu["global_menu_nikolaevevge"] = array( "menu_id"=>"nikolaevevge", "text"=>"Ошибки сайта", "title"=>"title2", "url"=>"index.php?lang=ru", "sort"=>95, "items_id"=>"global_menu_nikolaevevge", "help_section"=>"nikolaevevge", "items"=>array( array( "text"=>"Сообщения о ошибках", "url"=>"nikolaevevge.errormes_list.php", "module_id"=>"nikolaevevge.errormes",//Не понятно зачем этот элемент массива "icon"=>"fileman_sticker_icon", "title"=>"123", "more_url"=>array("itstudio.support_support__edit.php") ), array( "text"=>"Написать разработчику", "url"=>"mailto:nikolaevevge@mail.ru", "module_id"=>"nikolaevevge.errormes",//Не понятно зачем этот элемент массива "icon"=>"fileman_sticker_icon", "title"=>"123", ) ) ); /* array(2) { [0]=> "text"=>"Запросы", "url"]=>"itstudio.support_support__list.php", "module_id"=>"itstudio.support", "icon"=>"iblock_menu_icon_iblocks", "title"=>"", "more_url"=>array("itstudio.support_support__edit.php") } } [1]=> array(5) { ["text"]=> string(31) "Настройка модуля" ["url"]=> string(41) "settings.php?lang=ru&mid=itstudio.support" ["icon"]=> string(25) "iblock_menu_icon_settings" ["module_id"]=> string(16) "itstudio.support" ["title"]=> string(0) "" } ["global_menu_desktop"]=> array(8) { ["menu_id"]=> string(7) "desktop" ["text"]=> string(23) "Рабочий стол" ["title"]=> string(23) "Рабочий стол" ["url"]=> string(17) "index.php?lang=ru" ["sort"]=> int(50) ["items_id"]=> string(19) "global_menu_desktop" ["help_section"]=> string(7) "desktop" ["items"]=> array(0) { } "menu_id"=>"nikolaevevge","text"=>"text","title"=>"title","url"=>"index.php?lang=ru","sort"=>95,"items_id"=>"global_menu_desktop","help_section"=>"desktop","items"=>array()*/ return true; } }