public function setItemState(RunnerServiceContext $context, $itemRef, $state)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID);
            $userUri = \common_session_SessionManager::getSession()->getUserUri();
            $stateId = $this->getStateId($context, $itemRef);
            if(!isset($state)){
                $state = '';
            }
            return is_null($userUri) ? false : $serviceService->set($userUri, $stateId, json_encode($state));
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'setItemState',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function setItemState(RunnerServiceContext $context, $itemRef, $state)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID);
            $userUri = \common_session_SessionManager::getSession()->getUserUri();
            $stateId = $this->getStateId($context, $itemRef);
            if(!isset($state)){
                $state = '';
            }
            return is_null($userUri) ? false : $serviceService->set($userUri, $stateId, json_encode($state));
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'setItemState',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function setItemState ( RunnerServiceContext $ context , $ itemRef , $ state ) { if ( $ context instanceof QtiRunnerServiceContext ) { $ serviceService = $ this -> getServiceManager ( ) -> get ( StorageManager :: SERVICE_ID ) ; $ userUri = \ common_session_SessionManager :: getSession ( ) -> getUserUri ( ) ; $ stateId = $ this -> getStateId ( $ context , $ itemRef ) ; if ( ! isset ( $ state ) ) { $ state = '' ; } return is_null ( $ userUri ) ? false : $ serviceService -> set ( $ userUri , $ stateId , json_encode ( $ state ) ) ; } else { throw new \ common_exception_InvalidArgumentType ( 'QtiRunnerService' , 'setItemState' , 0 , 'oat\taoQtiTest\models\runner\QtiRunnerServiceContext' , $ context ) ; } }
Sets the state of a particular item
@param RunnerServiceContext $context
@param $itemRef
@param  $state
@return boolean
@throws \common_Exception
Sets the state of a particular item