SetStatus: Bitrix method

      
<?php 
//  SetStatus()
//  /dist/bitrix/modules/bizproc/classes/general/activity.php:1095

    
public function SetStatus($newStatus$arEventParameters = array())
    {
        
$this->executionStatus $newStatus;
        
$this->FireStatusChangedEvents(self::StatusChangedEvent$arEventParameters);

        switch (
$newStatus)
        {
            case 
CBPActivityExecutionStatus::Executing:
                
$this->FireStatusChangedEvents(self::ExecutingEvent$arEventParameters);
                break;

            case 
CBPActivityExecutionStatus::Canceling:
                
$this->FireStatusChangedEvents(self::CancelingEvent$arEventParameters);
                break;

            case 
CBPActivityExecutionStatus::Closed:
                
$this->FireStatusChangedEvents(self::ClosedEvent$arEventParameters);
                break;

            case 
CBPActivityExecutionStatus::Faulting:
                
$this->FireStatusChangedEvents(self::FaultingEvent$arEventParameters);
                break;

            default:
                return;
        }
    }