xref: /plugin/bez/tpl/commcause_box.php (revision c45b82bd7652392a33a65dbf693208bcdf28ad29)
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			<h2>
21				<strong><?php echo $this->model->users->get_user_full_name($template['commcause']->reporter) ?></strong>
22                <?php if ($template['commcause']->type > 0): ?>
23				    <?php echo $bezlang['cause_added'] ?>
24                <?php else: ?>
25                    <?php echo $bezlang['comment_added'] ?>
26                <?php endif ?>
27				<?php echo $template['commcause']->date_format($template['commcause']->datetime) ?>
28
29                <?php if ($template['commcause']->type === '1'): ?>
30                    <span style="color: #000;">
31                        (<?php echo lcfirst($bezlang['cause_type_default']) ?>)
32                    </span>
33                <?php elseif ($template['commcause']->type === '2'): ?>
34                    <span style="color: #000;">
35                        (<?php echo lcfirst($bezlang['cause_type_potential']) ?>)
36                    </span>
37                <?php endif ?>
38
39			<div class="bez_comment_buttons">
40			<?php if (
41                (!isset($template['no_edit']) || $template['no_edit'] === false) &&
42                $template['issue']->state === '0' &&
43                (   ($template['commcause']->type === '0' &&
44                     $template['commcause']->reporter == $this->model->user_nick) ||
45						$template['issue']->user_is_coordinator())
46				): ?>
47
48				<a class="bez_comment_button"
49				href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_edit', 'kid', $template['commcause']->id) ?>#k_">
50					<span class="bez_awesome">&#xf040;</span>
51				</a>
52                <?php if ($template['commcause']->tasks_count === 0): ?>
53				<a class="bez_comment_button bez_commcause_delete_prompt"
54					data-kid="<?php echo $template['commcause']->id ?>"
55					href="?id=<?php echo $this->id('issue', 'id', $template['issue']->id, 'action', 'commcause_delete', 'kid', $template['commcause']->id) ?>">
56					<span class="bez_awesome">&#xf00d;</span>
57				</a>
58                <?php endif ?>
59			<?php endif ?>
60			</div>
61
62			</h2>
63			<div class="bez_content">
64				<?php echo $template['commcause']->content_cache; ?>
65			</div>
66		</div>
67
68		<?php if (isset($template['commcauses_tasks'][$template['commcause']->id])): ?>
69		<div style="margin-top: 10px; margin-left: 40px">
70			<?php foreach ($template['commcauses_tasks'][$template['commcause']->id] as $task): ?>
71				<?php $template['task'] = $task ?>
72				<?php if (	$template['action'] === 'task_edit' &&
73							$template['tid'] === $template['task']->id): ?>
74					<?php include 'task_form.php' ?>
75				<?php else: ?>
76					<?php include 'task_box.php' ?>
77				<?php endif ?>
78			<?php endforeach ?>
79			<?php if ($template['issue']->user_is_coordinator()): ?>
80				<?php if (	$template['action'] === 'task_commcause_add' &&
81							$template['kid'] === $template['commcause']->id): ?>
82					<?php include 'task_form.php' ?>
83				<?php elseif (	(!isset($template['no_edit']) ||
84                                    $template['no_edit'] === false) &&
85                                $template['commcause']->type !== '0' &&
86                              	$template['issue']->full_state() === '0' &&
87								$template['action'] !== 'task_edit'): ?>
88						<div class="bez_second_lv_buttons">
89							<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">
90								<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;
91								<?php if ($template['commcause']->type === '1'): ?>
92									<?php echo $bezlang['corrective_action_add'] ?>
93								<?php else: ?>
94									<?php echo $bezlang['preventive_action_add'] ?>
95								<?php endif ?>
96							</a>
97						</div>
98					<?php endif ?>
99			<?php endif ?>
100		</div>
101		<?php endif ?>
102	</div>
103</div>
104