Failed Conditions
Pull Request — master (#3198)
by
unknown
02:51
created

PageConflict::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 25
rs 9.52
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Ui;
4
5
use dokuwiki\Form\Form;
6
7
/**
8
 * DokuWiki Page Conflict Interface
9
 *
10
 * @package dokuwiki\Ui
11
 */
12
class PageConflict extends Ui
13
{
14
    protected $text;
15
    protected $summary;
16
17
    /** 
18
     * PageConflict Ui constructor
19
     *
20
     * @param string $text     wiki text
21
     * @param string $summary  edit summary
22
    */
23
    public function __construct($text = '', $summary = '')
24
    {
25
        $this->text    = $text;
26
        $this->summary = $summary;
27
    }
28
29
    /**
30
     * Show conflict form to ask whether save anyway or cancel the page edits
31
     *
32
     * @author   Andreas Gohr <[email protected]>
33
     *
34
     * @return void
35
     */
36
    public function show()
37
    {
38
        global $ID;
39
        global $lang;
40
41
        // print intro
42
        print p_locale_xhtml('conflict');
43
44
        // create the form
45
        $form = new Form(['id' => 'dw__editform']);
46
        $form->addTagOpen('div')->addClass('no');
47
        $form->setHiddenField('id', $ID);
48
        $form->setHiddenField('wikitext', $this->text);
49
        $form->setHiddenField('summary', $this->summary);
50
51
        $form->addButton('do[save]', $lang['btn_save'] )->attrs(['type' => 'submit', 'accesskey' => 's']);
52
        $form->addButton('do[cancel]', $lang['btn_cancel'] )->attrs(['type' => 'submit']);
53
        $form->addTagClose('div');
54
55
        print $form->toHTML('Conflict');
56
57
        print '<br /><br /><br /><br />';
58
59
        (new Diff($this->text, false))->show();
60
    }
61
62
}
63