From 9739e627e1e83a12cf1f0a76a203d40b33535c44 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Mon, 6 Nov 2023 12:24:54 +0000 Subject: fixes #3428 Closes #3428 Merge request studip/studip!2330 --- app/controllers/course/lti.php | 11 +++++++---- app/views/course/lti/iframe.php | 7 +++++++ app/views/course/lti/index.php | 29 +++++++++++++++-------------- lib/models/LtiData.php | 2 ++ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/app/controllers/course/lti.php b/app/controllers/course/lti.php index 28bf218..7f18292 100644 --- a/app/controllers/course/lti.php +++ b/app/controllers/course/lti.php @@ -78,11 +78,14 @@ class Course_LtiController extends StudipController /** * Display the launch form for a tool as an iframe. */ - public function iframe_action() + public function iframe_action(string $position) { - $this->launch_url = Request::get('launch_url'); - $this->launch_data = Request::getArray('launch_data'); - $this->signature = Request::get('signature'); + $lti_data = LtiData::findByCourseAndPosition($this->course_id, $position); + $lti_link = $this->getLtiLink($lti_data); + + $this->launch_url = $lti_data->getLaunchURL(); + $this->launch_data = $lti_link->getBasicLaunchData(); + $this->signature = $lti_link->getLaunchSignature($this->launch_data); $this->set_layout(null); } diff --git a/app/views/course/lti/iframe.php b/app/views/course/lti/iframe.php index cd73efd..1cd0d2c 100644 --- a/app/views/course/lti/iframe.php +++ b/app/views/course/lti/iframe.php @@ -1,3 +1,10 @@ + diff --git a/app/views/course/lti/index.php b/app/views/course/lti/index.php index e04e3bf..df1696b 100644 --- a/app/views/course/lti/index.php +++ b/app/views/course/lti/index.php @@ -1,14 +1,16 @@ + getLaunchURL() ?> - - getLtiLink($lti_data) ?> - getBasicLaunchData() ?> - getLaunchSignature($launch_data) ?> -
@@ -47,20 +49,19 @@
description) ?> - options['document_target'] == 'iframe'): ?> + options['document_target'] === 'iframe'): ?> + src="link_for('course/lti/iframe', $lti_data->position) ?>">
- options['document_target'] != 'iframe'): ?> + options['document_target'] !== 'iframe'): ?>
-
- $value): ?> - - - $signature]) ?> -
+ link_for('course/lti/iframe', $lti_data->position), + ['target' => '_blank'] + ) ?>
diff --git a/lib/models/LtiData.php b/lib/models/LtiData.php index 3434287..0c73dbc 100644 --- a/lib/models/LtiData.php +++ b/lib/models/LtiData.php @@ -56,6 +56,8 @@ class LtiData extends SimpleORMap /** * Find a single entry by course_id and position. + * + * @return static|null */ public static function findByCourseAndPosition($course_id, $position) { -- cgit v1.0