/**
  * (non-PHPdoc)
  * @see \oat\taoDelivery\model\authorization\AuthorizationProvider::verifyResumeAuthorization()
  */
 public function verifyResumeAuthorization(DeliveryExecution $deliveryExecution, User $user)
 {
     $eligibilityService = $this->getEligibilityService();
     $testCenter = $eligibilityService->getTestCenter($deliveryExecution->getDelivery(), $user);
     if (!empty($testCenter)) {
         $eligibility = $eligibilityService->getEligibility($testCenter, $deliveryExecution->getDelivery());
         $state = $deliveryExecution->getState()->getUri();
         if (in_array($state, [ProctoredDeliveryExecution::STATE_FINISHED, ProctoredDeliveryExecution::STATE_TERMINATED])) {
             throw new UnAuthorizedException(_url('index', 'DeliveryServer', 'taoProctoring'), 'Terminated/Finished delivery cannot be resumed');
         }
         if (!$eligibilityService->canByPassProctor($eligibility)) {
             // proctoring is required
             if ($state !== ProctoredDeliveryExecution::STATE_AUTHORIZED) {
                 $errorPage = _url('awaitingAuthorization', 'DeliveryServer', 'taoProctoring', array('deliveryExecution' => $deliveryExecution->getIdentifier()));
                 throw new UnAuthorizedException($errorPage, 'Proctor authorization missing');
             }
         }
     }
 }
 /**
  * @param DeliveryExecution $deliveryExecution
  * @return \oat\taoDelivery\model\DeliveryContainer
  * @throws common_Exception
  */
 public function getDeliveryContainer(DeliveryExecution $deliveryExecution)
 {
     $containerClass = $this->getOption('deliveryContainer');
     $container = new $containerClass($deliveryExecution);
     if (!$container instanceof \oat\taoDelivery\model\DeliveryContainer) {
         throw new common_Exception('A delivery container must be an instance of oat\\taoDelivery\\model\\DeliveryContainer');
     }
     $container->setData('deliveryExecution', $deliveryExecution->getIdentifier());
     $container->setData('deliveryServerConfig', $this->getJsConfig($deliveryExecution->getDelivery()));
     return $container;
 }
 /**
  * Get the container test compilation
  * @param DeliveryExecution $execution
  * @return string the  testCompilation
  */
 public function getTestCompilation(DeliveryExecution $deliveryExecution)
 {
     //FIXME this shouldn't be a service call anymore, a delivery property instead
     $delivery = $deliveryExecution->getDelivery();
     $runtime = ServiceManager::getServiceManager()->get(AssignmentService::CONFIG_ID)->getRuntime($delivery);
     $inputParameters = \tao_models_classes_service_ServiceCallHelper::getInputValues($runtime, array());
     return $inputParameters['QtiTestCompilation'];
 }
 /**
  * Update deliver label
  */
 private function updateDeliveryName()
 {
     $this->addValue(DeliveryMonitoringService::DELIVERY_NAME, $this->deliveryExecution->getDelivery()->getLabel(), true);
 }
 /**
  *
  * @param DeliveryExecution $deliveryExecution
  * @return array
  * Example:
  * <pre>
  * array(
  *   'QtiTestCompilation' => 'http://sample/first.rdf#i14369768868163155-|http://sample/first.rdf#i1436976886612156+',
  *   'QtiTestDefinition' => 'http://sample/first.rdf#i14369752345581135'
  * )
  * </pre>
  */
 public function getRuntimeInputParameters(DeliveryExecution $deliveryExecution)
 {
     $compiledDelivery = $deliveryExecution->getDelivery();
     $runtime = ServiceManager::getServiceManager()->get(AssignmentService::CONFIG_ID)->getRuntime($compiledDelivery->getUri());
     $inputParameters = \tao_models_classes_service_ServiceCallHelper::getInputValues($runtime, array());
     return $inputParameters;
 }
 public function verifyResumeAuthorization(DeliveryExecution $deliveryExecution, User $user)
 {
     $this->validateClient($deliveryExecution->getDelivery()->getUri());
 }
 /**
  * Return delivery execution as xml of testtaker based on delivery
  *
  * @return string
  */
 public function getDeliveryExecutionXml(DeliveryExecutionInterface $deliveryExecution)
 {
     return $this->getQtiResultXml($deliveryExecution->getDelivery()->getUri(), $deliveryExecution->getUri());
 }