xref: /dokuwiki/inc/Action/Locked.php (revision 26dfc2323f8f70cb69aac4c8c51bf7997809f2ca)
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        echo p_locale_xhtml('locked');
50
51        echo '<ul>';
52        echo '<li><div class="li"><strong>'.$lang['lockedby'].'</strong> '.editorinfo($INFO['locked']).'</div></li>';
53        echo '<li><div class="li"><strong>'.$lang['lockexpire'].'</strong> '.$expire.' ('.$min.' min)</div></li>';
54        echo '</ul>'.DOKU_LF;
55    }
56}
57