getLtiSession(); if ($ltiSession->getLaunchData()->hasVariable(LtiLaunchData::RESOURCE_LINK_TITLE)) { $this->setData('linkTitle', $ltiSession->getLaunchData()->getVariable(LtiLaunchData::RESOURCE_LINK_TITLE)); } $this->setData('link', $ltiSession->getLtiLinkResource()->getUri()); $this->setData('submitUrl', _url('setDelivery')); $deliveries = DeliveryAssemblyService::singleton()->getAllAssemblies(); if (count($deliveries) > 0) { $this->setData('deliveries', $deliveries); $this->setView('instructor/selectDelivery.tpl'); } else { $this->returnError(__('No deliveries available')); } } /** * called onSelect of a delivery */ public function setDelivery() { $link = new core_kernel_classes_Resource($this->getRequestParameter('link')); $compiled = new core_kernel_classes_Resource($this->getRequestParameter('uri')); $link->editPropertyValues(new core_kernel_classes_Property(LTIDeliveryTool::PROPERTY_LINK_DELIVERY), $compiled); $this->redirect(_url('showDelivery', null, null, ['uri' => $compiled->getUri()])); } /** * Either displays the currently associated delivery * or calls selectDelivery in order to allow the user to select a delivery * * Only accessible to LTI instructors */ public function configureDelivery() { $compiledDelivery = $this->getServiceLocator()->get(LTIDeliveryTool::class)->getDeliveryFromLink(); if (is_null($compiledDelivery)) { $this->selectDelivery(); } else { $showDeliveryUrl = $this->getServiceLocator()->get(UrlHelper::class)->buildUrl( 'showDelivery', null, null, ['uri' => $compiledDelivery->getUri()] ); $this->redirect($showDeliveryUrl); } } /** * Displays the currently associated delivery * * Only accessible to LTI instructors * @throws \common_exception_Error * @throws \common_exception_NoImplementation * @throws \oat\taoLti\models\classes\LtiException * @throws \oat\taoLti\models\classes\LtiVariableMissingException */ public function showDelivery() { $delivery = new core_kernel_classes_Resource($this->getRequestParameter('uri')); $this->setData('delivery', $delivery); $ltiSession = LtiService::singleton()->getLtiSession(); if ($ltiSession->getLaunchData()->hasVariable(LtiLaunchData::RESOURCE_LINK_TITLE)) { $this->setData('linkTitle', $ltiSession->getLaunchData()->getVariable(LtiLaunchData::RESOURCE_LINK_TITLE)); } if (ServiceProxy::singleton()->implementsMonitoring()) { $executions = ServiceProxy::singleton()->getExecutionsByDelivery($delivery); $this->setData('executionCount', count($executions)); } $this->setView('instructor/viewDelivery.tpl'); } }