Skip to content

Instantly share code, notes, and snippets.

@luckydevilru
Created June 22, 2023 08:42
Show Gist options
  • Save luckydevilru/8dc419f497c7f336fc0dde8c130d5373 to your computer and use it in GitHub Desktop.
Save luckydevilru/8dc419f497c7f336fc0dde8c130d5373 to your computer and use it in GitHub Desktop.
component class bitrix
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
class AgileUsersTablesComponent extends \CBitrixComponent
{
public function onPrepareComponentParams($arParams)
{
return $arParams;
}
public function collectData()
{
$this->arResult = ['data' => date('Y-m-d')];
}
public function executeComponent()
{
try {
$this->checkModules();
$this->collectData();
$this->includeComponentTemplate();
} catch (\Exception $e) {
$this->arResult["ERROR"] = $e->getMessage();
ShowError($e->getMessage());
}
return $this->arResult;
}
private function checkModules()
{
if (!\Bitrix\Main\Loader::includeModule("iblock")) {
throw new \Bitrix\Main\SystemException("Модуль iblock не установлен");
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment