Skip to content
Snippets Groups Projects
Commit de69b6fd authored by Rasmus Fuhse's avatar Rasmus Fuhse Committed by David Siegfried
Browse files

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

Closes #1384

Merge request studip/studip!906
parent da3c47c4
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,10 @@ ...@@ -25,8 +25,10 @@
src="<?= htmlReady($url) ?>"></audio> src="<?= htmlReady($url) ?>"></audio>
</div> </div>
<? elseif ($material->isPDF()) : ?> <? elseif ($material->isPDF()) : ?>
<iframe src="<?= htmlReady($url) ?>" <? if ($material->isPDFInlineDisplayable()) : ?>
class="lernmarktplatz_player"></iframe> <iframe src="<?= htmlReady($url) ?>"
class="lernmarktplatz_player"></iframe>
<? endif ?>
<? elseif ($material['front_image_content_type']) : ?> <? elseif ($material['front_image_content_type']) : ?>
<div style="background-image: url('<?= htmlReady($material->getLogoURL()) ?>');" class="lernmarktplatz_player image"></div> <div style="background-image: url('<?= htmlReady($material->getLogoURL()) ?>');" class="lernmarktplatz_player image"></div>
<? endif ?> <? endif ?>
......
...@@ -322,6 +322,21 @@ class OERMaterial extends SimpleORMap ...@@ -322,6 +322,21 @@ class OERMaterial extends SimpleORMap
return $this['content_type'] === "application/pdf"; 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() protected function getFileEnding()
{ {
return pathinfo($this["filename"], PATHINFO_EXTENSION); return pathinfo($this["filename"], PATHINFO_EXTENSION);
......
...@@ -392,7 +392,8 @@ ul.reviews, ol.reviews { ...@@ -392,7 +392,8 @@ ul.reviews, ol.reviews {
width: 840px; width: 840px;
max-width: 100%; max-width: 100%;
box-sizing: border-box; box-sizing: border-box;
min-height: 200px; height: 200px;
max-height: 200px;
overflow: hidden; overflow: hidden;
.intro { .intro {
display: flex; 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