diff options
| author | Ron Lucke <lucke@elan-ev.de> | 2022-06-24 08:34:28 +0000 |
|---|---|---|
| committer | Ron Lucke <lucke@elan-ev.de> | 2022-06-24 08:34:28 +0000 |
| commit | b11152c9e53633e708cb71d76699c47faba63518 (patch) | |
| tree | cb4896ca303f14264f8aaf64cb9f456da3a8b561 /app | |
| parent | 573bbd21cc4c6e07c3134dd42e8d8dffe0664f33 (diff) | |
StEP00363: Externer Ansicht als Link für Courseware-Seiten
Closes #918
Merge request studip/studip!638
Diffstat (limited to 'app')
| -rwxr-xr-x | app/controllers/contents/courseware.php | 14 | ||||
| -rw-r--r-- | app/controllers/courseware/public.php | 28 | ||||
| -rw-r--r-- | app/views/contents/courseware/releases.php | 6 | ||||
| -rw-r--r-- | app/views/courseware/public/index.php | 16 |
4 files changed, 64 insertions, 0 deletions
diff --git a/app/controllers/contents/courseware.php b/app/controllers/contents/courseware.php index f618d79..c1ca321 100755 --- a/app/controllers/contents/courseware.php +++ b/app/controllers/contents/courseware.php @@ -185,6 +185,20 @@ class Contents_CoursewareController extends AuthenticatedController $this->setBookmarkSidebar(); } + /** + * Show users releases + * + * @SuppressWarnings(PHPMD.CamelCaseMethodName) + * @SuppressWarnings(PHPMD.Superglobals) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + + public function releases_action() + { + Navigation::activateItem('/contents/courseware/releases'); + $this->user_id = $GLOBALS['user']->id; + } + private function setBookmarkSidebar() { $sidebar = Sidebar::Get(); diff --git a/app/controllers/courseware/public.php b/app/controllers/courseware/public.php new file mode 100644 index 0000000..aa5a309 --- /dev/null +++ b/app/controllers/courseware/public.php @@ -0,0 +1,28 @@ +<?php + +use Courseware\PublicLink; + +class Courseware_PublicController extends StudipController +{ + public function before_filter(&$action, &$args) + { + parent::before_filter($action, $args); + PageLayout::setTitle(_('Courseware')); + PageLayout::setHelpKeyword('Basis.Courseware'); + } + + public function index_action() + { + $this->invalid = true; + $this->link_id = Request::option('link'); + if ($this->link_id) { + $publicLink = PublicLink::find($this->link_id); + $this->invalid = $publicLink === null; + if (!$this->invalid) { + $this->expired = $publicLink->isExpired(); + $this->link_pass = $publicLink->password; + $this->entry_element_id = $publicLink->structural_element_id; + } + } + } +} diff --git a/app/views/contents/courseware/releases.php b/app/views/contents/courseware/releases.php new file mode 100644 index 0000000..972526f --- /dev/null +++ b/app/views/contents/courseware/releases.php @@ -0,0 +1,6 @@ +<div + id="courseware-content-releases-app" + entry-type="users" + entry-id="<?= htmlReady($user_id) ?>" +> +</div> diff --git a/app/views/courseware/public/index.php b/app/views/courseware/public/index.php new file mode 100644 index 0000000..3696d1d --- /dev/null +++ b/app/views/courseware/public/index.php @@ -0,0 +1,16 @@ +<? if (!$expired && !$invalid): ?> +<div + id="courseware-public-app" + link-id="<?= htmlReady($link_id) ?>" + link-pass="<?= htmlReady($link_pass) ?>" + entry-type="public" + entry-element-id="<?= htmlReady($entry_element_id) ?>" +> +</div> +<? endif; ?> +<? if ($expired): ?> + <?= MessageBox::warning(_('Der Link zu dieser Seite ist abgelaufen.'))->hideClose() ?> +<? endif; ?> +<? if ($invalid): ?> + <?= MessageBox::error(_('Es wurde kein gültiger Link aufgerufen.'))->hideClose() ?> +<? endif; ?> |
