aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/short_urls.php
blob: 012f3cb791156f6b0afdb91afa7ef2c11c25ac5e (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
30
31
32
33
34
35
36
37
<?php

use Studip\Forms\Form;

class ShortUrlsController extends AuthenticatedController
{
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);
        $this->current_user = User::findCurrent();
    }

    public function index_action(): void
    {
        PageLayout::setTitle(_('Meine Kurz-URLs'));
        Navigation::activateItem('/contents/short_urls/overview');

        $this->render_vue_app(
            Studip\VueApp::create('short-urls/ShortUrlList')
            ->withStore('shortUrlsStore', 'useShortUrlsStore')
        );
    }

    public function create_action(): void
    {
        PageLayout::setTitle(_('Kurz-URL erstellen'));

        $clean_path = preg_replace('#^.*?dispatch\.php#', 'dispatch.php', Request::get('path'));
        $this->render_vue_app(
            Studip\VueApp::create('short-urls/ShortUrl')
                ->withProps([
                    'path'  => $clean_path,
                    'isNew' => true
                ])
        );
    }
}