public function isAuthorized()
    {
        $deliveryExecution = $this->getCurrentDeliveryExecution();
        $executionState = $deliveryExecution->getState()->getUri();

        $authorized = false;
        $success = true;
        $message = null;

        // reacts to a few particular states
        switch ($executionState) {
            case DeliveryExecutionState::STATE_AUTHORIZED:
                    $authorized = true;
                break;

            case DeliveryExecutionState::STATE_TERMINATED:
            case DeliveryExecutionState::STATE_FINISHED:
                $success = false;
                $message = __('The assessment has been terminated. You cannot interact with it anymore.');
                break;

            case DeliveryExecutionState::STATE_PAUSED:
                $success = false;
                $message = __('The assessment has been suspended. To resume your assessment, please relaunch it and contact your proctor if required.');
                break;
        }

        $this->returnJson(array(
            'authorized' => $authorized,
            'success' => $success,
            'message' => $message
        ));
    }
public function isAuthorized()
    {
        $deliveryExecution = $this->getCurrentDeliveryExecution();
        $executionState = $deliveryExecution->getState()->getUri();

        $authorized = false;
        $success = true;
        $message = null;

        // reacts to a few particular states
        switch ($executionState) {
            case DeliveryExecutionState::STATE_AUTHORIZED:
                    $authorized = true;
                break;

            case DeliveryExecutionState::STATE_TERMINATED:
            case DeliveryExecutionState::STATE_FINISHED:
                $success = false;
                $message = __('The assessment has been terminated. You cannot interact with it anymore.');
                break;

            case DeliveryExecutionState::STATE_PAUSED:
                $success = false;
                $message = __('The assessment has been suspended. To resume your assessment, please relaunch it and contact your proctor if required.');
                break;
        }

        $this->returnJson(array(
            'authorized' => $authorized,
            'success' => $success,
            'message' => $message
        ));
    }
public function isAuthorized ( ) { $ deliveryExecution = $ this -> getCurrentDeliveryExecution ( ) ; $ executionState = $ deliveryExecution -> getState ( ) -> getUri ( ) ; $ authorized = false ; $ success = true ; $ message = null ; // reacts to a few particular states switch ( $ executionState ) { case DeliveryExecutionState :: STATE_AUTHORIZED : $ authorized = true ; break ; case DeliveryExecutionState :: STATE_TERMINATED : case DeliveryExecutionState :: STATE_FINISHED : $ success = false ; $ message = __ ( 'The assessment has been terminated. You cannot interact with it anymore.' ) ; break ; case DeliveryExecutionState :: STATE_PAUSED : $ success = false ; $ message = __ ( 'The assessment has been suspended. To resume your assessment, please relaunch it and contact your proctor if required.' ) ; break ; } $ this -> returnJson ( array ( 'authorized' => $ authorized , 'success' => $ success , 'message' => $ message ) ) ; }
The action called to check if the requested delivery execution has been authorized by the proctor
The action called to check if the requested delivery execution has been authorized by the proctor