/** * Displays the index page of the extension: list all available deliveries. */ public function index() { $testCenters = TestCenterHelper::getTestCenters(); $data = array('list' => $testCenters); if (tao_helpers_Request::isAjax()) { $this->returnJson($data); } else { $this->setData('select-message', $this->convert('Please select one or more test site to manage proctors')); $this->composeView('proctorManager-index', $data, array(BreadcrumbsHelper::testCenters(), BreadcrumbsHelper::proctorManager()), 'pages/proctorManager.tpl'); } }
/** * Displays the three action box for the test center */ public function testCenter() { $testCenters = TestCenterHelper::getTestCenters(); $testCenter = $this->getCurrentTestCenter(); $data = array('testCenter' => $testCenter->getUri(), 'title' => sprintf($this->convert('Test site %s'), $testCenter->getLabel()), 'list' => TestCenterHelper::getTestCenterActions($testCenter)); if (\tao_helpers_Request::isAjax()) { $this->returnJson($data); } else { $this->composeView('testcenters-testcenter', $data, array(BreadcrumbsHelper::testCenters(), BreadcrumbsHelper::testCenter($testCenter, $testCenters))); } }
/** * Get the requested test center resource * Use this to identify which test center is currently being selected buy the proctor * * @return core_kernel_classes_Resource * @throws \common_Exception */ protected function getCurrentTestCenter() { if (is_null($this->currentTestCenter)) { if ($this->hasRequestParameter('testCenter')) { //get test center resource from its uri $testCenterUri = $this->getRequestParameter('testCenter'); $this->currentTestCenter = TestCenterHelper::getTestCenter($testCenterUri); } else { //@todo use a better exception throw new \common_Exception('no current test center'); } } return $this->currentTestCenter; }
/** * 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); }
/** * Lists the available test takers to assign to a delivery * * @throws \Exception * @throws \common_Exception * @throws \oat\oatbox\service\ServiceNotFoundException */ public function testTakers() { $delivery = $this->getCurrentDelivery(); $testCenter = $this->getCurrentTestCenter(); try { $requestOptions = $this->getRequestOptions(); $testTakers = DeliveryHelper::getAvailableTestTakers($delivery, $testCenter, $requestOptions); $this->composeView('delivery-testtakers', array('delivery' => $delivery->getUri(), 'testCenter' => $testCenter->getUri(), 'set' => $testTakers), array(BreadcrumbsHelper::testCenters(), BreadcrumbsHelper::testCenter($testCenter, TestCenterHelper::getTestCenters()), BreadcrumbsHelper::deliveries($testCenter, array(BreadcrumbsHelper::diagnostics($testCenter))), BreadcrumbsHelper::deliveryMonitoring($testCenter, $delivery, DeliveryHelper::getDeliveries($testCenter)), BreadcrumbsHelper::manageTestTakers($testCenter, $delivery, 'testTakers'))); } catch (ServiceNotFoundException $e) { \common_Logger::w('No delivery service defined for proctoring'); $this->returnError('Proctoring interface not available'); } }
/** * Returns array of reports to datatable */ public function reports() { $testCenter = $this->getCurrentTestCenter(); $requestOptions = $this->getRequestOptions(); $this->returnJson(TestCenterHelper::getReports($testCenter, $requestOptions)); }
/** * Removes diagnostic results * * @throws \common_Exception */ public function remove() { $testCenter = $this->getCurrentTestCenter(); $id = $this->getRequestParameter('id'); $this->returnJson(['success' => TestCenterHelper::removeDiagnostic($testCenter, $id)]); }