xref: /plugin/bez/tpl/commcause_box.php (revision a4d58c1b80c7e5302934910cec22fbac48223bb6)
1<a id="k<?php echo $template['commcause']->id ?>"></a>
2<div class="bez_comment
3	<?php echo $template['commcause']->type === '0' ? 'bez_type_0' : 'bez_cause' ?>
4	<?php
5		if ($template['commcause']->reporter ==
6                $this->model->users->get_user_full_name($this->model->user_nick)) {
7			echo 'bez_my_comment';
8		}
9	?>">
10	<div class="bez_avatar">
11		<img src="<?php echo DOKU_URL ?>lib/plugins/bez/images/avatar_default.png" />
12	</div>
13	<div class="bez_text_comment">
14		<span class="bez_arrow-tip-container ">
15			<span class="bez_arrow-tip ">
16				<span class="bez_arrow-tip-grad"></span>
17			</span>
18		</span>
19		<div class="commcause_content">
20            <?php if (  $template['action'] === 'commcause_edit_metadata' &&
21                        $template['kid'] === $template['commcause']->id): ?>
22                <?php $id = $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_edit_metadata', 'kid', $template['kid']) ?>
23                <form   class="bez_metaform"
24                        action="?id=<?php echo $id ?>" method="POST">
25            <?php endif ?>
26			<h2>
27                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
28                            $template['kid'] === $template['commcause']->id &&
29                            $template['commcause']->acl_of('reporter') >= BEZ_PERMISSION_CHANGE): ?>
30                     <select name="reporter" id="reporter" data-validation="required">
31                        <option value="">--- <?php echo $bezlang['select'] ?>---</option>
32                        <?php foreach ($template['users'] as $nick => $name): ?>
33                            <option <?php if ($value['reporter'] === $nick) echo 'selected' ?>
34                            value="<?php echo $nick ?>"><?php echo $name ?></option>
35                        <?php endforeach ?>
36                    </select>
37                <?php else: ?>
38                    <strong><?php echo $this->model->users->get_user_full_name($template['commcause']->reporter) ?></strong>
39                <?php endif ?>
40
41
42                <?php if ($template['commcause']->type > 0): ?>
43				    <?php echo $bezlang['cause_added'] ?>
44                <?php else: ?>
45                    <?php echo $bezlang['comment_added'] ?>
46                <?php endif ?>
47
48                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
49                            $template['kid'] === $template['commcause']->id &&
50                            $template['commcause']->acl_of('reporter') >= BEZ_PERMISSION_CHANGE): ?>
51                      <input name="date" style="width:90px;" data-validation="required,date" value="<?php echo $value['date'] ?>" />
52                      <?php echo $this->model->action->getLang('at_hour') ?>
53                     <input name="time" style="width:60px;" data-validation="required,custom" data-validation-regexp="^(\d{1,2}):(\d{1,2})$" value="<?php echo $value['time'] ?>" />
54                <?php else: ?>
55                    <?php echo $template['commcause']->date_format($template['commcause']->datetime) ?>
56                <?php endif ?>
57
58                <?php if ($template['commcause']->type === '1'): ?>
59                    <span style="color: #000;">
60                        (<?php echo lcfirst($bezlang['cause_type_default']) ?>)
61                    </span>
62                <?php elseif ($template['commcause']->type === '2'): ?>
63                    <span style="color: #000;">
64                        (<?php echo lcfirst($bezlang['cause_type_potential']) ?>)
65                    </span>
66                <?php endif ?>
67
68            <?php if (  $template['action'] !== 'commcause_edit_metadata' ||
69                            $template['kid'] !== $template['commcause']->id): ?>
70                <div class="bez_comment_buttons">
71
72                    <a class="bds_inline_button_noborder"
73                    href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_edit_metadata', 'kid', $template['commcause']->id) ?>#k<?php echo $template['commcause']->id; ?>">Edytuj metadane</a>
74                <?php if (
75                    (!isset($template['no_edit']) || $template['no_edit'] === false) &&
76                    $template['issue']->state === '0' &&
77                    (   ($template['commcause']->type === '0' &&
78                         $template['commcause']->reporter == $this->model->user_nick) ||
79                            $template['issue']->user_is_coordinator())
80                    ): ?>
81
82                    <a class="bez_comment_button"
83                    href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_edit', 'kid', $template['commcause']->id) ?>#k_">
84                        <span class="bez_awesome">&#xf040;</span>
85                    </a>
86                    <?php if ($template['commcause']->tasks_count === 0): ?>
87                    <a class="bez_comment_button bez_commcause_delete_prompt"
88                        data-kid="<?php echo $template['commcause']->id ?>"
89                        href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_delete', 'kid', $template['commcause']->id) ?>">
90                        <span class="bez_awesome">&#xf00d;</span>
91                    </a>
92                    <?php endif ?>
93                <?php endif ?>
94                </div>
95            <?php endif ?>
96
97			</h2>
98			<div class="bez_content
99            <?php if (  $template['action'] === 'commcause_edit_metadata' &&
100                $template['kid'] === $template['commcause']->id) echo 'bez_metadata_edit_warn' ?>">
101                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
102                            $template['kid'] === $template['commcause']->id): ?>
103                    <h1 style="color: #f00; border-bottom: 1px solid #f00; font-size: 15px;"><?php echo $bezlang['metadata_edit_header'] ?></h1>
104
105                <?php endif ?>
106
107				<?php echo $template['commcause']->content_cache; ?>
108
109                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
110                            $template['kid'] === $template['commcause']->id): ?>
111                    <input type="submit" value="<?php echo $bezlang['save'] ?>">&nbsp;&nbsp;
112                    <a href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id).'#k'.$template['commcause']->id ?>"
113                         class="bez_delete_button bez_link_button">
114                            <?php echo $bezlang['cancel'] ?>
115                    </a>
116                <?php endif ?>
117			</div>
118		</div>
119
120		<?php if (isset($template['commcauses_tasks'][$template['commcause']->id])): ?>
121		<div style="margin-top: 10px; margin-left: 40px">
122			<?php foreach ($template['commcauses_tasks'][$template['commcause']->id] as $task): ?>
123				<?php $template['task'] = $task ?>
124				<?php if (	$template['action'] === 'task_edit' &&
125							$template['tid'] === $template['task']->id): ?>
126					<?php include 'task_form.php' ?>
127				<?php else: ?>
128					<?php include 'task_box.php' ?>
129				<?php endif ?>
130			<?php endforeach ?>
131			<?php if ($template['issue']->user_is_coordinator()): ?>
132				<?php if (	$template['action'] === 'task_commcause_add' &&
133							$template['kid'] === $template['commcause']->id): ?>
134					<?php include 'task_form.php' ?>
135				<?php elseif (	(!isset($template['no_edit']) ||
136                                    $template['no_edit'] === false) &&
137                                $template['commcause']->type !== '0' &&
138                              	$template['issue']->full_state() === '0' &&
139								$template['action'] !== 'task_edit'): ?>
140						<div class="bez_second_lv_buttons">
141							<a href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'kid', $template['commcause']->id, 'action', 'task_commcause_add') ?>#z_" class="bez_subscribe_button">
142								<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;
143								<?php if ($template['commcause']->type === '1'): ?>
144									<?php echo $bezlang['corrective_action_add'] ?>
145								<?php else: ?>
146									<?php echo $bezlang['preventive_action_add'] ?>
147								<?php endif ?>
148							</a>
149						</div>
150					<?php endif ?>
151			<?php endif ?>
152		</div>
153		<?php endif ?>
154
155        <?php if (  $template['action'] === 'commcause_edit_metadata' &&
156                        $template['kid'] === $template['commcause']->id): ?>
157            </form>
158        <?php endif ?>
159	</div>
160</div>
161