*/ class ProctorService extends ConfigurableService implements ProctorServiceHandler { use OntologyAwareTrait; /** * @deprecated constant moved to the \oat\taoProctoring\model\authorization\TestTakerAuthorizationService */ const PROCTORED_BY_DEFAULT = 'proctored_by_default'; const ROLE_PROCTOR = 'http://www.tao.lu/Ontologies/TAOProctor.rdf#ProctorRole'; const ROLE_PROCTOR_ADMINISTRATOR = 'http://www.tao.lu/Ontologies/TAOProctor.rdf#ProctorAdministratorRole'; const ACCESSIBLE_PROCTOR = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ProctorAccessible'; const ACCESSIBLE_PROCTOR_ENABLED = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ComplyEnabled'; const ACCESSIBLE_PROCTOR_DISABLED = 'http://www.tao.lu/Ontologies/TAODelivery.rdf#ComplyDisabled'; /** * Gets all deliveries available for a proctor * @param User $proctor * @return array */ public function getProctorableDeliveries(User $proctor, $context = null) { return DeliveryAssemblyService::singleton()->getRootClass()->searchInstances( array(self::ACCESSIBLE_PROCTOR => self::ACCESSIBLE_PROCTOR_ENABLED), array('recursive' => true) ); } public function getProctorableDeliveryExecutions(User $proctor, $delivery = null, $context = null, $options = []) { $monitoringService = $this->getServiceManager()->get(DeliveryMonitoringService::SERVICE_ID); $criteria = $this->getCriteria($delivery, $context, $options); $options['asArray'] = true; return $monitoringService->find($criteria, $options, true); } public function countProctorableDeliveryExecutions(User $proctor, $delivery = null, $context = null, $options = []) { $monitoringService = $this->getServiceManager()->get(DeliveryMonitoringService::SERVICE_ID); $criteria = $this->getCriteria($delivery, $context, $options); return $monitoringService->count($criteria, $options); } /** * @param null $delivery * @param null $context * @param array $options * @return array */ protected function getCriteria($delivery = null, $context = null, $options = []) { $criteria = []; if ($delivery !== null) { $criteria = [ [DeliveryMonitoringService::DELIVERY_ID => $delivery->getUri()] ]; } if (!empty($options['filters']) && is_array($options['filters'])) { $criteria = array_merge($options['filters'], $criteria); } return $criteria; } /** * (non-PHPdoc) * @see \oat\taoProctoring\model\ProctorServiceHandler::isSuitable() */ public function isSuitable(User $user, $deliveryId = null) { return true; } }