runTimeService = $runTimeService; $this->catService = $catService; $this->setDirectoryStorage($deliveryExecution->getDelivery()); $this->deliveryExecution = $deliveryExecution; $this->assessmentTestSession = $assessmentTestSession; } /** * @return array * @throws \Exception */ public function getItemsRefs() { $itemIds = []; $route = $this->assessmentTestSession->getRoute(); $routeCount = $route->count(); for ($i = 0; $i < $routeCount; $i++) { $routeItem = $route->getRouteItemAt($i); $mainItemRef = $routeItem->getAssessmentItemRef(); if ($this->catService->isAdaptivePlaceholder($mainItemRef)) { $seenCatItems = $this->catService->getPreviouslySeenCatItemIds($this->assessmentTestSession, $this->directoryStorage, $routeItem); $itemIds = array_merge($itemIds, $seenCatItems); } else { $itemIds[] = $mainItemRef->getIdentifier(); } } return $itemIds; } /** * @param core_kernel_classes_Resource $delivery * @return void * @throws \common_exception_Error */ protected function setDirectoryStorage($delivery) { $fileStorage = \tao_models_classes_service_FileStorage::singleton(); $directoryIds = explode('|', $this->getTestFile($delivery)); $this->directoryStorage = $fileStorage->getDirectoryById($directoryIds[0]); } /** * @param \core_kernel_classes_Resource $delivery * @return string * @throws \common_exception_Error */ protected function getTestFile(\core_kernel_classes_Resource $delivery) { $parameters = tao_models_classes_service_ServiceCallHelper::getInputValues( $this->runTimeService->getRuntime($delivery->getUri()), [] ); list($private, $public) = explode('|', $parameters['QtiTestCompilation']); return $private; } }