getServiceManager()->get(ProctorService::SERVICE_ID); $proctor = \common_session_SessionManager::getSession()->getUser(); $context = $this->hasRequestParameter('context') ? $this->getRequestParameter('context') : null; $deliveries = $service->getProctorableDeliveries($proctor, $context); $data = array(); foreach ($deliveries as $delivery) { $executions = $service->getProctorableDeliveryExecutions($proctor, $delivery, $context); $deliveryData = DeliveryHelper::buildDeliveryData($delivery, $executions); $deliveryData['url'] = _url('index', 'Monitor', null, is_null($context) ? ['delivery' => $delivery->getUri()] : ['delivery' => $delivery->getUri(), 'context' => $context] ); $data[] = $deliveryData; } return $data; } /** * Gets the view parameters and data to display * @return array */ protected function getViewData() { return [ 'list' => $this->getDeliveries(), 'categories' => DeliveryHelper::getAllReasonsCategories(), ]; } /** * Lists all available deliveries */ public function index() { $this->setData('homeUrl', $this->getServiceManager()->get(DefaultUrlService::SERVICE_ID)->getUrl('ProctoringHome')); $this->setData('logout', $this->getServiceManager()->get(DefaultUrlService::SERVICE_ID)->getUrl('ProctoringLogout')); $this->composeView('delivery-index', null, 'pages/index.tpl', 'tao'); } /** * Lists all available deliveries */ public function deliveries() { $this->returnJson([ 'success' => true, 'data' => $this->getViewData(), ]); } }