xref: /plugin/bez/tpl/commcause_box.php (revision ff14b1073c2dab2f863cab3b8baf8b1a01f7993a)
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                <a href="#k<?php echo $tpl->get('thread_comment')->id ?>">#k<?php echo $tpl->get('thread_comment')->id ?></a>
22                <strong><?php echo $tpl->user_name($tpl->get('thread_comment')->author) ?></strong>
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                <?php echo $tpl->datetime($tpl->get('thread_comment')->create_date) ?>
30
31                <?php if (strpos($tpl->get('thread_comment')->type, 'cause') === 0): ?>
32                    <span style="color: #000;">
33                        (<?php echo $tpl->getLang($tpl->get('thread_comment')->type) ?>)
34                    </span>
35                <?php endif ?>
36
37                <?php if ($tpl->param('kid') != $tpl->get('thread_comment')->id): ?>
38                    <div class="bez_comment_buttons">
39                        <?php if (
40                             $tpl->get('thread')->state == 'opened' &&
41                             (($tpl->get('thread_comment')->type == 'comment' &&
42                                     $tpl->get('thread_comment')->author == $tpl->current_user()) ||
43                                 $tpl->get('thread')->user_is_coordinator())
44                        ): ?>
45
46                            <a class="bez_comment_button"
47                               href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'commcause_edit', 'kid', $tpl->get('thread_comment')->id) ?>#k_">
48                                <span class="bez_awesome">&#xf040;</span>
49                            </a>
50                            <?php if ($tpl->get('thread_comment')->task_count == '0'): ?>
51                                <a class="bez_comment_button bez_commcause_delete_prompt"
52                                   data-kid="<?php echo $tpl->get('thread_comment')->id ?>"
53                                   href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'commcause_delete', 'kid', $tpl->get('thread_comment')->id) ?>">
54                                    <span class="bez_awesome">&#xf00d;</span>
55                                </a>
56                            <?php endif ?>
57                        <?php endif ?>
58                    </div>
59                <?php endif ?>
60			</h2>
61			<div class="bez_content">
62				<?php echo $tpl->get('thread_comment')->content_html; ?>
63            </div>
64		</div>
65
66		<?php if (strpos($tpl->get('thread_comment')->type, 'cause') === 0): ?>
67        <?php if ($tpl->get('tasks ' . $tpl->get('thread_comment')->id) == '')
68            $tpl->set('causes_without_tasks', true) ?>
69		<div style="margin-top: 10px; margin-left: 40px">
70			<?php foreach ($tpl->get('tasks ' . $tpl->get('thread_comment')->id, array()) as $task): ?>
71				<?php $tpl->set('task', $task) ?>
72				<?php if (	$tpl->param('action') == 'task_edit' &&
73                            $tpl->param('tid') == $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 ($tpl->get('thread')->user_is_coordinator()): ?>
80				<?php if (	$tpl->param('action') == 'task_add' &&
81                            $tpl->param('kid') == $tpl->get('thread_comment')->id): ?>
82					<?php include 'task_form.php' ?>
83				<?php elseif (	$tpl->get('thread_comment')->type != 'comment' &&
84                                $tpl->get('thread')->state == 'opened' &&
85                                $tpl->param('action') != 'task_edit'): ?>
86						<div class="bez_second_lv_buttons">
87							<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'kid', $tpl->get('thread_comment')->id, 'action', 'task_add') ?>#z_" class="bez_subscribe_button">
88								<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;
89								<?php if ($tpl->get('thread_comment')->type == 'cause_real'): ?>
90									<?php echo $tpl->getLang('corrective_action_add') ?>
91								<?php else: ?>
92									<?php echo $tpl->getLang('preventive_action_add') ?>
93								<?php endif ?>
94							</a>
95						</div>
96					<?php endif ?>
97			<?php endif ?>
98		</div>
99		<?php endif ?>
100
101	</div>
102</div>
103