aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/courseware/public.php
blob: a7472ae836c80f526a83a9205eb89d9b95315022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?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->block_types = Courseware\BlockTypes\BlockType::getBlockTypes();
                $this->expired = $publicLink->isExpired();
                $this->link_pass = $publicLink->password;
                $this->entry_element_id = $publicLink->structural_element_id;
            }
        }
    }
}