Skip to content
Snippets Groups Projects
Commit fd3a3c25 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #3428

Closes #3428

Merge request studip/studip!2330
parent adb614bd
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
<?php
/**
* @var string $launch_url
* @var array $launch_data
* @var string $signature
*/
?>
<!DOCTYPE html>
<html>
<head>
......
<?php
/**
* @var Course_LtiController $controller
* @var LtiData[] $lti_data_array
* @var bool $edit_perm
*/
?>
<? if (empty($lti_data_array)): ?>
<?= MessageBox::info(_('Es wurden noch keine Inhalte angelegt.')) ?>
<? endif ?>
<? foreach ($lti_data_array as $lti_data): ?>
<? $launch_url = $lti_data->getLaunchURL() ?>
<? if ($launch_url): ?>
<? $lti_link = $controller->getLtiLink($lti_data) ?>
<? $launch_data = $lti_link->getBasicLaunchData() ?>
<? $signature = $lti_link->getLaunchSignature($launch_data) ?>
<? endif ?>
<article class="studip">
<header>
......@@ -47,20 +49,19 @@
<section>
<?= formatReady($lti_data->description) ?>
<? if ($launch_url && $lti_data->options['document_target'] == 'iframe'): ?>
<? if ($launch_url && $lti_data->options['document_target'] === 'iframe'): ?>
<iframe style="border: none; height: 640px; width: 100%;"
src="<?= $controller->link_for('course/lti/iframe', compact('launch_url', 'launch_data', 'signature')) ?>"></iframe>
src="<?= $controller->link_for('course/lti/iframe', $lti_data->position) ?>"></iframe>
<? endif ?>
</section>
<? if ($launch_url && $lti_data->options['document_target'] != 'iframe'): ?>
<? if ($launch_url && $lti_data->options['document_target'] !== 'iframe'): ?>
<footer>
<form class="default" action="<?= htmlReady($launch_url) ?>" method="post" target="_blank">
<? foreach ($launch_data as $key => $value): ?>
<input type="hidden" name="<?= htmlReady($key) ?>" value="<?= htmlReady($value, false) ?>">
<? endforeach ?>
<?= Studip\Button::create(_('Anwendung starten'), 'oauth_signature', ['value' => $signature]) ?>
</form>
<?= Studip\LinkButton::create(
_('Anwendung starten'),
$controller->link_for('course/lti/iframe', $lti_data->position),
['target' => '_blank']
) ?>
</footer>
<? endif ?>
</article>
......
......@@ -42,6 +42,8 @@ class LtiData extends SimpleORMap
/**
* Find a single entry by course_id and position.
*
* @return static|null
*/
public static function findByCourseAndPosition($course_id, $position)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment