/** * Gets the name of the workstation being tested */ public function workstation() { $response = ['success' => false]; if ($this->hasRequestParameter('testCenter')) { $testCenter = new \core_kernel_classes_Resource($this->getRequestParameter('testCenter')); $id = $this->getId(); $response['workstation'] = uniqid('workstation-'); try { $diagnostic = TestCenterHelper::getDiagnostic($testCenter, $id); } catch (\common_exception_NoImplementation $e) { \common_Logger::i("Unable to get the workstation name for {$id} ({$testCenter})"); } if (isset($diagnostic)) { $response['success'] = true; $workstation = trim($diagnostic[DiagnosticStorage::DIAGNOSTIC_WORKSTATION]); if ($workstation) { $response['workstation'] = $workstation; } } } $this->returnJson($response); }