xref: /plugin/bez/tpl/thread.php (revision f7519ef1d6587610f3d1319f79256a91d679c6e2)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php include "thread_box.php" ?>
3
4<!-- Comments -->
5<div class="bez_comments">
6	<div class="bez_left_col">
7		<!-- Correction -->
8		<div style="margin-top: 10px">
9			<?php foreach ($tpl->get('tasks')['corrections'] as $task): ?>
10				<?php $tpl->set('task', $task) ?>
11				<?php if (	$tpl->param('action') == 'task_edit' &&
12                            $tpl->param('tid') == $task->id): ?>
13					<?php include 'task_form.php' ?>
14				<?php else: ?>
15					<?php include 'task_box.php' ?>
16				<?php endif ?>
17
18			<?php endforeach ?>
19			<?php if (  $tpl->param('action') == 'task_add' &&
20                        $tpl->param('kid') == ''): ?>
21				<?php include 'task_form.php' ?>
22			<?php endif ?>
23		</div>
24
25		<div class="bez_second_lv_buttons" style="margin-top: 10px">
26			<?php if (	$tpl->get('thread')->user_is_coordinator() &&
27                        $tpl->get('thread')->can_add_tasks()): ?>
28				<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'task_add') ?>#z_" class="bez_subscribe_button">
29					<span class="bez_awesome">&#xf0fe;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('correction_add') ?>
30				</a>
31			<?php endif ?>
32			<a href="#" class="bez_subscribe_button bez_hide_comments">
33				<span class="bez_awesome">&#xf070;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('hide_comments') ?>
34			</a>
35			<a href="#" class="bez_subscribe_button bez_show_comments">
36				<span class="bez_awesome">&#xf06e;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('show_comments') ?>
37			</a>
38		</div>
39
40		<?php foreach ($tpl->get('thread_comments') as $thread_comment): ?>
41            <?php $tpl->set('thread_comment', $thread_comment) ?>
42			<?php if (	$tpl->param('action') == 'commcause_edit' &&
43						$tpl->param('kid') == $thread_comment->id): ?>
44				<?php include 'commcause_form.php' ?>
45			<?php else: ?>
46                <?php //$tpl->set('causes_without_tasks') ?>
47				<?php include 'commcause_box.php' ?>
48			<?php endif ?>
49		<?php endforeach ?>
50
51        <?php if ($tpl->get('thread')->state == 'closed'): ?>
52            <div class="plugin__bez_status_label">
53            <span class="icon icon_green">
54                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/tick.svg') ?>
55            </span>
56                <?php printf($tpl->getLang('user_closed_issue'),
57                             '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
58                             $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
59            </div>
60        <?php elseif ($tpl->get('thread')->state == 'rejected'): ?>
61                <div class="plugin__bez_status_label">
62            <span class="icon icon_red">
63                <?php echo inlineSVG(DOKU_PLUGIN . 'bez/images/close.svg') ?>
64            </span>
65                    <?php printf($tpl->getLang('user_rejected_issue'),
66                                 '<strong>' . $tpl->user_name($tpl->get('thread')->closed_by) . '</strong>',
67                                 $tpl->date_fuzzy_age($tpl->get('thread')->close_date)) ?>
68                </div>
69        <?php endif ?>
70
71
72<?php if (	!(strpos($tpl->param('action'), 'task') === 0) &&
73            $tpl->param('action') != 'commcause_edit' &&
74            !(in_array($tpl->get('thread')->state, array('closed', 'rejected')) &&
75                $tpl->get('thread')->acl_of('state') < BEZ_PERMISSION_CHANGE)): ?>
76
77    <?php include 'commcause_form.php' ?>
78
79    <br>
80    <?php if ($tpl->get('thread')->task_count - $tpl->get('thread')->task_count_closed > 0): ?>
81        <div class="info"><?php echo $tpl->getLang('issue_unclosed_tasks' . $tpl->get('lang_suffix')) ?></div>
82    <?php endif ?>
83    <?php if ($tpl->get('thread')->state == 'proposal'): ?>
84        <div class="info"><?php echo $tpl->getLang('issue_is_proposal' . $tpl->get('lang_suffix')) ?></div>
85    <?php endif ?>
86    <?php if ($tpl->get('causes_without_tasks')): ?>
87        <div class="info"><?php echo $tpl->getLang('cause_without_task') ?></div>
88    <?php endif ?>
89    <?php if ($tpl->get('thread')->state == 'opened' && $tpl->get('thread')->task_count == 0): ?>
90        <div class="info"><?php echo $tpl->getLang('issue_no_tasks' . $tpl->get('lang_suffix')) ?></div>
91    <?php endif ?>
92<?php endif ?>
93
94
95</div>
96<div class="bez_right_col">
97
98<div class="bez_box">
99<h2><?php echo $tpl->getLang('comment_last_activity') ?></h2>
100
101<?php echo $tpl->datetime($tpl->get('thread')->last_activity_date) ?>
102
103
104</div>
105
106<div class="bez_box bez_subscribe_box">
107<h2><?php echo $tpl->getLang('norifications') ?></h2>
108<?php if ($tpl->get('thread')->is_subscribent()): ?>
109	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'unsubscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf1f6;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('unsubscribe') ?></a>
110	<p><?php echo $tpl->getLang('subscribed_info' . $tpl->get('lang_suffix')) ?></p>
111<?php else: ?>
112	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'subscribe') ?>" class="bez_subscribe_button"><span class="bez_awesome">&#xf0f3;</span>&nbsp;&nbsp;<?php echo $tpl->getLang('subscribe') ?></a>
113	<p><?php echo $tpl->getLang('not_subscribed_info' . $tpl->get('lang_suffix')) ?></p>
114<?php endif ?>
115
116</div>
117
118<div class="bez_box">
119<h2><?php echo $tpl->getLang('comment_participants') ?></h2>
120<ul id="issue_participants">
121<?php foreach ($tpl->get('thread')->get_participants() as $participant): ?>
122	<li><a href="<?php echo $tpl->mailto($tpl->user_email($participant['user_id']),
123		'#'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
124		$tpl->url('thread', 'id', $tpl->get('thread')->id)) ?>"  title="<?php echo $participant['user_id'] ?>">
125		<span class="bez_name"><?php echo $tpl->user_name($participant['user_id']) ?></span>
126		<span class="bez_icons">
127		<?php if($participant['original_poster']): ?>
128			<span class="bez_awesome"
129				title="<?php echo $tpl->getLang('reporter') ?>">
130				&#xf058;
131			</span>
132		<?php endif ?>
133		<?php if($participant['coordinator']): ?>
134			<span class="bez_awesome"
135				title="<?php echo $tpl->getLang('coordinator') ?>">
136				&#xf0e3;
137			</span>
138		<?php endif ?>
139		<?php if($participant['task_assignee']): ?>
140			<span class="bez_awesome"
141				title="<?php echo $tpl->getLang('executor') ?>">
142				&#xf073;
143			</span>
144		<?php endif ?>
145		<?php if($participant['commentator']): ?>
146			<span class="bez_awesome"
147				title="<?php echo $tpl->getLang('commentator') ?>">
148				&#xf27a;
149			</span>
150		<?php endif ?>
151		<?php if($participant['subscribent']): ?>
152			<span class="bez_awesome"
153				title="<?php echo $tpl->getLang('subscribent') ?>">
154				&#xf0e0;
155			</span>
156		<?php endif ?>
157		</span>
158	</a></li>
159<?php endforeach ?>
160</ul>
161
162<?php if (	$tpl->get('thread')->user_is_coordinator() &&
163            $tpl->get('thread')->can_add_participants()): ?>
164    <h2><?php echo $tpl->getLang('issue_invite_header') ?></h2>
165    <form action="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', 'invite') ?>" method="post" id="bez_invite_users_form">
166    <div id="bez_invite_users" class="ui-widget">
167        <select name="client">
168            <option value="">--- <?php echo $tpl->getLang('select') ?> ---</option>
169            <?php foreach (array_diff_key($tpl->get('users'), $tpl->get('thread')->get_participants('subscribent')) as $user_id => $ignore): ?>
170                <option value="<?php echo $user_id ?>"><?php echo $tpl->user_name($user_id) ?></option>
171            <?php endforeach ?>
172        </select>
173    </div>
174    <button class="bez_subscribe_button"><?php echo $tpl->getLang('issue_invite_button') ?></button>
175    </form>
176<?php endif ?>
177
178
179</div>
180
181
182</div>
183
184