CBPHelper :: FormatTimePeriod: Bitrix method

      
<?php 
//  CBPHelper :: FormatTimePeriod()
//  /dist/bitrix/modules/bizproc/classes/general/helper.php:316

    
public static function FormatTimePeriod($period)
    {
        
$period intval($period);

        
$days intval($period 86400);
        
$period $period $days 86400;

        
$hours intval($period 3600);
        
$period $period $hours 3600;

        
$minutes intval($period 60);
        
$period $period $minutes 60;

        
$seconds intval($period);

        
$s "";
        if (
$days 0)
        {
            
$s .= str_replace(
                array(
"#VAL#""#UNIT#"),
                array(
$daysself::MakeWord($days, array(GetMessage("BPCGHLP_DAY1"), GetMessage("BPCGHLP_DAY2"), GetMessage("BPCGHLP_DAY3")))),
                
"#VAL# #UNIT# "
            
);
        }
        if (
$hours 0)
        {
            
$s .= str_replace(
                array(
"#VAL#""#UNIT#"),
                array(
$hoursself::MakeWord($hours, array(GetMessage("BPCGHLP_HOUR1"), GetMessage("BPCGHLP_HOUR2"), GetMessage("BPCGHLP_HOUR3")))),
                
"#VAL# #UNIT# "
            
);
        }
        if (
$minutes 0)
        {
            
$s .= str_replace(
                array(
"#VAL#""#UNIT#"),
                array(
$minutesself::MakeWord($minutes, array(GetMessage("BPCGHLP_MIN1"), GetMessage("BPCGHLP_MIN2"), GetMessage("BPCGHLP_MIN3")))),
                
"#VAL# #UNIT# "
            
);
        }
        if (
$seconds 0)
        {
            
$s .= str_replace(
                array(
"#VAL#""#UNIT#"),
                array(
$secondsself::MakeWord($seconds, array(GetMessage("BPCGHLP_SEC1"), GetMessage("BPCGHLP_SEC2"), GetMessage("BPCGHLP_SEC3")))),
                
"#VAL# #UNIT# "
            
);
        }

        return 
$s;
    }