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