Failed Conditions
Pull Request — master (#3198)
by
unknown
03:16
created

ConflictForm   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A show() 0 21 1
1
<?php
2
3
namespace dokuwiki\Ui;
4
5
use dokuwiki\Extension\Event;
6
use dokuwiki\Form\Form;
7
8
/**
9
 * DokuWiki Conflict Form
10
 *
11
 * @package dokuwiki\Ui
12
 */
13
class ConflictForm extends Ui
14
{
15
    /**
16
     * Show conflict form to ask whether save anyway or cancel the page edits
17
     *
18
     * @author   Andreas Gohr <[email protected]>
19
     *
20
     * @triggers HTML_CONFLICTFORM_OUTPUT
21
     * @param string $text
22
     * @param string $summary
23
     * @return void
24
     */
25
    public function show($text = '', $summary = '')
26
    {
27
        global $ID;
28
        global $lang;
29
30
        // create the form
31
        $form = new Form(['id' => 'dw__editform']);
32
        $form->addTagOpen('div')->addClass('no');
33
        $form->setHiddenField('id', $ID);
34
        $form->setHiddenField('wikitext', $text);
35
        $form->setHiddenField('summary', $summary);
36
37
        $form->addButton('do[save]', $lang['btn_save'] )->attrs(['type' => 'submit', 'accesskey' => 's']);
38
        $form->addButton('do[cancel]', $lang['btn_cancel'] )->attrs(['type' => 'submit']);
39
        $form->addTagClose('div');
40
41
        // emit HTML_CONFLICTFORM_OUTPUT event, print the form
42
        Event::createAndTrigger('HTML_CONFLICTFORM_OUTPUT', $form, 'html_form_output', false);
43
44
        print '<br /><br /><br /><br />'.DOKU_LF;
45
    }
46
47
}
48