CBitrixCloudBackup::OnAdminInformerInsertItems: Bitrix method

      
<?php 
//  CBitrixCloudBackup :: OnAdminInformerInsertItems()
//  /dist/bitrix/modules/bitrixcloud/classes/general/backup.php:244

    
public static function OnAdminInformerInsertItems()
    {
        global 
$USER;

        
$CDNAIParams = array(
            
"TITLE" => GetMessage("BCL_BACKUP_AI_TITLE"),
            
"COLOR" => "peach",
        );

        
$backup self::getInstance();
        
$backup->loadFromOptions();
        
$last_request_time_option CBitrixCloudOption::getOption("backup_last_backup_time");
        try
        {
            if (
                
$backup->getQuota() <= 0
                
&& $last_request_time_option->getIntegerValue() <= 0
            
)
            {
                
$backup->_getInformation(true);
                
$backup->saveToOptions();
                
$last_request_time_option->setStringValue((string)time());
            }
        }
        catch (
CBitrixCloudException $e)
        {
            
///TODO show error to user
            
return;
        }

        if ( 
$backup->getQuota() <= )
            return;

        
$arFiles $backup->listFiles();
        if (empty(
$arFiles))
        {
            
$PROGRESS_FREE 100;
            
$AVAIL $backup->getQuota();
            
$ALLOWED CFile::FormatSize($backup->getQuota(), 0);
            
$CDNAIParams["ALERT"] = true;
            
$MESS '<span class="adm-informer-strong-text">'.GetMessage("BCL_BACKUP_AI_NO_FILES").'</span>';
            if (
$USER->CanDoOperation("bitrixcloud_backup") && $USER->CanDoOperation('edit_php'))
            {
                
$CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang='.LANGUAGE_ID.'">'.GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY").'</a>';
            }
        }
        elseif(
$backup->getLastTimeBackup() < (time()-7*24*3600))
        {
            
$AVAIL $backup->getQuota()-$backup->getUsage();
            if(
$AVAIL 0.0)
                
$AVAIL 0.0;

            
$PROGRESS_FREE round($AVAIL/$backup->getQuota()*100);
            
$ALLOWED CFile::FormatSize($backup->getQuota(), 0);
            
$CDNAIParams["ALERT"] = true;
            
$MESS '<span class="adm-informer-strong-text">'.GetMessage("BCL_BACKUP_AI_LAST_TIME").': '.FormatDate(array(
                    
"today" => "today",
                    
"yesterday" => "yesterday",
                    
"" => "dago",
                ), 
$backup->getLastTimeBackup()).'.</span>';
            if (
$USER->CanDoOperation("bitrixcloud_backup") && $USER->CanDoOperation('edit_php'))
            {
                
$CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang='.LANGUAGE_ID.'">'.GetMessage("BCL_BACKUP_AI_DO_BACKUP_STRONGLY").'</a>';
            }
        }
        else
        {
            
$AVAIL $backup->getQuota()-$backup->getUsage();
            if(
$AVAIL 0.0)
                
$AVAIL 0.0;

            
$PROGRESS_FREE round($AVAIL/$backup->getQuota()*100);
            
$ALLOWED CFile::FormatSize($backup->getQuota(), 0);
            
$CDNAIParams["ALERT"] = false;
            
$MESS GetMessage("BCL_BACKUP_AI_LAST_TIME").': '.FormatDate(array(
                    
"today" => "today",
                    
"yesterday" => "yesterday",
                    
"" => "dago",
                ), 
$backup->getLastTimeBackup());
            if (
$USER->CanDoOperation("bitrixcloud_backup") && $USER->CanDoOperation('edit_php'))
            {
                
$CDNAIParams["FOOTER"] = '<a href="/bitrix/admin/dump.php?lang='.LANGUAGE_ID.'">'.GetMessage("BCL_BACKUP_AI_DO_BACKUP").'</a>';
            }
        }

        if(isset(
$CDNAIParams["ALERT"]))
        {
            
$PROGRESS_FREE_BAR $PROGRESS_FREE 00$PROGRESS_FREE;
            
$CDNAIParams["HTML"] = '
                <div class="adm-informer-item-section">
                    <span class="adm-informer-item-l">
                        <span class="adm-informer-strong-text">'
.GetMessage("BCL_BACKUP_AI_USAGE_TOTAL").'</span> '.$ALLOWED.'
                    </span>
                    <span class="adm-informer-item-r">
                            <span class="adm-informer-strong-text">'
.GetMessage("BCL_BACKUP_AI_USAGE_AVAIL").'</span> '.CFile::FormatSize($AVAIL0).'
                    </span>
                </div>
                <div class="adm-informer-status-bar-block" >
                    <div class="adm-informer-status-bar-indicator" style="width:'
.(100-$PROGRESS_FREE_BAR).'%; "></div>
                    <div class="adm-informer-status-bar-text">'
.(100-$PROGRESS_FREE).'%</div>
                </div>
            '
.$MESS;
            
CAdminInformer::AddItem($CDNAIParams);
        }
    }