xref: /dokuwiki/inc/Action/Locked.php (revision 316e3ee67cce340deac79a8c6f89d881b178d094)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Ui\Editor;
6use dokuwiki\Ui;
7
8/**
9 * Class Locked
10 *
11 * Show a locked screen when a page is locked
12 *
13 * @package dokuwiki\Action
14 */
15class Locked extends AbstractAction
16{
17    /** @inheritdoc */
18    public function minimumPermission()
19    {
20        return AUTH_READ;
21    }
22
23    /** @inheritdoc */
24    public function tplContent()
25    {
26        $this->showBanner();
27        (new Editor)->show();
28    }
29
30    /**
31     * Display error on locked pages
32     *
33     * @author   Andreas Gohr <andi@splitbrain.org>
34     *
35     * @return void
36     */
37    public function showBanner()
38    {
39        global $ID;
40        global $conf;
41        global $lang;
42        global $INFO;
43
44        $locktime = filemtime(wikiLockFN($ID));
45        $expire = dformat($locktime + $conf['locktime']);
46        $min    = round(($conf['locktime'] - (time() - $locktime) )/60);
47
48        // print intro
49        print p_locale_xhtml('locked');
50
51        print '<ul>';
52        print '<li><div class="li"><strong>'.$lang['lockedby'].'</strong> '.editorinfo($INFO['locked']).'</div></li>';
53        print '<li><div class="li"><strong>'.$lang['lockexpire'].'</strong> '.$expire.' ('.$min.' min)</div></li>';
54        print '</ul>'.DOKU_LF;
55    }
56}
57