get(DeliveryLog::SERVICE_ID); $service = ResultsService::singleton(); $implementation = $service->getReadableImplementation($delivery); $service->setImplementation($implementation); $results = $service->getImplementation()->getResultByDelivery([$delivery->getUri()]); foreach ($results as $res) { $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($res['deliveryResultIdentifier']); $logs = $deliveryLog->get( $deliveryExecution->getIdentifier(), DeliveryLogEvent::EVENT_ID_TEST_IRREGULARITY ); foreach ($logs as $data) { $exportable = []; if ((empty($from) || $data['created_at'] > $from) && (empty($to) || $data['created_at'] < $to)) { $exportable[] = \tao_helpers_Date::displayeDate($data['created_at']); $exportable[] = $this->getUserName($data['created_by']); $exportable[] = $this->getUserName($res['testTakerIdentifier']); $exportable[] = $data['data']['reason']['reasons']['category']; $exportable[] = (isset($data['data']['reason']['reasons']['subCategory'])) ? $data['data']['reason']['reasons']['subCategory'] : ''; $exportable[] = $data['data']['reason']['comment']; $export[] = $exportable; } } } return $export; } /** * @param string $userId * @return string */ private function getUserName($userId) { if (!isset($this->userNames[$userId])) { $user = UserHelper::getUser($userId); $userName = UserHelper::getUserName($user, true); if (empty($userName)) { $userName = $userId; } $this->userNames[$userId] = $userName; } return $this->userNames[$userId]; } }