models/classes/runner/QtiRunnerService.php
public function getItemSession(RunnerServiceContext $context)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            /* @var TestSession $session */
            $session = $context->getTestSession();

            $currentItem       = $session->getCurrentAssessmentItemRef();
            $currentOccurrence = $session->getCurrentAssessmentItemRefOccurence();

            $itemSession       = $session->getAssessmentItemSessionStore()->getAssessmentItemSession($currentItem, $currentOccurrence);

            $stateOutput = new \taoQtiCommon_helpers_PciStateOutput();

            foreach ($itemSession->getAllVariables() as $var) {
                $stateOutput->addVariable($var);
            }

            $output = $stateOutput->getOutput();

            // The current item answered state
            $route    = $session->getRoute();
            $position = $route->getPosition();
            $output['itemAnswered'] = TestRunnerUtils::isItemCompleted($route->getRouteItemAt($position), $itemSession);

        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'getItemSession',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
        return $output;
    }
public function getItemSession(RunnerServiceContext $context)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            /* @var TestSession $session */
            $session = $context->getTestSession();

            $currentItem       = $session->getCurrentAssessmentItemRef();
            $currentOccurrence = $session->getCurrentAssessmentItemRefOccurence();

            $itemSession       = $session->getAssessmentItemSessionStore()->getAssessmentItemSession($currentItem, $currentOccurrence);

            $stateOutput = new \taoQtiCommon_helpers_PciStateOutput();

            foreach ($itemSession->getAllVariables() as $var) {
                $stateOutput->addVariable($var);
            }

            $output = $stateOutput->getOutput();

            // The current item answered state
            $route    = $session->getRoute();
            $position = $route->getPosition();
            $output['itemAnswered'] = TestRunnerUtils::isItemCompleted($route->getRouteItemAt($position), $itemSession);

        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'getItemSession',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
        return $output;
    }
public function getItemSession ( RunnerServiceContext $ context ) { if ( $ context instanceof QtiRunnerServiceContext ) { /* @var TestSession $session */ $ session = $ context -> getTestSession ( ) ; $ currentItem = $ session -> getCurrentAssessmentItemRef ( ) ; $ currentOccurrence = $ session -> getCurrentAssessmentItemRefOccurence ( ) ; $ itemSession = $ session -> getAssessmentItemSessionStore ( ) -> getAssessmentItemSession ( $ currentItem , $ currentOccurrence ) ; $ stateOutput = new \ taoQtiCommon_helpers_PciStateOutput ( ) ; foreach ( $ itemSession -> getAllVariables ( ) as $ var ) { $ stateOutput -> addVariable ( $ var ) ; } $ output = $ stateOutput -> getOutput ( ) ; // The current item answered state $ route = $ session -> getRoute ( ) ; $ position = $ route -> getPosition ( ) ; $ output [ 'itemAnswered' ] = TestRunnerUtils :: isItemCompleted ( $ route -> getRouteItemAt ( $ position ) , $ itemSession ) ; } else { throw new \ common_exception_InvalidArgumentType ( 'QtiRunnerService' , 'getItemSession' , 0 , 'oat\taoQtiTest\models\runner\QtiRunnerServiceContext' , $ context ) ; } return $ output ; }
Should we display feedbacks
@param RunnerServiceContext $context
@return AssessmentItemSession the item session
@throws \common_exception_InvalidArgumentType
Should we display feedbacks