__toString()); if (tao_helpers_Request::isAjax()) { throw new common_exception_IsAjaxAction(__CLASS__ . '::' . __FUNCTION__); } else { $launchData = LtiLaunchData::fromRequest(\common_http_Request::currentRequest()); if ($launchData->hasReturnUrl() && $error->getCode() != LtiErrorMessage::ERROR_UNAUTHORIZED) { $flowController = new FlowController(); $flowController->redirect($this->getLtiReturnUrl($launchData, $error)); } // In regard of the IMS LTI standard, we have to show a back button that refer to the // launch_presentation_return_url url param. So we have to retrieve this parameter before trying to start // the session $consumerLabel = $launchData->getToolConsumerName(); if (!is_null($consumerLabel)) { $this->setData('consumerLabel', $consumerLabel); } $this->setData('message', $error->getMessage()); $this->setView('error.tpl', 'taoLti'); } } /** * @param LtiLaunchData $launchData * @param LtiException $error * @return string * @throws LtiException */ private function getLtiReturnUrl(LtiLaunchData $launchData, LtiException $error) { $baseUrl = $launchData->getReturnUrl(); $url = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?') . http_build_query($error->getLtiMessage()->getUrlParams()); return $url; } }