xref: /plugin/bez/tpl/commcause_form.php (revision 038c5d4a6a969d879580f53f12ade1bfabd5474f)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php $url = $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action',
3	$tpl->param('action') == 'commcause_edit' ? 'commcause_edit' : 'commcause_add',
4'kid', $tpl->param('kid')) ?>
5<a id="k_"></a>
6<form class="bez_form_blank" action="<?php echo $url ?>" method="POST">
7	<input type="hidden" name="id" value="">
8	<div class="bez_comment bez_comment_form">
9		<div class="bez_avatar">
10			<img src="<?php echo DOKU_URL ?>lib/plugins/bez/images/avatar_default.png" />
11		</div>
12		<div class="bez_text_comment">
13			<span class="bez_arrow-tip-container">
14				<span class="bez_arrow-tip">
15					<span class="bez_arrow-tip-grad"></span>
16				</span>
17			</span>
18			<div class="commcause_content">
19			<h2>
20				<?php if ($tpl->get('thread_comment')->acl_of('type') >= BEZ_PERMISSION_CHANGE &&
21                          $tpl->get('thread')->can_add_causes()): ?>
22				<ul class="bez_tabs">
23					<li
24                        <?php if (  $tpl->value('type') == '' ||
25                                    $tpl->value('type') == 'comment') echo 'class="active"' ?>
26                        <?php if (  $tpl->param('kid') !== '' &&
27                                    $tpl->get('thread_comment')->task_count > 0)
28                                echo 'style="display:none;"';
29                        ?>
30                    >
31                        <a href="#comment"><?php echo $tpl->getLang('comment_noun') ?></a>
32                    </li>
33					<li <?php if(strpos($tpl->value('type'), 'cause') === 0) echo 'class="active"' ?>>
34						<a href="#cause"><?php echo $tpl->getLang('cause_noun') ?></a>
35                    </li>
36				</ul>
37				<?php endif ?>
38				<div class="bez_toolbar"></div>
39			</h2>
40			</div>
41			<div class="bez_content">
42				<textarea name="content" class="bez_textarea_content" id="content1"><?php echo $tpl->value('content') ?></textarea>
43
44				<input class="bez_comment_type" type="hidden" name="type" value="comment" />
45
46                <div class="plugin__bez_form_buttons">
47
48                <?php if ($tpl->get('thread_comment')->acl_of('type') >= BEZ_PERMISSION_CHANGE &&
49                    $tpl->get('thread')->can_add_causes()): ?>
50                    <div class="bez_cause_type">
51                        <div style="margin-bottom: 10px;">
52                            <label for="potential">
53                                <?php echo $tpl->getLang('cause_type') ?>:
54                            </label>
55                            <label>
56                                <input type="radio" name="type" value="cause_real"
57                                    <?php if($tpl->value('type') != 'cause_potential') echo 'checked' ?>/>
58                                <?php echo $tpl->getLang('cause_real') ?>
59                            </label>
60                            &nbsp;&nbsp;
61                            <label>
62                                <input type="radio" name="type" value="cause_potential"
63                                    <?php if($tpl->value('type') == 'cause_potential') echo 'checked' ?>/>
64                                <?php echo $tpl->getLang('cause_potential') ?>
65                            </label>
66                        </div>
67                    </div>
68                <?php endif ?>
69
70                <div class="plugin__bez_form_buttons_container">
71                <?php if ($tpl->param('kid') != ''): ?>
72                    <a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id) ?><?php if ($tpl->param('kid') != '') echo '#k'.$tpl->param('kid') ?>"
73                       class="plugin__bez_button plugin__bez_button_red">
74                        <?php echo $tpl->getLang('cancel') ?>
75                    </a>
76                <?php endif ?>
77
78                <?php if ($tpl->get('thread')->can_add_comments()): ?>
79                    <button class="plugin__bez_button plugin__bez_button_green" name="fn" value="comment_add">
80                        <?php echo $tpl->param('kid') != '' ? $tpl->getLang('correct') : $tpl->getLang('add') ?>
81                    </button>
82                <?php endif ?>
83                <?php if ($tpl->param('kid') == '' && $tpl->get('thread')->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
84                    <?php if ($tpl->get('thread')->can_be_closed()): ?>
85                        <button class="plugin__bez_button plugin__bez_button_gray" name="fn" value="thread_close">
86                            <?php echo $tpl->getLang('js')['close_issue' . $tpl->get('lang_suffix')] ?>
87                        </button>
88                    <?php elseif ($tpl->get('thread')->can_be_rejected()): ?>
89                        <button class="plugin__bez_button plugin__bez_button_gray" name="fn" value="thread_reject">
90                            <?php echo $tpl->getLang('js')['reject_issue' . $tpl->get('lang_suffix')] ?>
91                        </button>
92                    <?php elseif ($tpl->get('thread')->can_be_reopened()): ?>
93                        <button class="plugin__bez_button plugin__bez_button_gray" name="fn" value="thread_reopen">
94                            <?php echo $tpl->getLang('js')['reopen_issue'. $tpl->get('lang_suffix')]  ?>
95                        </button>
96                    <?php endif ?>
97                <?php endif ?>
98                </div>
99                </div>
100		</div>
101        <?php if (  $tpl->param('kid') != '' &&
102                    $tpl->get('thread_comment')->task_count > 0): ?>
103            <div style="margin-top: 10px; margin-left: 40px">
104                <?php foreach ($tpl->get('tasks ' . $tpl->get('thread_comment')->id, array()) as $task): ?>
105                    <?php $tpl->set('task', $task) ?>
106                    <?php if (	$tpl->param('action') == 'task_edit' &&
107                        $tpl->param('tid') == $task->id): ?>
108                        <?php include 'task_form.php' ?>
109                    <?php else: ?>
110                        <?php include 'task_box.php' ?>
111                    <?php endif ?>
112                <?php endforeach ?>
113            </div>
114        <?php endif ?>
115    </div>
116    </div>
117</form>
118