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

Resolve "OER-Campus: Großer schwarzer Kasten"

Closes #1384

Merge request studip/studip!906
parent d638c669
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,10 @@
src="<?= htmlReady($url) ?>"></audio>
</div>
<? elseif ($material->isPDF()) : ?>
<iframe src="<?= htmlReady($url) ?>"
class="lernmarktplatz_player"></iframe>
<? if ($material->isPDFInlineDisplayable()) : ?>
<iframe src="<?= htmlReady($url) ?>"
class="lernmarktplatz_player"></iframe>
<? endif ?>
<? elseif ($material['front_image_content_type']) : ?>
<div style="background-image: url('<?= htmlReady($material->getLogoURL()) ?>');" class="lernmarktplatz_player image"></div>
<? endif ?>
......
......@@ -305,6 +305,21 @@ class OERMaterial extends SimpleORMap
return $this['content_type'] === "application/pdf";
}
public function isPDFInlineDisplayable()
{
if (!$this->isPDF()) {
return false;
}
$url = $this->getDownloadUrl();
$headers = get_headers($url, true);
if ($headers['Content-Disposition']
&& substr($headers['Content-Disposition'], 0, strlen('attachment')) === 'attachment') {
//in this case the server forces to download the document and we cannot display it in an iframe:
return false;
}
return true;
}
protected function getFileEnding()
{
return pathinfo($this["filename"], PATHINFO_EXTENSION);
......
......@@ -396,7 +396,8 @@ ul.reviews, ol.reviews {
width: 840px;
max-width: 100%;
box-sizing: border-box;
min-height: 200px;
height: 200px;
max-height: 200px;
overflow: hidden;
.intro {
display: flex;
......
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