• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/admin_informer.php
  • Класс: CAdminInformer
  • Вызов: CAdminInformer::InsertMainItems
static function InsertMainItems()
{
	if(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1)
		return false;

	global $USER;

	if(!$USER->IsAuthorized())
		return false;

	if ($USER->CanDoOperation("cache_control") && !Helper::isOn() && !Engine::isSelfHostedPortal())
	{
		self::AddItem(array(
			"TITLE" => GetMessage("top_panel_ai_composite_title"),
			"HTML" => GetMessage("top_panel_ai_composite_desc"),
			"COLOR" => "red",
			"FOOTER" => ''.GetMessage("top_panel_ai_composite_switch_on").'',
			"ALERT" => true,
			"SORT" => 1
		));
	}

	//Updates
	if($USER->IsAdmin() || $USER->CanDoOperation('install_updates'))
	{
		$update_res = UpdateTools::GetUpdateResult();

		$updAIParams = array(
			"TITLE" => GetMessage("top_panel_ai_updates"),
			"COLOR" => 'gray',
			"SORT" => 12
		);

		//update_autocheck == true and we have something to show
		if ($update_res['result'] === true && $update_res['tooltip'])
		{
			$updAIParams["HTML"] = $update_res['tooltip'];
			$updAIParams["FOOTER"] = ''.GetMessage("top_panel_ai_upd_instl").'';
			$updAIParams["ALERT"] = true;
		}
		else if ($update_res['error'] <> '') // update error
		{
			$updAIParams["TITLE"] .= " - ".GetMessage("top_panel_ai_title_err");
			$updAIParams["HTML"] = trim(self::CutErrorId($update_res['error']));
			$updAIParams["FOOTER"] = ''.GetMessage("top_panel_ai_upd_chk").'';
			$updAIParams["ALERT"] = true;
		}
		else // update_autocheck == false
		{
			//last update date time
			$updateDate = COption::GetOptionString("main", "update_system_update", false);

			$updAIParams["HTML"] = ''.GetMessage("top_panel_ai_sys_ver").' '.SM_VERSION."
"; $updAIParams["HTML"] .= $updateDate ? GetMessage("top_panel_ai_upd_last").'
'.$updateDate : GetMessage("top_panel_ai_upd_never"); $updAIParams["FOOTER"] = ''.GetMessage("top_panel_ai_upd_chk").''; $updAIParams["ALERT"] = false; } self::AddItem($updAIParams); } //Disk space (quota) $maxQuota = (int)COption::GetOptionInt("main", "disk_space", 0)*1048576; if ($maxQuota > 0) { $quota = new CDiskQuota(); $free = $quota->GetDiskQuota(); $freeMB = CFile::FormatSize($free,1); $free = round($free/($maxQuota)*100); $qAIParams = array( "TITLE" => GetMessage("top_panel_ai_used_space"), "COLOR" => "green", "ALERT" => ($free < 10 ? true : false) ); $qAIParams["HTML"] = '
'.GetMessage("top_panel_ai_in_all").' '.CFile::FormatSize($maxQuota,1).' '.GetMessage("top_panel_ai_in_aviable").' '.$freeMB.'
'.(100-$free).'%
'.GetMessage("top_panel_ai_in_recomend").' '.GetMessage("top_panel_ai_in_no").'
'; self::AddItem($qAIParams); } if($USER->IsAdmin() && in_array(LANGUAGE_ID, array("ru", "ua"))) { $cModules = COption::GetOptionString("main", "mp_modules_date", ""); $arModules = array(); if ($cModules <> '') { $arModules = unserialize($cModules, ['allowed_classes' => false]) ?: []; } $mCnt = count($arModules); if($mCnt > 0) { foreach($arModules as $id => $module) { if(isModuleInstalled($module["ID"])) { if($module["TMS"]+3600*24*14 < time()) { $script = " "; $arParams = array( 'TITLE' => GetMessage("top_panel_ai_marketplace"), 'COLOR' => 'green', 'FOOTER' => "".GetMessage("top_panel_ai_marketplace_hide")."". "".GetMessage("top_panel_ai_marketplace_add")."", 'ALERT' => true, 'HTML' => GetMessage("top_panel_ai_marketplace_descr", array("#NAME#" => $module["NAME"], "#ID#" => $module["ID"])).$script, ); self::AddItem($arParams); } } else { unset($arModules[$id]); } } if($mCnt != count($arModules)) { COption::SetOptionString("main", "mp_modules_date", serialize($arModules)); } } } foreach(GetModuleEvents("main", "OnAdminInformerInsertItems", true) as $arHandler) ExecuteModuleEventEx($arHandler); return count(self::$items); }