1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<?php $D = 2 ?>
3<?php if (count($tpl->get('8d_tasks')['correction']) > 0) $D++ ?>
4<?php if (count($tpl->get('causes')) > 0) $D++ ?>
5<?php if (count($tpl->get('8d_tasks')['corrective']) > 0) $D++ ?>
6<?php if (count($tpl->get('risks')) > 0 || count($tpl->get('opportunities')) > 0) $D++ ?>
7<?php if (count($tpl->get('8d_tasks')['preventive']) > 0) $D++ ?>
8<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected') $D++ ?>
9
10<h1>
11	<?php printf($tpl->getLang('8d_report_header'), $D); ?>
12	<span id="bez_8d_send_button">[<a href="
13		<?php echo $tpl->mailto('',
14   $tpl->getLang('8d_report').': #'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
15            $tpl->url('8d', 'id', $tpl->get('thread')->id) . '?t=' . $_GET['t']) ?>">
16<?php echo $tpl->getLang('send_mail') ?>
17	</a>]</span>
18</h1>
19
20<table>
21<tr>
22	<td>
23		 <strong>
24		 	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id) ?>">
25				#<?php echo  $tpl->get('thread')->id ?>
26			</a>
27		</strong>
28        <?php if (!empty($tpl->get('thread')->label_name)): ?>
29            <?php echo $tpl->get('thread')->label_name ?>
30        <?php else: ?>
31            <i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
32        <?php endif ?>
33	</td>
34
35	<td>
36		<strong><?php echo $tpl->getLang('open_date') ?>:</strong>
37        <?php echo $tpl->date($tpl->get('thread')->create_date) ?>
38	</td>
39</tr>
40
41	<tr>
42	<td colspan="2">
43		<strong><?php echo $tpl->getLang('title') ?>:</strong>
44		<?php echo  $tpl->get('thread')->title ?>
45	</td>
46</tr>
47</table>
48<?php $D = 1 ?>
49<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('1d') ?></h2>
50<ul>
51	<?php foreach($tpl->get('thread')->get_participants() as $participant): ?>
52		<li><?php echo $tpl->user_name($participant['user_id']) ?></li>
53	<?php endforeach ?>
54</ul>
55
56<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('2d') ?></h2>
57<?php echo $tpl->get('thread')->content_html ?>
58
59<?php if (count($tpl->get('8d_tasks')['correction']) > 0): ?>
60    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('3d') ?></h2>
61    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['correction']) ?>
62    <?php include '8d_tasks.php' ?>
63<?php endif ?>
64
65<?php if (count($tpl->get('causes')) > 0): ?>
66    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('4d') ?></h2>
67    <?php $tpl->set('causes', $tpl->get('causes')) ?>
68    <?php include '8d_causes.php' ?>
69<?php endif ?>
70
71<?php if (count($tpl->get('8d_tasks')['corrective']) > 0): ?>
72    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('5d') ?></h2>
73    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['corrective']) ?>
74    <?php include '8d_tasks.php' ?>
75<?php endif ?>
76
77<?php if (count($tpl->get('risks')) > 0 || count($tpl->get('opportunities')) > 0): ?>
78    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('6d') ?></h2>
79    <?php if (count($tpl->get('risks')) > 0): ?>
80        <h3><?php echo $tpl->getLang('risks') ?></h3>
81        <?php $tpl->set('causes', $tpl->get('risks')) ?>
82        <?php include '8d_causes.php' ?>
83    <?php endif ?>
84    <?php if (count($tpl->get('opportunities')) > 0): ?>
85        <h3><?php echo $tpl->getLang('opportunities') ?></h3>
86        <?php $tpl->set('causes', $tpl->get('opportunities')) ?>
87        <?php include '8d_causes.php' ?>
88    <?php endif ?>
89<?php endif ?>
90
91<?php if (count($tpl->get('8d_tasks')['preventive']) > 0): ?>
92    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('7d') ?></h2>
93    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['preventive']) ?>
94    <?php include '8d_tasks.php' ?>
95<?php endif ?>
96
97
98<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected'): ?>
99    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('8d') ?></h2>
100    <?php echo  $tpl->get('thread')->closing_comment() ?>
101    <table>
102        <tr>
103            <td>
104                <strong><?php echo $tpl->getLang('true_date') ?>:</strong>
105                <?php echo $tpl->date($tpl->get('thread')->close_date) ?>
106            </td>
107            <td>
108                <strong><?php echo $tpl->getLang('state') ?>:</strong>
109                <?php echo $tpl->getLang('state_' . $tpl->get('thread')->state) ?>
110            </td>
111        </tr>
112
113        <tr>
114            <td>
115                <strong><?php echo $tpl->getLang('totalcost') ?>:</strong>
116                <?php if ($tpl->get('thread')->task_sum_cost != ''): ?>
117                    <?php echo $tpl->get('thread')->task_sum_cost ?>
118                <?php else: ?>
119                    <em>---</em>
120                <?php endif ?>
121            </td>
122            <td>
123                <strong><?php echo $tpl->getLang('coordinator') ?>:</strong>
124                <?php echo $tpl->user_name($tpl->get('thread')->coordinator) ?>
125            </td>
126        </tr>
127    </table>
128<?php endif ?>
129