public function transmitItemVariable($variables, $transmissionId, $itemUri = '', $testUri = '') {

        $itemVariableSet = [];

        if (is_array($variables) === false) {
            $variables = [$variables];
        }

        foreach ($variables as $variable) {
            $identifier = $variable->getIdentifier();

            if ($variable instanceof OutcomeVariable) {
                $value = $variable->getValue();

                $resultVariable = new taoResultServer_models_classes_OutcomeVariable();
                $resultVariable->setIdentifier($identifier);
                $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
                $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
                $resultVariable->setValue(self::transformValue($value));

                $itemVariableSet[] = $resultVariable;
            }
            else if ($variable instanceof ResponseVariable) {
                // ResponseVariable.
                $value = $variable->getValue();

                $resultVariable = new taoResultServer_models_classes_ResponseVariable();
                $resultVariable->setIdentifier($identifier);
                $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
                $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
                $resultVariable->setCandidateResponse(self::transformValue($value));

                // The fact that the response is correct must not be sent for built-in
                // response variables 'duration' and 'numAttempts'.
                if (!in_array($identifier, array('duration', 'numAttempts', 'comment'))) {
                    $resultVariable->setCorrectResponse($variable->isCorrect());
                }

                $itemVariableSet[] = $resultVariable;
            }
        }

        try {
            common_Logger::d("Sending Item Variables to result server.");
            $this->getResultStorage()->storeItemVariables($testUri, $itemUri, $itemVariableSet, $transmissionId);
        }
        catch (Exception $e) {
            $msg = "An error occured while transmitting one or more Outcome/Response Variable(s) to the target result server.";
            $code = taoQtiCommon_helpers_ResultTransmissionException::OUTCOME;
            throw new taoQtiCommon_helpers_ResultTransmissionException($msg, $code);
        }
    }
public function transmitItemVariable($variables, $transmissionId, $itemUri = '', $testUri = '') {

        $itemVariableSet = [];

        if (is_array($variables) === false) {
            $variables = [$variables];
        }

        foreach ($variables as $variable) {
            $identifier = $variable->getIdentifier();

            if ($variable instanceof OutcomeVariable) {
                $value = $variable->getValue();

                $resultVariable = new taoResultServer_models_classes_OutcomeVariable();
                $resultVariable->setIdentifier($identifier);
                $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
                $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
                $resultVariable->setValue(self::transformValue($value));

                $itemVariableSet[] = $resultVariable;
            }
            else if ($variable instanceof ResponseVariable) {
                // ResponseVariable.
                $value = $variable->getValue();

                $resultVariable = new taoResultServer_models_classes_ResponseVariable();
                $resultVariable->setIdentifier($identifier);
                $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
                $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
                $resultVariable->setCandidateResponse(self::transformValue($value));

                // The fact that the response is correct must not be sent for built-in
                // response variables 'duration' and 'numAttempts'.
                if (!in_array($identifier, array('duration', 'numAttempts', 'comment'))) {
                    $resultVariable->setCorrectResponse($variable->isCorrect());
                }

                $itemVariableSet[] = $resultVariable;
            }
        }

        try {
            common_Logger::d("Sending Item Variables to result server.");
            $this->getResultStorage()->storeItemVariables($testUri, $itemUri, $itemVariableSet, $transmissionId);
        }
        catch (Exception $e) {
            $msg = "An error occured while transmitting one or more Outcome/Response Variable(s) to the target result server.";
            $code = taoQtiCommon_helpers_ResultTransmissionException::OUTCOME;
            throw new taoQtiCommon_helpers_ResultTransmissionException($msg, $code);
        }
    }
public function transmitItemVariable ( $ variables , $ transmissionId , $ itemUri = '' , $ testUri = '' ) { $ itemVariableSet = [ ] ; if ( is_array ( $ variables ) === false ) { $ variables = [ $ variables ] ; } foreach ( $ variables as $ variable ) { $ identifier = $ variable -> getIdentifier ( ) ; if ( $ variable instanceof OutcomeVariable ) { $ value = $ variable -> getValue ( ) ; $ resultVariable = new taoResultServer_models_classes_OutcomeVariable ( ) ; $ resultVariable -> setIdentifier ( $ identifier ) ; $ resultVariable -> setBaseType ( BaseType :: getNameByConstant ( $ variable -> getBaseType ( ) ) ) ; $ resultVariable -> setCardinality ( Cardinality :: getNameByConstant ( $ variable -> getCardinality ( ) ) ) ; $ resultVariable -> setValue ( self :: transformValue ( $ value ) ) ; $ itemVariableSet [ ] = $ resultVariable ; } else if ( $ variable instanceof ResponseVariable ) { // ResponseVariable. $ value = $ variable -> getValue ( ) ; $ resultVariable = new taoResultServer_models_classes_ResponseVariable ( ) ; $ resultVariable -> setIdentifier ( $ identifier ) ; $ resultVariable -> setBaseType ( BaseType :: getNameByConstant ( $ variable -> getBaseType ( ) ) ) ; $ resultVariable -> setCardinality ( Cardinality :: getNameByConstant ( $ variable -> getCardinality ( ) ) ) ; $ resultVariable -> setCandidateResponse ( self :: transformValue ( $ value ) ) ; // The fact that the response is correct must not be sent for built-in // response variables 'duration' and 'numAttempts'. if ( ! in_array ( $ identifier , array ( 'duration' , 'numAttempts' , 'comment' ) ) ) { $ resultVariable -> setCorrectResponse ( $ variable -> isCorrect ( ) ) ; } $ itemVariableSet [ ] = $ resultVariable ; } } try { common_Logger :: d ( "Sending Item Variables to result server." ) ; $ this -> getResultStorage ( ) -> storeItemVariables ( $ testUri , $ itemUri , $ itemVariableSet , $ transmissionId ) ; } catch ( Exception $ e ) { $ msg = "An error occured while transmitting one or more Outcome/Response Variable(s) to the target result server." ; $ code = taoQtiCommon_helpers_ResultTransmissionException :: OUTCOME ; throw new taoQtiCommon_helpers_ResultTransmissionException ( $ msg , $ code ) ; } }
Transmit a QtiSm Runtime Variable to the target Result Server as an Item Result.

@param mixed $variables QtiSm Runtime Variable(s).
@param string $transmissionId A unique identifier that identifies uniquely the visited item.
@param string $itemUri An optional URI that identifies uniquely the item the $variable comes from.
@param string $testUri An optional URL that identifies uniquely the test the $variable comes from.
@throws taoQtiCommon_helpers_ResultTransmissionException If an error occurs while transmitting the Variable to the target Result Server.
Transmit a QtiSm Runtime Variable to the target Result Server as an Item Result .