xref: /plugin/bez/tpl/commcause_box.php (revision fe5d6d1ebd253c129098b67fff8cf438a54d8650)
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}):(\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                    <?php if (count($template['commcause']->changable_fields($template['commcause']->get_meta_fields())) > 0): ?>
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 endif ?>
75                <?php if (
76                    (!isset($template['no_edit']) || $template['no_edit'] === false) &&
77                    $template['issue']->state === '0' &&
78                    (   ($template['commcause']->type === '0' &&
79                         $template['commcause']->reporter == $this->model->user_nick) ||
80                            $template['issue']->user_is_coordinator())
81                    ): ?>
82
83                    <a class="bez_comment_button"
84                    href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_edit', 'kid', $template['commcause']->id) ?>#k_">
85                        <span class="bez_awesome">&#xf040;</span>
86                    </a>
87                    <?php if ($template['commcause']->tasks_count === 0): ?>
88                    <a class="bez_comment_button bez_commcause_delete_prompt"
89                        data-kid="<?php echo $template['commcause']->id ?>"
90                        href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_delete', 'kid', $template['commcause']->id) ?>">
91                        <span class="bez_awesome">&#xf00d;</span>
92                    </a>
93                    <?php endif ?>
94                <?php endif ?>
95                </div>
96            <?php endif ?>
97
98			</h2>
99			<div class="bez_content
100            <?php if (  $template['action'] === 'commcause_edit_metadata' &&
101                $template['kid'] === $template['commcause']->id) echo 'bez_metadata_edit_warn' ?>">
102                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
103                            $template['kid'] === $template['commcause']->id): ?>
104                    <h1 style="color: #f00; border-bottom: 1px solid #f00; font-size: 15px;"><?php echo $bezlang['metadata_edit_header'] ?></h1>
105
106                <?php endif ?>
107
108				<?php echo $template['commcause']->content_cache; ?>
109
110                <?php if (  $template['action'] === 'commcause_edit_metadata' &&
111                            $template['kid'] === $template['commcause']->id): ?>
112                    <input type="submit" value="<?php echo $bezlang['save'] ?>">&nbsp;&nbsp;
113                    <a href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id).'#k'.$template['commcause']->id ?>"
114                         class="bez_delete_button bez_link_button">
115                            <?php echo $bezlang['cancel'] ?>
116                    </a>
117                <?php endif ?>
118			</div>
119		</div>
120
121		<?php if (isset($template['commcauses_tasks'][$template['commcause']->id])): ?>
122		<div style="margin-top: 10px; margin-left: 40px">
123			<?php foreach ($template['commcauses_tasks'][$template['commcause']->id] as $task): ?>
124				<?php $template['task'] = $task ?>
125				<?php if (	$template['action'] === 'task_edit' &&
126							$template['tid'] === $template['task']->id): ?>
127					<?php include 'task_form.php' ?>
128				<?php else: ?>
129					<?php include 'task_box.php' ?>
130				<?php endif ?>
131			<?php endforeach ?>
132			<?php if ($template['issue']->user_is_coordinator()): ?>
133				<?php if (	$template['action'] === 'task_commcause_add' &&
134							$template['kid'] === $template['commcause']->id): ?>
135					<?php include 'task_form.php' ?>
136				<?php elseif (	(!isset($template['no_edit']) ||
137                                    $template['no_edit'] === false) &&
138                                $template['commcause']->type !== '0' &&
139                              	$template['issue']->full_state() === '0' &&
140								$template['action'] !== 'task_edit'): ?>
141						<div class="bez_second_lv_buttons">
142							<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">
143								<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;
144								<?php if ($template['commcause']->type === '1'): ?>
145									<?php echo $bezlang['corrective_action_add'] ?>
146								<?php else: ?>
147									<?php echo $bezlang['preventive_action_add'] ?>
148								<?php endif ?>
149							</a>
150						</div>
151					<?php endif ?>
152			<?php endif ?>
153		</div>
154		<?php endif ?>
155
156        <?php if (  $template['action'] === 'commcause_edit_metadata' &&
157                        $template['kid'] === $template['commcause']->id): ?>
158            </form>
159        <?php endif ?>
160	</div>
161</div>
162