xref: /plugin/bez/tpl/task_box.php (revision e09b232ffd94bc38ec04930c9ddc745874b0ba41)
1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2
3<div id="z<?php echo $tpl->get('task')->id ?>"
4	class="bez_task
5    <?php
6        if($tpl->get('task')->state == 'opened') {
7            echo 'priority_' . $tpl->get('task')->priority;
8        }
9    ?>">
10
11<div class="timebox">
12    <span>
13        <strong><?php echo $tpl->getLang('open') ?>:</strong>
14        <?php echo $tpl->date($tpl->get('task')->create_date) ?>
15    </span>
16
17	<?php if ($tpl->get('task')->state != 'opened'): ?>
18
19        <span>
20            <strong><?php echo $tpl->getLang('task_' . $tpl->get('task')->state) ?>:</strong>
21            <?php echo $tpl->date($tpl->get('task')->close_date) ?>
22        </span>
23
24		<span>
25			<strong><?php echo $tpl->getLang('report_priority') ?>: </strong>
26            <?php echo $tpl->date_diff_days($tpl->get('task')->create_date, $tpl->get('task')->close_date, '%a'); ?>
27		</span>
28	<?php endif ?>
29</div>
30
31<h2>
32	<a href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>">
33		#z<?php echo $tpl->get('task')->id ?>
34	</a>
35    <?php if ($tpl->get('task')->thread_id != '' && $tpl->get('task')->thread->type != 'project'): ?>
36	    <?php echo lcfirst($tpl->getLang('task_type_' . $tpl->get('task')->type)) ?>
37    <?php endif ?>
38	(<?php echo lcfirst($tpl->getLang('task_' . $tpl->get('task')->state)) ?>)
39</h2>
40
41<table class="data">
42<tr>
43    <th><?php echo $tpl->getLang('reporter') ?>:</th>
44    <td>
45        <?php echo $tpl->user_name($tpl->get('task')->original_poster) ?>
46    </td>
47
48    <th><?php echo $tpl->getLang('executor') ?>:</th>
49    <td><?php echo $tpl->user_name($tpl->get('task')->assignee) ?></td>
50</tr>
51
52<tr>
53    <th style="white-space: nowrap;"><?php echo $tpl->getLang('plan_date') ?>:</th>
54    <td>
55        <?php echo $tpl->get('task')->plan_date ?><?php if ($tpl->get('task')->all_day_event == '0'): ?>,
56            <?php echo $tpl->get('task')->start_time ?> - <?php echo $tpl->get('task')->finish_time ?>
57        <?php endif ?>
58    </td>
59
60    <th><?php echo $tpl->getLang('task_type') ?>:</th>
61    <td>
62    <?php if ($tpl->get('task')->task_program_id == ''): ?>
63        ---
64    <?php else: ?>
65        <?php echo $tpl->get('task')->task_program_name ?>
66    <?php endif ?>
67    </td>
68</tr>
69
70<tr>
71    <th><?php echo $tpl->getLang('cost') ?>:</th>
72    <td colspan="3">
73    <?php if ($tpl->get('task')->cost == ''): ?>
74        ---
75    <?php else: ?>
76        <?php echo $tpl->get('task')->cost ?>
77    <?php endif ?>
78    </td>
79</tr>
80
81</table>
82
83<?php echo $tpl->get('task')->content_html ?>
84<?php if (!$tpl->get('no_actions')): ?>
85    <div class="bez_buttons">
86        <?php if ($tpl->get('task')->acl_of('state') >= BEZ_PERMISSION_CHANGE): ?>
87            <a class="bds_inline_button"
88               id="plugin__bez_do_task_button"
89               href="<?php echo $tpl->url('task', 'tid', $tpl->get('task')->id) ?>#zk_">
90                <?php if ($tpl->get('task')->state == 'opened'): ?>
91<?php echo $tpl->getLang('js')['do_task'] ?>
92                <?php else: ?>
93<?php echo $tpl->getLang('js')['reopen_task'] ?>
94                <?php endif?>
95            </a>
96        <?php endif ?>
97
98        <?php if (count($tpl->get('task')->changable_fields(
99                array('content', 'plan_date', 'all_day_event', 'start_time', 'finish_time', 'task_program_id', 'cost')
100            )) > 0): ?>
101                <a class="bds_inline_button"
102                    href="<?php
103                        if ($tpl->action() == 'thread') {
104                            echo $tpl->url('thread', 'id', $tpl->get('thread')->id, 'tid', $tpl->get('task')->id, 'action', 'task_edit');
105                        } else {
106                            echo $tpl->url('task', 'tid', $tpl->get('task')->id, 'action', 'task_edit');
107                        }
108                    ?>#z_">
109<?php echo $tpl->getLang('edit') ?>
110                </a>
111        <?php endif ?>
112
113        <a class="bds_inline_button" href="
114        <?php echo $tpl->mailto($tpl->user_email($tpl->get('task')->assignee),
115        '#z'.$tpl->get('task')->id,
116        $tpl->url('task', 'tid', $tpl->get('task')->id)) ?>">
117<?php echo $tpl->getLang('send_mail') ?>
118        </a>
119
120        <?php if ($tpl->get('task')->task_program_id != '' &&
121                  $tpl->factory('task')->permission() >= BEZ_TABLE_PERMISSION_INSERT): ?>
122            <a class="bds_inline_button"
123                    href="<?php echo $tpl->url('task_form', 'duplicate', $tpl->get('task')->id, 'task_program_id', $tpl->get('task')->task_program_id) ?>">
124<?php echo $tpl->getLang('duplicate') ?>
125            </a>
126        <?php endif ?>
127	</div>
128<?php endif ?>
129
130</div>