xref: /plugin/bez/tpl/commcause_box.php (revision 8a6381983135ed7de69b33e64aa0c1b16dbf69b0)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<a id="k<?php echo $tpl->get('thread_comment')->id ?>"></a>
3<div class="bez_comment
4	<?php echo $tpl->get('thread_comment')->type == 'comment' ? 'bez_type_0' : 'bez_cause' ?>
5	<?php
6		if ($tpl->get('thread_comment')->author == $tpl->current_user()) {
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 $tpl->user_name($tpl->get('thread_comment')->author) ?></strong>
22
23
24                <?php if ($tpl->get('thread_comment')->type == 'comment'): ?>
25                    <?php echo $tpl->getLang('comment_added') ?>
26                <?php else: ?>
27                    <?php echo $tpl->getLang('cause_added') ?>
28                <?php endif ?>
29
30                <?php echo dformat(strtotime($tpl->get('thread_comment')->create_date), '%Y-%m-%d %H:%M') ?>
31
32                <?php if ($tpl->get('thread_comment')->type == 'cause_real'): ?>
33                    <span style="color: #000;">
34                        (<?php echo lcfirst($tpl->getLang('cause_type_default')) ?>)
35                    </span>
36                <?php elseif ($tpl->get('thread_comment')->type == 'cause_potential'): ?>
37                    <span style="color: #000;">
38                        (<?php echo lcfirst($tpl->getLang('cause_type_potential')) ?>)
39                    </span>
40                <?php endif ?>
41
42                <?php if ($tpl->param('kid') != $tpl->get('thread_comment')->id): ?>
43                    <div class="bez_comment_buttons">
44                        <?php if (
45                            ($tpl->get('no_edit') == '') &&
46                             $tpl->get('thread')->state == 'opened' &&
47                             (($tpl->get('thread_comment')->type == 'comment' &&
48                                     $tpl->get('thread_comment')->author == $tpl->current_user()) ||
49                                 $tpl->get('thread')->user_is_coordinator())
50                        ): ?>
51
52                            <a class="bez_comment_button"
53                               href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'commcause_edit', 'kid', $tpl->get('thread_comment')->id) ?>#k_">
54                                <span class="bez_awesome">&#xf040;</span>
55                            </a>
56                            <?php if ($tpl->get('thread_comment')->task_count == '0'): ?>
57                                <a class="bez_comment_button bez_commcause_delete_prompt"
58                                   data-kid="<?php echo $tpl->get('thread_comment')->id ?>"
59                                   href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'commcause_delete', 'kid', $tpl->get('thread_comment')->id) ?>">
60                                    <span class="bez_awesome">&#xf00d;</span>
61                                </a>
62                            <?php endif ?>
63                        <?php endif ?>
64                    </div>
65                <?php endif ?>
66			</h2>
67			<div class="bez_content">
68				<?php echo $tpl->get('thread_comment')->content_html; ?>
69            </div>
70		</div>
71
72		<?php if (false): ?>
73		<div style="margin-top: 10px; margin-left: 40px">
74			<?php foreach ($template['commcauses_tasks'][$template['commcause']->id] as $task): ?>
75				<?php $template['task'] = $task ?>
76				<?php if (	$template['action'] === 'task_edit' &&
77							$template['tid'] === $template['task']->id): ?>
78					<?php include 'task_form.php' ?>
79				<?php else: ?>
80					<?php include 'task_box.php' ?>
81				<?php endif ?>
82			<?php endforeach ?>
83			<?php if ($template['issue']->user_is_coordinator()): ?>
84				<?php if (	$template['action'] === 'task_commcause_add' &&
85							$template['kid'] === $template['commcause']->id): ?>
86					<?php include 'task_form.php' ?>
87				<?php elseif (	(!isset($template['no_edit']) ||
88                                    $template['no_edit'] === false) &&
89                                $template['commcause']->type !== 'comment' &&
90                              	$template['issue']->full_state() === '0' &&
91								$template['action'] !== 'task_edit'): ?>
92						<div class="bez_second_lv_buttons">
93							<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">
94								<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;
95								<?php if ($template['commcause']->type === '1'): ?>
96									<?php echo $bezlang['corrective_action_add'] ?>
97								<?php else: ?>
98									<?php echo $bezlang['preventive_action_add'] ?>
99								<?php endif ?>
100							</a>
101						</div>
102					<?php endif ?>
103			<?php endif ?>
104		</div>
105		<?php endif ?>
106
107	</div>
108</div>
109