コード例 #1
0
 /**
  * @param TestSessionMemento $sessionMemento
  */
 protected function triggerStateChanged(TestSessionMemento $sessionMemento)
 {
     $event = new QtiTestStateChangeEvent($this, $sessionMemento);
     if ($event instanceof ServiceLocatorAwareInterface) {
         $event->setServiceLocator($this->getServiceLocator());
     }
     $this->getEventManager()->trigger($event);
 }
コード例 #2
0
 /**
  * Catch changing of session state
  * @param QtiTestStateChangeEvent $event
  */
 public static function testStateChanged(QtiTestStateChangeEvent $event)
 {
     $session = $event->getSession();
     $state = $session->getState();
     $deliveryMonitoringService = ServiceManager::getServiceManager()->get(DeliveryMonitoringService::CONFIG_ID);
     $deliveryExecution = self::getDeliveryExecutionById($session->getSessionId());
     $data = $deliveryMonitoringService->getData($deliveryExecution, false);
     $data->setTestSession($session);
     $data->updateData([DeliveryMonitoringService::STATUS, DeliveryMonitoringService::CONNECTIVITY, DeliveryMonitoringService::CURRENT_ASSESSMENT_ITEM, DeliveryMonitoringService::END_TIME]);
     $deliveryMonitoringService->save($data);
     if ($event->getPreviousState() !== AssessmentTestSessionState::INITIAL && $state === AssessmentTestSessionState::SUSPENDED) {
         self::setHasBeenPaused($session->getSessionId(), true);
     }
 }