commit 4c78e1c77aa8da896bd3f9ae7f38f908e5577bc2 Author: bellord13 Date: Thu Apr 13 17:03:50 2023 +0300 fix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98e3112 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.env +src/config.php +*_config.php +!default_config.php +src/Defines.php +src/*Defines.php +src/*Facade.php +!*.example +!.example \ No newline at end of file diff --git a/.module.json b/.module.json new file mode 100644 index 0000000..4f44c08 --- /dev/null +++ b/.module.json @@ -0,0 +1,9 @@ +{ + "id": "bx.null", + "prefix": "bx_null", + "namespace": "Bx\\Null", + "gitUrl": "https://bitbucket.org/bellord13/bx.null/", + "version": "1.0.0", + "date": "2023-04-13 00:00:00", + "deps": ["wt.core"] +} \ No newline at end of file diff --git a/admin/main/config.php b/admin/main/config.php new file mode 100644 index 0000000..ce885d5 --- /dev/null +++ b/admin/main/config.php @@ -0,0 +1,23 @@ + array( + 'TITLE' => GetMessage('MAIN_OPTIONS_PARAMETERS'), + 'THEME' => 'Y', + 'OPTIONS' => array( + + ), + ), + 'TEST' => array( + 'TITLE' => 'test', + 'OPTIONS' => array( + 'TEST' => array( + 'TITLE' => 'test_setting', + 'TYPE' => 'text', + 'DEFAULT' => '', + ), + ), + ), +); \ No newline at end of file diff --git a/admin/main/index.php b/admin/main/index.php new file mode 100644 index 0000000..93dc155 --- /dev/null +++ b/admin/main/index.php @@ -0,0 +1,9 @@ +render(); + +require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php'); \ No newline at end of file diff --git a/admin/main/lang/ru/config.php b/admin/main/lang/ru/config.php new file mode 100644 index 0000000..871f3bf --- /dev/null +++ b/admin/main/lang/ru/config.php @@ -0,0 +1,5 @@ +setSort(10) + ->setTitle('Cml для 1С'); \ No newline at end of file diff --git a/admin/main/submenu/item1/config.php b/admin/main/submenu/item1/config.php new file mode 100644 index 0000000..329d2a9 --- /dev/null +++ b/admin/main/submenu/item1/config.php @@ -0,0 +1,30 @@ + array( + 'TITLE' => 'Общие сведения', + 'OPTIONS' => array( + + ), + ), + 'DOCS' => array( + 'TITLE' => 'Docs', + 'OPTIONS' => array( + 'DOCUMENTATION' => array( + 'TITLE' => 'Documentation', + 'TYPE' => 'content', + 'INCLUDEFILE' => \Wt\Core\Tools::removeDocRoot(__DIR__ . '/include/documentation.php'), + 'SHOW_EDIT_BUTTON' => 'Y', + 'DEFAULT' => '', + ), + ), + ), +); \ No newline at end of file diff --git a/admin/main/submenu/item1/include/documentation.php b/admin/main/submenu/item1/include/documentation.php new file mode 100644 index 0000000..45d092e --- /dev/null +++ b/admin/main/submenu/item1/include/documentation.php @@ -0,0 +1 @@ +Документация \ No newline at end of file diff --git a/admin/main/submenu/item1/index.php b/admin/main/submenu/item1/index.php new file mode 100644 index 0000000..52fe0e0 --- /dev/null +++ b/admin/main/submenu/item1/index.php @@ -0,0 +1,18 @@ +render(); + +require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/epilog_admin.php'); \ No newline at end of file diff --git a/admin/main/submenu/item1/lang/ru/index.php b/admin/main/submenu/item1/lang/ru/index.php new file mode 100644 index 0000000..c090dcf --- /dev/null +++ b/admin/main/submenu/item1/lang/ru/index.php @@ -0,0 +1,2 @@ +setSort(5) + ->setTitle('Создание CML') + ->setUrl(); \ No newline at end of file diff --git a/default_config.php b/default_config.php new file mode 100644 index 0000000..25058db --- /dev/null +++ b/default_config.php @@ -0,0 +1,5 @@ +container())); \ No newline at end of file diff --git a/install/index.php b/install/index.php new file mode 100644 index 0000000..576176c --- /dev/null +++ b/install/index.php @@ -0,0 +1,94 @@ +sys = $module; + + $this->MODULE_ID = $module['id']; + $this->MODULE_VERSION = $module['version']; + $this->MODULE_VERSION_DATE = $module['date']; + + $langPrefix = strtoupper($module['prefix']); + + $this->PARTNER_NAME = GetMessage("{$langPrefix}_PARTNER_NAME"); + $this->PARTNER_URI = GetMessage("{$langPrefix}_PARTNER_URI"); + $this->MODULE_NAME = GetMessage("{$langPrefix}_MODULE_NAME"); + $this->MODULE_DESCRIPTION = GetMessage("{$langPrefix}_MODULE_DESCRIPTION"); + } + + + function DoInstall() + { + global $DOCUMENT_ROOT, $APPLICATION; + + if(is_array($this->sys['deps'])){ + foreach ($this->sys['deps'] as $moduleId){ + if (!\Bitrix\Main\Loader::includeModule($moduleId)) { + $APPLICATION->ThrowException("Module {$moduleId} not installed!"); + return false; + } + } + } + + if (!CheckVersion(PHP_VERSION, "5.4.0")) { + $APPLICATION->ThrowException('Php version required more 5.4.0'); + return false; + } + + RegisterModule($this->MODULE_ID); + RegisterModuleDependences("main", "OnPageStart", $this->MODULE_ID); + $this->InstallEvents(); + $this->InstallCatalogExport(); + + + return true; + } + + function DoUninstall() + { + global $DOCUMENT_ROOT, $APPLICATION; + UnRegisterModule($this->MODULE_ID); + UnRegisterModuleDependences("main", "OnPageStart", $this->MODULE_ID, "", ""); + $this->UnInstallEvents(); + $this->UnInstallCatalogExport(); + return true; + } + + function InstallCatalogExport() + { + if(is_dir(__DIR__."/catalog_export") && \Bitrix\Main\Loader::includeModule('catalog')){ + CopyDirFiles(__DIR__."/catalog_export", $_SERVER["DOCUMENT_ROOT"].CATALOG_PATH2EXPORTS, true, true); + } + return true; + } + + function UnInstallCatalogExport() + { + return true; + } + + + function InstallEvents() + { + return true; + } + + function UnInstallEvents() + { + return true; + } +} \ No newline at end of file diff --git a/lang/ru/install/index.php b/lang/ru/install/index.php new file mode 100644 index 0000000..69a014c --- /dev/null +++ b/lang/ru/install/index.php @@ -0,0 +1,7 @@ +getResponse()->addData(['method' => 'ajaxStart']); + } + + public function test() + { + $this->getResponse()->addData(['method' => 'test', 'version' => bxNull()->module()->getVersion()]); + return $this->getResponse(); + } +} \ No newline at end of file diff --git a/lib/app/app.php b/lib/app/app.php new file mode 100644 index 0000000..d65e340 --- /dev/null +++ b/lib/app/app.php @@ -0,0 +1,42 @@ +app = $app; + } +} \ No newline at end of file diff --git a/lib/facade/defaultservicefacade.php b/lib/facade/defaultservicefacade.php new file mode 100644 index 0000000..1df4d76 --- /dev/null +++ b/lib/facade/defaultservicefacade.php @@ -0,0 +1,12 @@ +getList(['=ID' => $id]); + if( $res ){ + return $this->getEntityByResult(reset($res)); + } + return null; + } + + /** + * @param array $arIds + * @return NullCollection + */ + public function getEntityByIds(array $arIds) + { + return parent::getEntityByIds($arIds); // TODO: Change the autogenerated stub + } + + /** + * @return NullTable + */ + public function getDataManager() + { + return parent::getDataManager(); + } +} \ No newline at end of file diff --git a/lib/ifields/nullfields.php b/lib/ifields/nullfields.php new file mode 100644 index 0000000..38b43a0 --- /dev/null +++ b/lib/ifields/nullfields.php @@ -0,0 +1,12 @@ + array( + 'data_type' => 'integer', + 'primary' => true, + 'autocomplete' => true, + 'title' => 'ID', + ), + 'CREATED_AT' => array( + 'data_type' => 'datetime', + 'title' => 'CREATED_AT', + ), + 'UPDATED_AT' => array( + 'data_type' => 'datetime', + 'title' => 'UPDATED_AT', + ), + ); + } +} \ No newline at end of file diff --git a/lib/providers/defaultserviceprovider.php b/lib/providers/defaultserviceprovider.php new file mode 100644 index 0000000..a6a2fc9 --- /dev/null +++ b/lib/providers/defaultserviceprovider.php @@ -0,0 +1,21 @@ +app->container(); + $config = $this->app->config(); + + } +} \ No newline at end of file