/**
  * 
  * @access 
  * @author "Patrick Plichart <*****@*****.**>"
  */
 public function testStoreItemVariable()
 {
     //storeItemVariable(core_kernel_classes_Resource $deliveryResult, $test, $item, taoResultServer_models_classes_Variable $itemVariable, $callId)
     $deliveryResult = $this->service->storeDeliveryResult();
     $this->service->storeTestTaker($deliveryResult, "unittest_testtaker");
     $this->service->storeDelivery($deliveryResult, "unittest_delivery");
     $itemVariable = new taoResultServer_models_classes_ResponseVariable();
     $itemVariable->setCandidateResponse("unittest_candidateResponse");
     $itemVariable->setCardinality("single");
     $itemVariable->setIdentifier("unittest_identifier");
     $itemVariable->setBaseType("file");
     $storedVariable = $this->service->storeItemVariable($deliveryResult, "myTest", "myItem", $itemVariable, "callid_31");
 }
 /**
  * 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.
  */
 public function transmitItemVariable($variables, $transmissionId, $itemUri = '', $testUri = '')
 {
     $itemVariableSet = array();
     if (is_array($variables) === false) {
         $variables = array($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 Variables to result server.");
         $this->getResultServer()->storeItemVariableSet($testUri, $itemUri, $itemVariableSet, $transmissionId);
     } catch (Exception $e) {
         $msg = "An error occured while transmitting an Outcome Variable to the target result server.";
         $code = taoQtiCommon_helpers_ResultTransmissionException::OUTCOME;
         throw new taoQtiCommon_helpers_ResultTransmissionException($msg, $code);
     }
 }
<?php

require_once dirname(__FILE__) . '/../includes/raw_start.php';
//done ahead of your code
$rs = new taoResultServer_models_classes_ResultServerStateFull();
$rs->initResultServer("http://www.tao.lu/Ontologies/taoAltResultStorage.rdf#KeyValueResultStorage");
//optional control on Ids
$id = $rs->spawnResult("myCoolId");
$rs->storeRelatedTestTaker("Jerome the big guy");
$rs->storeRelatedDelivery("Jerome's super delivery");
//you are doing this
$itemVariable = new taoResultServer_models_classes_ResponseVariable();
$itemVariable->setCandidateResponse("[Jerome Awesome]");
$itemVariable->setCardinality("single");
$itemVariable->setIdentifier("unittest_identifier");
$itemVariable->setBaseType("pair");
$callIdItem = "An identifier of the execution of an item occurence for a test taker";
$rs->storeItemVariable("sometest identifier", "someidentifier", $itemVariable, $callIdItem);
//and youn want to do this
$variables = $rs->getVariables($callIdItem);
$variable = $rs->getVariable($callIdItem, "unittest_identifier");
print_r($variable);
$testtaker = $rs->getTestTaker($id);
print_r($testtaker);
$delivery = $rs->getDelivery($id);
print_r($delivery);
//consider results may have been broadcasted to different storages,
//thus if one of them does not contain the readable interface,
//you don't have an exception globally but partial data.
예제 #4
0
                $itemVariable->setValue("MyValue" . $i . $j);
                $itemVariable->setIdentifier("identifier" . $i . $j);
                $itemVariable->setCardinality("single");
                $itemVariable->setBaseType("float");
            } else {
                $itemVariable = new taoResultServer_models_classes_ResponseVariable();
                $itemVariable->setCandidateResponse("[Jerome Awesome]");
                $itemVariable->setCorrectResponse("[nop,plop]");
                $itemVariable->setIdentifier("identifier" . $i . $j);
                $itemVariable->setCardinality("single");
                $itemVariable->setBaseType("pair");
            }
            $callIdItem = "An identifier of the execution of an item occurence for a test taker#" . $j;
            $item = "anotherId#" . $j;
            $rs->storeItemVariable($deliverIdentifier, $test, $item, $itemVariable, $callIdItem);
            //            $rs->storeItemVariable($deliveryResult, $test, $item, $itemVariable, $callIdItem);
        }
        $callIdTest = "Great Test Id#134589";
        $testVariable = new taoResultServer_models_classes_ResponseVariable();
        $testVariable->setIdentifier("identifier" . $i);
        $testVariable->setCardinality("single");
        $testVariable->setBaseType("pair");
        $rs->storeTestVariable($deliverIdentifier, $test, $testVariable, $callIdTest);
        //        $rs->storeTestVariable($deliveryResult, $test, $testVariable, $callIdTest);
    }
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    echo "\n{$time}\n";
    $timeTot += $time;
}
echo "{$timeTot}\n";