diff --git a/app/controllers/course/contentmodules.php b/app/controllers/course/contentmodules.php index 2e4907a7e25cb9fea5f0a6e9fc0919f9a7c109a5..06d46deab4c54206d8654d019671267b4e8eff84 100644 --- a/app/controllers/course/contentmodules.php +++ b/app/controllers/course/contentmodules.php @@ -231,6 +231,34 @@ class Course_ContentmodulesController extends AuthenticatedController { $this->plugin = PluginManager::getInstance()->getPluginById($plugin_id); $this->metadata = $this->plugin->getMetadata(); + $this->screenshots = []; + + if (isset($this->metadata['screenshot'])) { + $screenshots = explode('.', $this->metadata['screenshot']); + $ext = end($screenshots); + $title = str_replace('_', ' ', basename($this->metadata['screenshot'], ".{$ext}")); + $source = "{$this->plugin->getPluginURL()}/{$this->metadata['screenshot']}"; + + $this->screenshots[] = compact('title', 'source'); + } + if (isset($this->metadata['additionalscreenshots'])) { + foreach ($this->metadata['additionalscreenshots'] as $picture) { + $pictures = explode('.', $picture); + $ext = end($pictures); + $title = str_replace('_', ' ', basename($picture, ".{$ext}")); + $source = "{$this->plugin->getPluginURL()}/{$picture}"; + + $this->screenshots[] = compact('title', 'source'); + } + } + if (isset($this->metadata['screenshots'])) { + foreach ($this->metadata['screenshots']['pictures'] as $picture) { + $title = $picture['title']; + $source = "{$this->plugin->getPluginURL()}/{$this->metadata['screenshots']['path']}/{$picture['source']}"; + $this->screenshots[] = compact('title', 'source'); + } + } + PageLayout::setTitle(sprintf(_('Informationen über %s'), $this->metadata['displayname'])); } diff --git a/app/views/course/contentmodules/info.php b/app/views/course/contentmodules/info.php index 5f536eb5e2aebd2850051eaca1b1fe91ea63a88d..18d7ccf7363b6ed4e909e23f215744de081285a6 100644 --- a/app/views/course/contentmodules/info.php +++ b/app/views/course/contentmodules/info.php @@ -43,15 +43,15 @@ <?= formatReady($plugin->getPluginDescription()) ?> </div> </div> - <? if (isset($metadata['screenshots']) && count($metadata['screenshots']['pictures'])) : ?> + <? if (isset($screenshots) && count($screenshots)) : ?> <ul class="screenshots clean"> - <? foreach ($metadata['screenshots']['pictures'] as $pictures) : ?> + <? foreach ($screenshots as $screenshot) : ?> <li> - <a href="<?= $plugin->getPluginURL().$metadata['screenshots']['path'].'/'.$pictures['source'] ?>" + <a href="<?= htmlReady($screenshot['source']) ?>" data-lightbox="<?= htmlReady($metadata['displayname'] ?? $plugin->getPluginName()) ?>" - data-title="<?= htmlReady($pictures['title']) ?>"> - <img src="<?= $plugin->getPluginURL() . ($plugin instanceof StudIPPlugin ? '/' : '') . $metadata['screenshots']['path'] . '/' . $pictures['source'] ?>" alt=""> - <?= htmlReady($pictures['title']) ?> + data-title="<?= htmlReady($screenshot['title']) ?>"> + <img src="<?= htmlReady($screenshot['source']) ?>" alt=""> + <?= htmlReady($screenshot['title']) ?> </a> </li> <? endforeach ?>