_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q244300
QtiRunnerServiceContext.selectAdaptiveNextItem
validation
public function selectAdaptiveNextItem() { $lastItemId = $this->getCurrentCatItemId(); $lastOutput = $this->getLastCatItemOutput(); $catSession = $this->getCatSession(); $preSelection = $catSession->getTestMap(); try { if (!$this->syncingMode) { ...
php
{ "resource": "" }
q244301
QtiRunnerServiceContext.getCurrentAssessmentItemRef
validation
public function getCurrentAssessmentItemRef() { if ($this->isAdaptive()) { return $this->getServiceManager()->get(CatService::SERVICE_ID)->getAssessmentItemRefByIdentifier( $this->getCompilationDirectory()['private'], $this->getCurrentCatItemId() ); ...
php
{ "resource": "" }
q244302
QtiRunnerServiceContext.getCurrentPosition
validation
public function getCurrentPosition() { $route = $this->getTestSession()->getRoute(); $routeCount = $route->count(); $routeItemPosition = $route->getPosition(); $currentRouteItem = $route->getRouteItemAt($routeItemPosition); $finalPosition = 0; for ($i = 0; $i < $rou...
php
{ "resource": "" }
q244303
QtiRunnerServiceContext.canMoveBackward
validation
public function canMoveBackward() { $moveBack = false; $session = $this->getTestSession(); if ($this->isAdaptive()) { $positionInCatSession = array_search( $this->getCurrentCatItemId(), $this->getShadowTest() ); if ($posit...
php
{ "resource": "" }
q244304
QtiRunnerServiceContext.saveAdaptiveResults
validation
protected function saveAdaptiveResults(CatSession $catSession) { $testResult = $catSession->getTestResult(); $testResult = empty($testResult) ? [] : [$testResult]; return $this->storeResult(array_merge($testResult, $catSession->getItemResults())); }
php
{ "resource": "" }
q244305
QtiRunnerServiceContext.storeResult
validation
protected function storeResult(array $results) { /** @var QtiRunnerService $runnerService */ $runnerService = $this->getServiceLocator()->get(QtiRunnerService::SERVICE_ID); $success = true; try { foreach ($results as $result) { if (!$result instanceof Ab...
php
{ "resource": "" }
q244306
QtiRunnerServiceContext.convertCatVariables
validation
protected function convertCatVariables(array $variables) { /** @var QtiRunnerService $runnerService */ $runnerService = $this->getServiceLocator()->get(QtiRunnerService::SERVICE_ID); $convertedVariables = []; foreach ($variables as $variable) { switch ($variable->getVar...
php
{ "resource": "" }
q244307
SyncChannel.process
validation
public function process(QtiRunnerServiceContext $context, array $data = []) { return $this->getServiceManager()->get(SynchronisationService::SERVICE_ID)->process($data, $context); }
php
{ "resource": "" }
q244308
Move.process
validation
public function process() { $this->validate(); $ref = ($this->getRequestParameter('ref') === false) ? null : $this->getRequestParameter('ref'); $direction = $this->getRequestParameter('direction'); $scope = $this->getRequestParameter('scope'); $start = ($this->getRequestPara...
php
{ "resource": "" }
q244309
RunnerParamParserTrait.initServiceContext
validation
protected function initServiceContext() { $serviceContext = $this->getServiceContext(); $this->getRunnerService()->check($serviceContext); return $serviceContext->init(); }
php
{ "resource": "" }
q244310
RunnerParamParserTrait.endItemTimer
validation
protected function endItemTimer($timestamp = null) { if($this->getRequestParameter('itemDuration')){ $serviceContext = $this->getServiceContext(); $itemDuration = $this->getRequestParameter('itemDuration'); return $this->getRunnerService()->endTimer($serviceContex...
php
{ "resource": "" }
q244311
RunnerParamParserTrait.saveItemState
validation
protected function saveItemState() { if ($this->getRequestParameter('itemDefinition') && $this->getRequestParameter('itemState')) { $serviceContext = $this->getServiceContext(); $itemIdentifier = $this->getRequestParameter('itemDefinition'); $state = $this->getRequestPara...
php
{ "resource": "" }
q244312
RunnerParamParserTrait.saveItemResponses
validation
protected function saveItemResponses($emptyAllowed = true) { if ($this->getRequestParameter('itemDefinition') && $this->getRequestParameter('itemResponse')) { $itemDefinition = $this->getRequestParameter('itemDefinition'); $serviceContext = $this->getServiceContext(); $i...
php
{ "resource": "" }
q244313
RunnerParamParserTrait.getItemRef
validation
protected function getItemRef($itemIdentifier) { $serviceContext = $this->getServiceContext(); /** @var QtiRunnerMap $mapService */ $mapService = $this->getServiceLocator()->get(QtiRunnerMap::SERVICE_ID); return $mapService->getItemHref($serviceContext, $itemIdentifier); }
php
{ "resource": "" }
q244314
Timeout.process
validation
public function process() { $this->validate(); $ref = $this->getRequestParameter('ref') ?: null; $scope = $this->getRequestParameter('scope'); $start = ($this->getRequestParameter('start') !== false); try { $serviceContext = $this->getServiceContext(); ...
php
{ "resource": "" }
q244315
QtiRunnerRubric.getRubrics
validation
public function getRubrics(RunnerServiceContext $context, AssessmentItemRef $itemRef = null) { /* @var AssessmentTestSession $session */ $session = $context->getTestSession(); $routeItem = null; if (!is_null($itemRef)) { try { $routeItem = $session->getRo...
php
{ "resource": "" }
q244316
Pause.process
validation
public function process() { $this->validate(); try { $serviceContext = $this->getServiceContext(); $this->saveToolStates(); if ($this->getRequestParameter('offline') === true) { $this->setOffline(); } $result = $this->ge...
php
{ "resource": "" }
q244317
QtiCommunicationService.processInput
validation
public function processInput(QtiRunnerServiceContext $context, array $input) { $responses = []; foreach ($input as $data) { if (!is_array($data) || !isset($data['channel']) || !isset($data['message'])) { throw new \common_exception_InconsistentData('Wrong message chunk r...
php
{ "resource": "" }
q244318
QtiCommunicationService.processOutput
validation
public function processOutput(QtiRunnerServiceContext $context) { $messages = []; $channels = $this->getOption(self::OPTION_CHANNELS); if (is_array($channels[self::CHANNEL_TYPE_OUTPUT])) { foreach ($channels[self::CHANNEL_TYPE_OUTPUT] as $outputChannelName => $outputChannelClass)...
php
{ "resource": "" }
q244319
QtiCommunicationService.hasChannel
validation
protected function hasChannel($channelName, $channelType) { $channels = $this->getOption(self::OPTION_CHANNELS); return isset($channels[$channelType][$channelName]); }
php
{ "resource": "" }
q244320
CatUtils.getCatInfo
validation
public static function getCatInfo(AssessmentTest $test, $namespace = '') { if ($namespace === '') { $namespace = CatService::QTI_2X_ADAPTIVE_XML_NAMESPACE; } $info = []; foreach ($test->getComponentsByClassName('assessmentSection') as $assessmentSection)...
php
{ "resource": "" }
q244321
CatUtils.isAssessmentSectionAdaptive
validation
public static function isAssessmentSectionAdaptive(AssessmentSection $section, $namespace = '') { if ($namespace === '') { $namespace = CatService::QTI_2X_ADAPTIVE_XML_NAMESPACE; } $isAdaptive = false; if (($selection = $section->getSelection()) !== null...
php
{ "resource": "" }
q244322
QtiRunnerConfig.buildOptions
validation
protected function buildOptions(RunnerServiceContext $context) { $session = $context->getTestSession(); // Comment allowed? Skipping allowed? Logout or Exit allowed ? $options = [ 'allowComment' => \taoQtiTest_helpers_TestRunnerUtils::doesAllowComment($session), ...
php
{ "resource": "" }
q244323
CatService.getEngine
validation
public function getEngine($endpoint) { if ($this->isInitialCall == true) { $endpointCached = $endpoint . '-init'; } else { $endpointCached = $endpoint; } if (!isset($this->engines[$endpointCached])) { $endPoints = $this->getOption(self::OPTION_ENG...
php
{ "resource": "" }
q244324
CatService.getAssessmentItemRefByIdentifier
validation
public function getAssessmentItemRefByIdentifier(\tao_models_classes_service_StorageDirectory $privateCompilationDirectory, $identifier) { $compilationDataService = $this->getServiceLocator()->get(CompilationDataService::SERVICE_ID); $filename = "adaptive-assessment-item-ref-${identifier}"; ...
php
{ "resource": "" }
q244325
CatService.getAssessmentItemRefByIdentifiers
validation
public function getAssessmentItemRefByIdentifiers(\tao_models_classes_service_StorageDirectory $privateCompilationDirectory, array $identifiers) { $assessmentItemRefs = []; foreach ($identifiers as $identifier) { $assessmentItemRefs[] = $this->getAssessmentItemRefByIdentifier($p...
php
{ "resource": "" }
q244326
CatService.getAssessmentItemRefsByPlaceholder
validation
public function getAssessmentItemRefsByPlaceholder(\tao_models_classes_service_StorageDirectory $privateCompilationDirectory, AssessmentItemRef $placeholder) { $urlinfo = parse_url($placeholder->getHref()); $adaptiveSectionId = ltrim($urlinfo['path'], '/'); $compilationDataService =...
php
{ "resource": "" }
q244327
CatService.getAdaptiveAssessmentSectionInfo
validation
public function getAdaptiveAssessmentSectionInfo(AssessmentTest $test, \tao_models_classes_service_StorageDirectory $compilationDirectory, $basePath, $qtiAssessmentSectionIdentifier) { $info = CatUtils::getCatInfo($test); $adaptiveInfo = [ 'qtiSectionIdentifier' => $qtiAssessmentSectionI...
php
{ "resource": "" }
q244328
CatService.validateAdaptiveAssessmentSection
validation
public function validateAdaptiveAssessmentSection(SectionPartCollection $sectionsParts, $ref, $testAdminId) { $engine = $this->getEngine($ref); $adaptSection = $engine->setupSection($testAdminId); //todo: remove this checking if tests/{getSectionId}/items will become a part of standard. ...
php
{ "resource": "" }
q244329
CatService.isAssessmentSectionAdaptive
validation
public function isAssessmentSectionAdaptive(AssessmentSection $section) { $assessmentItemRefs = $section->getComponentsByClassName('assessmentItemRef'); return count($assessmentItemRefs) === 1 && $this->isAdaptivePlaceholder($assessmentItemRefs[0]); }
php
{ "resource": "" }
q244330
CatService.alterTimeoutCallValue
validation
protected function alterTimeoutCallValue(array $options) { $timeoutValue = null; if ($this->isInitialCall === true) { if ($this->hasOption(self::OPTION_INITIAL_CALL_TIMEOUT)) { $timeoutValue = $this->getOption(self::OPTION_INITIAL_CALL_TIMEOUT); } } el...
php
{ "resource": "" }
q244331
StoreTraceData.process
validation
public function process() { $this->validate(); $itemRef = $this->hasRequestParameter('itemDefinition') ? $this->getItemRef($this->getRequestParameter('itemDefinition')) : null; $traceData = json_decode(html_entity_decode($this->getRequestParameter('traceData')), tru...
php
{ "resource": "" }
q244332
QtiTimeStorage.store
validation
public function store($data) { $this->cache[$this->testSessionId] = &$data; $encodedData = $this->getStorageFormat()->encode($data); $this->getStorageService()->set($this->getUserKey(), $this->getStorageKey(), $encodedData); \common_Logger::d(sprintf('QtiTimer: Stored %d byt...
php
{ "resource": "" }
q244333
QtiTimeStorage.load
validation
public function load() { if (!isset($this->cache[$this->testSessionId])) { $encodedData = $this->getStorageService()->get($this->getUserKey(), $this->getStorageKey()); \common_Logger::d(sprintf('QtiTimer: Loaded %d bytes from state storage', strlen($encodedData))); $this...
php
{ "resource": "" }
q244334
SynchronisationService.process
validation
public function process($data, $serviceContext) { if (empty($data)) { throw new \common_exception_InconsistentData('No action to check. Processing action requires data.'); } // first, extract the actions and build usable instances // also compute the total duration to sy...
php
{ "resource": "" }
q244335
SynchronisationService.getAvailableActions
validation
public function getAvailableActions() { return is_array($this->getOption(self::ACTIONS_OPTION)) ? $this->getOption(self::ACTIONS_OPTION) : []; }
php
{ "resource": "" }
q244336
SynchronisationService.resolve
validation
protected function resolve($data) { if (!isset($data['action']) || !isset($data['timestamp']) || !isset($data['parameters']) || !is_array($data['parameters'])) { throw new \common_exception_InconsistentData( 'Action parameters have to contain "action", "timestamp" and "parameters...
php
{ "resource": "" }
q244337
NextItemData.process
validation
public function process() { $this->validate(); $itemIdentifier = $this->hasRequestParameter('itemDefinition') ? $this->getRequestParameter('itemDefinition') : null; if (!is_array($itemIdentifier)) { $itemIdentifier = [$itemIdentifier]; } ...
php
{ "resource": "" }
q244338
NextItemData.getItemData
validation
protected function getItemData($itemIdentifier) { $serviceContext = $this->getServiceContext(); $itemRef = $this->getRunnerService()->getItemHref($serviceContext, $itemIdentifier); $itemData = $this->getRunnerService()->getItemData($serviceContext, $itemRef); $baseUrl = $this->getRun...
php
{ "resource": "" }
q244339
QtiRunnerMessageService.getStateMessage
validation
public function getStateMessage($testSession) { if ($testSession instanceof AssessmentTestSession) { switch ($testSession->getState()) { case AssessmentTestSessionState::SUSPENDED: return $this->getPausedStateMessage($testSession); ...
php
{ "resource": "" }
q244340
OfflineQtiRunnerService.getItems
validation
public function getItems(RunnerServiceContext $serviceContext) { $this->getRunnerService()->assertQtiRunnerServiceContext($serviceContext); $runnerService = $this->getRunnerService(); $testMap = $runnerService->getTestMap($serviceContext); $items = []; foreach ($this->getIt...
php
{ "resource": "" }
q244341
OfflineQtiRunnerService.getItemData
validation
private function getItemData(RunnerServiceContext $context, $itemRef) { $this->getRunnerService()->assertQtiRunnerServiceContext($context); $itemData = $this->getRunnerService()->getItemData($context, $itemRef); $itemDataVariable = $this->getRunnerService()->getItemVariableElementsData($con...
php
{ "resource": "" }
q244342
OfflineQtiRunnerService.getSubIdentifiersRecursively
validation
private function getSubIdentifiersRecursively($array, $identifiers) { $identifier = array_shift($identifiers); if (count($identifiers) > 0) { $result = []; foreach ($array[$identifier] as $key => $value) { $result[] = $this->getSubIdentifiersRecursively( ...
php
{ "resource": "" }
q244343
ExtendedState.getStorage
validation
public function getStorage() { if (!$this->storage) { $this->storage = $this->getServiceLocator()->get(StorageManager::SERVICE_ID); } return $this->storage; }
php
{ "resource": "" }
q244344
ExtendedState.load
validation
public function load() { $storage = $this->getStorage(); if ($storage) { $data = $storage->get($this->userId, $this->getStorageKey()); if ($data) { $this->state = json_decode($data, true); } else { $this->state = []; } ...
php
{ "resource": "" }
q244345
ExtendedState.save
validation
public function save() { $storage = $this->getStorage(); if ($storage) { $success = $storage->set($this->userId, $this->getStorageKey(), json_encode($this->state)); } else { $success = false; } return $success; }
php
{ "resource": "" }
q244346
ExtendedState.getStoreId
validation
public function getStoreId() { return isset($this->state[self::VAR_STORE_ID]) ? $this->state[self::VAR_STORE_ID] : false; }
php
{ "resource": "" }
q244347
ExtendedState.getEvents
validation
public function getEvents() { if (isset($this->state[self::VAR_EVENTS_QUEUE])) { $events = $this->state[self::VAR_EVENTS_QUEUE]; } else { $events = []; } return $events; }
php
{ "resource": "" }
q244348
ExtendedState.getItemHrefIndex
validation
public function getItemHrefIndex() { if (isset($this->state[self::VAR_HREF_INDEX])) { $table = $this->state[self::VAR_HREF_INDEX]; } else { $table = []; } return $table; }
php
{ "resource": "" }
q244349
ExtendedState.setCatValue
validation
public function setCatValue($assessmentSectionId, $key, $value) { $this->state[self::VAR_CAT][$assessmentSectionId][$key] = $value; return $this; }
php
{ "resource": "" }
q244350
ExtendedState.getCatValue
validation
public function getCatValue($assessmentSectionId, $key) { return (isset($this->state[self::VAR_CAT]) && isset($this->state[self::VAR_CAT][$assessmentSectionId]) && isset($this->state[self::VAR_CAT][$assessmentSectionId][$key])) ? $this->state[self::VAR_CAT][$assessmentSectionId][$key] : null; }
php
{ "resource": "" }
q244351
ExtendedState.removeCatValue
validation
public function removeCatValue($assessmentSectionId, $key) { if (isset($this->state[self::VAR_CAT]) && isset($this->state[self::VAR_CAT][$assessmentSectionId]) && isset($this->state[self::VAR_CAT][$assessmentSectionId][$key])) { unset($this->state[self::VAR_CAT][$assessmentSectionId][$key]); ...
php
{ "resource": "" }
q244352
ExtendedStateService.getStorageService
validation
public function getStorageService() { if (!$this->storageService) { $this->storageService = $this->getServiceLocator()->get(StorageManager::SERVICE_ID); } return $this->storageService; }
php
{ "resource": "" }
q244353
ExtendedStateService.persist
validation
public function persist($testSessionId) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->save(); $this->getStorageService()->persist($extendedState->getUserId(), $extendedState->getStorageKey()); }
php
{ "resource": "" }
q244354
ExtendedStateService.setStoreId
validation
public function setStoreId($testSessionId, $storeId) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->setStoreId($storeId); $extendedState->save(); }
php
{ "resource": "" }
q244355
ExtendedStateService.clearEvents
validation
public function clearEvents($testSessionId) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->clearEvents(); $extendedState->save(); }
php
{ "resource": "" }
q244356
ExtendedStateService.storeItemHrefIndex
validation
public function storeItemHrefIndex($testSessionId, $table) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->setItemHrefIndex($table); $extendedState->save(); }
php
{ "resource": "" }
q244357
ExtendedStateService.setCatValue
validation
public function setCatValue($testSessionId, $assessmentSectionId, $key, $value) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->setCatValue($assessmentSectionId, $key, $value); $extendedState->save(); }
php
{ "resource": "" }
q244358
ExtendedStateService.getCatValue
validation
public function getCatValue($testSessionId, $assessmentSectionId, $key) { $extendedState = $this->getExtendedState($testSessionId); return $extendedState->getCatValue($assessmentSectionId, $key); }
php
{ "resource": "" }
q244359
ExtendedStateService.removeCatValue
validation
public function removeCatValue($testSessionId, $assessmentSectionId, $key) { $extendedState = $this->getExtendedState($testSessionId); $extendedState->removeCatValue($assessmentSectionId, $key); $extendedState->save(); }
php
{ "resource": "" }
q244360
QtiTimeLine.fromArray
validation
public function fromArray($data) { $this->points = []; if (is_array($data)) { foreach ($data as $dataPoint) { $point = new TimePoint(); $point->fromArray($dataPoint); $this->points[] = $point; } } }
php
{ "resource": "" }
q244361
QtiTimeLine.remove
validation
public function remove($tag, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL) { $tags = is_array($tag) ? $tag : [$tag]; $removed = 0; foreach ($this->points as $idx => $point) { if ($point->match($tags, $target, $type)) { unset($this->points[$idx]); ...
php
{ "resource": "" }
q244362
QtiTimeLine.filter
validation
public function filter($tag = null, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL) { // the tag criteria can be omitted $tags = null; if (isset($tag)) { $tags = is_array($tag) ? $tag : [$tag]; } // create a another instance of the same clas...
php
{ "resource": "" }
q244363
QtiTimeLine.find
validation
public function find($tag = null, $target = TimePoint::TARGET_ALL, $type = TimePoint::TYPE_ALL) { // the tag criteria can be omitted $tags = null; if (isset($tag)) { $tags = is_array($tag) ? $tag : [$tag]; } // gather filterer TimePoint $points = ...
php
{ "resource": "" }
q244364
QtiTimeLine.computeRange
validation
protected function computeRange($range) { // a range must be built from pairs of TimePoint if (count($range) % 2) { throw new IncompleteRangeException(); } $duration = 0; $start = null; $end = null; foreach ($range as $point) { // grab...
php
{ "resource": "" }
q244365
QtiTimeLine.fixRange
validation
protected function fixRange($range, $lastTimestamp = null) { $fixedRange = []; $last = null; $open = false; foreach ($range as $point) { if ($this->isStartPoint($point)) { // start of range // the last range could be still open... ...
php
{ "resource": "" }
q244366
QtiTimeLine.cloneTimePoint
validation
protected function cloneTimePoint(TimePoint $point, $type, $timestamp = null) { if (is_null($timestamp)) { $timestamp = $point->getTimestamp(); } \common_Logger::d("Create missing TimePoint at " . $timestamp); return new TimePoint($point->getTags(), $timestamp, $type, $po...
php
{ "resource": "" }
q244367
QtiTimeLine.isStartPoint
validation
protected function isStartPoint(TimePoint $point) { return $point->match(null, TimePoint::TARGET_ALL, TimePoint::TYPE_START); }
php
{ "resource": "" }
q244368
QtiTimeLine.isEndPoint
validation
protected function isEndPoint(TimePoint $point) { return $point->match(null, TimePoint::TARGET_ALL, TimePoint::TYPE_END); }
php
{ "resource": "" }
q244369
QtiTimeLine.getRangeDuration
validation
protected function getRangeDuration($start, $end) { // the two TimePoint must have the same target to be consistent if ($start->getTarget() != $end->getTarget()) { throw new InconsistentRangeException('A time range must be defined by two TimePoint with the same target'); } ...
php
{ "resource": "" }
q244370
QtiRunnerService.loadItemData
validation
private function loadItemData($itemRef, $path) { $cacheKey = $itemRef . $path; if(! empty($cacheKey) && isset($this->dataCache[$itemRef . $path])) { return $this->dataCache[$itemRef . $path]; } $directoryIds = explode('|', $itemRef); if (count($directoryIds) < 3)...
php
{ "resource": "" }
q244371
QtiRunnerService.getServiceContext
validation
public function getServiceContext($testDefinitionUri, $testCompilationUri, $testExecutionUri, $userUri = null) { // create a service context based on the provided URI // initialize the test session and related objects $serviceContext = new QtiRunnerServiceContext($testDefinitionUri, $testCom...
php
{ "resource": "" }
q244372
QtiRunnerService.persist
validation
public function persist(QtiRunnerServiceContext $context) { $testSession = $context->getTestSession(); $sessionId = $testSession->getSessionId(); \common_Logger::d("Persisting QTI Assessment Test Session '${sessionId}'..."); $context->getStorage()->persist($testSession); if(...
php
{ "resource": "" }
q244373
QtiRunnerService.init
validation
public function init(RunnerServiceContext $context) { if ($context instanceof QtiRunnerServiceContext) { /* @var TestSession $session */ $session = $context->getTestSession(); // code borrowed from the previous implementation, but the reset timers option has been discard...
php
{ "resource": "" }
q244374
QtiRunnerService.getRubrics
validation
public function getRubrics(RunnerServiceContext $context, AssessmentItemRef $itemRef = null) { if ($context instanceof QtiRunnerServiceContext) { $rubricHelper = $this->getServiceLocator()->get(QtiRunnerRubric::SERVICE_ID); return $rubricHelper->getRubrics($context, $itemRef); ...
php
{ "resource": "" }
q244375
QtiRunnerService.getItemData
validation
public function getItemData(RunnerServiceContext $context, $itemRef) { if ($context instanceof QtiRunnerServiceContext) { return $this->loadItemData($itemRef, QtiJsonItemCompiler::ITEM_FILE_NAME); } else { throw new \common_exception_InvalidArgumentType( 'Qt...
php
{ "resource": "" }
q244376
QtiRunnerService.getItemState
validation
public function getItemState(RunnerServiceContext $context, $itemRef) { if ($context instanceof QtiRunnerServiceContext) { $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID); $userUri = \common_session_SessionManager::getSession()->getUserUri(); ...
php
{ "resource": "" }
q244377
QtiRunnerService.setItemState
validation
public function setItemState(RunnerServiceContext $context, $itemRef, $state) { if ($context instanceof QtiRunnerServiceContext) { $serviceService = $this->getServiceManager()->get(StorageManager::SERVICE_ID); $userUri = \common_session_SessionManager::getSession()->getUserUri(); ...
php
{ "resource": "" }
q244378
QtiRunnerService.parsesItemResponse
validation
public function parsesItemResponse(RunnerServiceContext $context, $itemRef, $response) { if ($context instanceof QtiRunnerServiceContext) { /** @var TestSession $session */ $session = $context->getTestSession(); $currentItem = $context->getCurrentAssessmentItemRef(); ...
php
{ "resource": "" }
q244379
QtiRunnerService.emptyResponse
validation
public function emptyResponse(RunnerServiceContext $context, $responses) { if ($context instanceof QtiRunnerServiceContext) { $similar = 0; /** @var ResponseVariable $responseVariable */ foreach ($responses as $responseVariable) { $value = $responseVariab...
php
{ "resource": "" }
q244380
QtiRunnerService.storeItemResponse
validation
public function storeItemResponse(RunnerServiceContext $context, $itemRef, $responses) { if ($context instanceof QtiRunnerServiceContext) { $session = $this->getCurrentAssessmentSession($context); try { \common_Logger::t('Responses sent from the client-side. The Res...
php
{ "resource": "" }
q244381
QtiRunnerService.hasFeedbacks
validation
public function hasFeedbacks(RunnerServiceContext $context, $itemRef) { $hasFeedbacks = false; $displayFeedbacks = $this->displayFeedbacks($context); if($displayFeedbacks) { $feedbacks = $this->getFeedbacks($context, $itemRef); foreach ($feedbacks as $entry) { ...
php
{ "resource": "" }
q244382
QtiRunnerService.move
validation
public function move(RunnerServiceContext $context, $direction, $scope, $ref) { $result = true; if ($context instanceof QtiRunnerServiceContext) { try { $result = QtiRunnerNavigation::move($direction, $scope, $context, $ref); if ($result) { ...
php
{ "resource": "" }
q244383
QtiRunnerService.skip
validation
public function skip(RunnerServiceContext $context, $scope, $ref) { return $this->move($context, 'skip', $scope, $ref); }
php
{ "resource": "" }
q244384
QtiRunnerService.timeout
validation
public function timeout(RunnerServiceContext $context, $scope, $ref, $late = false) { if ($context instanceof QtiRunnerServiceContext) { /* @var TestSession $session */ $session = $context->getTestSession(); if ($context->isAdaptive()) { \common_Logger::t(...
php
{ "resource": "" }
q244385
QtiRunnerService.finish
validation
public function finish(RunnerServiceContext $context, $finalState = DeliveryExecution::STATE_FINISHED) { if ($context instanceof QtiRunnerServiceContext) { $executionUri = $context->getTestExecutionUri(); $userUri = \common_session_SessionManager::getSession()->getUserUri(); ...
php
{ "resource": "" }
q244386
QtiRunnerService.pause
validation
public function pause(RunnerServiceContext $context) { if ($context instanceof QtiRunnerServiceContext) { $context->getTestSession()->suspend(); $this->persist($context); } else { throw new \common_exception_InvalidArgumentType( 'QtiRunnerService...
php
{ "resource": "" }
q244387
QtiRunnerService.resume
validation
public function resume(RunnerServiceContext $context) { if ($context instanceof QtiRunnerServiceContext) { $context->getTestSession()->resume(); $this->persist($context); } else { throw new \common_exception_InvalidArgumentType( 'QtiRunnerService...
php
{ "resource": "" }
q244388
QtiRunnerService.check
validation
public function check(RunnerServiceContext $context) { $state = $context->getTestSession()->getState(); if ($state == AssessmentTestSessionState::CLOSED) { throw new QtiRunnerClosedException(); } return true; }
php
{ "resource": "" }
q244389
QtiRunnerService.isItemCompleted
validation
public function isItemCompleted(RunnerServiceContext $context, $routeItem, $itemSession, $partially = true) { if ($context instanceof QtiRunnerServiceContext && $context->isAdaptive()) { $itemIdentifier = $context->getCurrentAssessmentItemRef()->getIdentifier(); $itemState = $this->getIt...
php
{ "resource": "" }
q244390
QtiRunnerService.getItemPublicUrl
validation
public function getItemPublicUrl(RunnerServiceContext $context, $itemRef){ if ($context instanceof QtiRunnerServiceContext) { $directoryIds = explode('|', $itemRef); $userDataLang = \common_session_SessionManager::getSession()->getDataLanguage(); $directory = \tao_models_cl...
php
{ "resource": "" }
q244391
QtiRunnerService.comment
validation
public function comment(RunnerServiceContext $context, $comment) { // prepare transmission Id for result server. $testSession = $context->getTestSession(); $item = $testSession->getCurrentAssessmentItemRef()->getIdentifier(); $occurrence = $testSession->getCurrentAssessmentItemRefOcc...
php
{ "resource": "" }
q244392
QtiRunnerService.continueInteraction
validation
protected function continueInteraction(RunnerServiceContext $context) { $continue = false; /* @var TestSession $session */ $session = $context->getTestSession(); if ($session->isRunning() === true && $session->isTimeout() === false) { $event = new QtiContinueInteractio...
php
{ "resource": "" }
q244393
QtiRunnerService.onTimeout
validation
protected function onTimeout(RunnerServiceContext $context, AssessmentTestSessionException $timeOutException) { /* @var TestSession $session */ $session = $context->getTestSession(); $event = new TestTimeoutEvent($session, $timeOutException->getCode(), true); $this->getServiceManage...
php
{ "resource": "" }
q244394
QtiRunnerService.storeTraceVariable
validation
public function storeTraceVariable(RunnerServiceContext $context, $itemUri, $variableIdentifier, $variableValue) { $this->assertQtiRunnerServiceContext($context); $metaVariable = $this->getTraceVariable($variableIdentifier, $variableValue); return $this->storeVariable($context, $itemUri, $me...
php
{ "resource": "" }
q244395
QtiRunnerService.getTraceVariable
validation
public function getTraceVariable($variableIdentifier, $variableValue) { if (!is_string($variableValue) && !is_numeric($variableValue)) { $variableValue = json_encode($variableValue); } $metaVariable = new \taoResultServer_models_classes_TraceVariable(); $metaVariable->set...
php
{ "resource": "" }
q244396
QtiRunnerService.storeOutcomeVariable
validation
public function storeOutcomeVariable(RunnerServiceContext $context, $itemUri, $variableIdentifier, $variableValue) { $this->assertQtiRunnerServiceContext($context); $metaVariable = $this->getOutcomeVariable($variableIdentifier, $variableValue); return $this->storeVariable($context, $itemUri,...
php
{ "resource": "" }
q244397
QtiRunnerService.getOutcomeVariable
validation
public function getOutcomeVariable($variableIdentifier, $variableValue) { if (!is_string($variableValue) && !is_numeric($variableValue)) { $variableValue = json_encode($variableValue); } $metaVariable = new \taoResultServer_models_classes_OutcomeVariable(); $metaVariable-...
php
{ "resource": "" }
q244398
QtiRunnerService.storeResponseVariable
validation
public function storeResponseVariable(RunnerServiceContext $context, $itemUri, $variableIdentifier, $variableValue) { $this->assertQtiRunnerServiceContext($context); $metaVariable = $this->getResponseVariable($variableIdentifier, $variableValue); return $this->storeVariable($context, $itemUr...
php
{ "resource": "" }
q244399
QtiRunnerService.getResponseVariable
validation
public function getResponseVariable($variableIdentifier, $variableValue) { if (!is_string($variableValue) && !is_numeric($variableValue)) { $variableValue = json_encode($variableValue); } $metaVariable = new \taoResultServer_models_classes_ResponseVariable(); $metaVariabl...
php
{ "resource": "" }