xref: /plugin/bez/tpl/8d.php (revision bbd438ce52d241ea42077a932c307ea787417c14)
1e8827d73SSzymon Olewniczak<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2c8bd19cbSSzymon Olewniczak<?php $D = 2 ?>
3c8bd19cbSSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['correction']) > 0) $D++ ?>
479fbde34SSzymon Olewniczak<?php if (count($tpl->get('causes')) > 0) $D++ ?>
5c8bd19cbSSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['corrective']) > 0) $D++ ?>
6a12aad5cSSzymon Olewniczak<?php $corrective_done = array_filter($tpl->get('8d_tasks')['corrective'], function ($task) {
7a12aad5cSSzymon Olewniczak    return $task->state == 'done';
8a12aad5cSSzymon Olewniczak}) ?>
9b4ea6b2fSSzymon Olewniczak<?php if (count($corrective_done) > 0) $D++ ?>
10c8bd19cbSSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['preventive']) > 0) $D++ ?>
111fad0229SSzymon Olewniczak<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected') $D++ ?>
12c8bd19cbSSzymon Olewniczak
13e8fc7594Sghi<h1>
14c8bd19cbSSzymon Olewniczak    <?php printf($tpl->getLang('8d_report_header'), $D); ?>
15e8fc7594Sghi	<span id="bez_8d_send_button">[<a href="
16e8827d73SSzymon Olewniczak		<?php echo $tpl->mailto('',
17e8827d73SSzymon Olewniczak   $tpl->getLang('8d_report').': #'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
182467512fSSzymon Olewniczak            $tpl->url('8d', 'id', $tpl->get('thread')->id) . '?t=' . $_GET['t']) ?>">
19e8827d73SSzymon Olewniczak<?php echo $tpl->getLang('send_mail') ?>
20e8fc7594Sghi	</a>]</span>
21e8fc7594Sghi</h1>
22f2f5b3feSghi
23f2f5b3feSghi<table>
24f2f5b3feSghi<tr>
25f2f5b3feSghi	<td>
2638ce6055Sghi		 <strong>
27e8827d73SSzymon Olewniczak		 	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id) ?>">
28e8827d73SSzymon Olewniczak				#<?php echo  $tpl->get('thread')->id ?>
2938ce6055Sghi			</a>
3038ce6055Sghi		</strong>
31e8827d73SSzymon Olewniczak        <?php if (!empty($tpl->get('thread')->label_name)): ?>
32e8827d73SSzymon Olewniczak            <?php echo $tpl->get('thread')->label_name ?>
33e8827d73SSzymon Olewniczak        <?php else: ?>
34e8827d73SSzymon Olewniczak            <i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
35e8827d73SSzymon Olewniczak        <?php endif ?>
36f2f5b3feSghi	</td>
37f2f5b3feSghi
38f2f5b3feSghi	<td>
39e8827d73SSzymon Olewniczak		<strong><?php echo $tpl->getLang('open_date') ?>:</strong>
40ff14b107SSzymon Olewniczak        <?php echo $tpl->date($tpl->get('thread')->create_date) ?>
41f2f5b3feSghi	</td>
42f2f5b3feSghi</tr>
43f2f5b3feSghi
44f2f5b3feSghi	<tr>
459fbfe943Sghi	<td colspan="2">
46e8827d73SSzymon Olewniczak		<strong><?php echo $tpl->getLang('title') ?>:</strong>
47e8827d73SSzymon Olewniczak		<?php echo  $tpl->get('thread')->title ?>
48f2f5b3feSghi	</td>
49f2f5b3feSghi</tr>
50f2f5b3feSghi</table>
51e2b0e8caSSzymon Olewniczak<?php $D = 1 ?>
52e8827d73SSzymon Olewniczak<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('1d') ?></h2>
5366b54849Sghi<ul>
54e8827d73SSzymon Olewniczak	<?php foreach($tpl->get('thread')->get_participants() as $participant): ?>
55e8827d73SSzymon Olewniczak		<li><?php echo $tpl->user_name($participant['user_id']) ?></li>
5666b54849Sghi	<?php endforeach ?>
5766b54849Sghi</ul>
58f2f5b3feSghi
59e8827d73SSzymon Olewniczak<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('2d') ?></h2>
60e8827d73SSzymon Olewniczak<?php echo $tpl->get('thread')->content_html ?>
61f2f5b3feSghi
62e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['correction']) > 0): ?>
63e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('3d') ?></h2>
64e8827d73SSzymon Olewniczak    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['correction']) ?>
6544189046SSzymon Olewniczak    <?php include '8d_tasks.php' ?>
66e2b0e8caSSzymon Olewniczak<?php endif ?>
67683e6b20Sghi
6879fbde34SSzymon Olewniczak<?php if (count($tpl->get('causes')) > 0): ?>
69e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('4d') ?></h2>
7079fbde34SSzymon Olewniczak    <?php $tpl->set('causes', $tpl->get('causes')) ?>
7144189046SSzymon Olewniczak    <?php include '8d_causes.php' ?>
72e2b0e8caSSzymon Olewniczak<?php endif ?>
7338ce6055Sghi
74e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['corrective']) > 0): ?>
75e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('5d') ?></h2>
76620500d9SSzymon Olewniczak    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['corrective']) ?>
775f6fbd70SSzymon Olewniczak    <?php include '8d_tasks.php' ?>
78620500d9SSzymon Olewniczak<?php endif ?>
79f2f5b3feSghi
805f6fbd70SSzymon Olewniczak<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected'): ?>
81620500d9SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('6d-var2') ?></h2>
825f6fbd70SSzymon Olewniczak    <?php echo  $tpl->get('thread')->closing_comment() ?>
837d2577fbSSzymon Olewniczak<?php endif ?>
84f2f5b3feSghi
85e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['preventive']) > 0): ?>
86e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('7d') ?></h2>
87a12aad5cSSzymon Olewniczak    <?php $preventive = array_merge($tpl->get('risks'), $tpl->get('opportunities')) ?>
88a12aad5cSSzymon Olewniczak    <?php usort($preventive, function ($a, $b) {
89a12aad5cSSzymon Olewniczak        return $a->id > $b->id;
90a12aad5cSSzymon Olewniczak    }); ?>
91a12aad5cSSzymon Olewniczak    <?php $tpl->set('causes', $preventive) ?>
92a12aad5cSSzymon Olewniczak    <?php include '8d_causes.php' ?>
93a12aad5cSSzymon Olewniczak
94e8827d73SSzymon Olewniczak    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['preventive']) ?>
9544189046SSzymon Olewniczak    <?php include '8d_tasks.php' ?>
96e2b0e8caSSzymon Olewniczak<?php endif ?>
970e31399aSSzymon Olewniczak
98e2b0e8caSSzymon Olewniczak
99bf67f2caSSzymon Olewniczak<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('8d') ?></h2>
1005f6fbd70SSzymon Olewniczak
101bf67f2caSSzymon Olewniczak<table>
102bf67f2caSSzymon Olewniczak    <tr>
103*bbd438ceSSzymon Olewniczak        <td <?php if (count($tpl->get('8d_tasks')['preventive']) == 0) echo 'colspan="2"' ?>>
10459258bb3SSzymon Olewniczak            <strong><?php echo $tpl->getLang('problem_close_date') ?>:</strong>
1055f6fbd70SSzymon Olewniczak            <?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected'): ?>
106bf67f2caSSzymon Olewniczak                <?php echo $tpl->date($tpl->get('thread')->close_date) ?>
1075f6fbd70SSzymon Olewniczak            <?php else: ?>
1085f6fbd70SSzymon Olewniczak                ---
1095f6fbd70SSzymon Olewniczak            <?php endif ?>
110bf67f2caSSzymon Olewniczak        </td>
111*bbd438ceSSzymon Olewniczak        <?php if (count($tpl->get('8d_tasks')['preventive']) > 0): ?>
112bf67f2caSSzymon Olewniczak            <td>
11359258bb3SSzymon Olewniczak                <strong><?php echo $tpl->getLang('preventive_close_date') ?>:</strong>
11459258bb3SSzymon Olewniczak                <?php if ($tpl->get('preventive_close_date')): ?>
11559258bb3SSzymon Olewniczak                    <?php echo $tpl->get('preventive_close_date') ?>
11659258bb3SSzymon Olewniczak                <?php else: ?>
11759258bb3SSzymon Olewniczak                    ---
11859258bb3SSzymon Olewniczak                <?php endif ?>
119bf67f2caSSzymon Olewniczak            </td>
120*bbd438ceSSzymon Olewniczak        <?php endif ?>
121bf67f2caSSzymon Olewniczak    </tr>
122bf67f2caSSzymon Olewniczak
123bf67f2caSSzymon Olewniczak    <tr>
124bf67f2caSSzymon Olewniczak        <td>
125bf67f2caSSzymon Olewniczak            <strong><?php echo $tpl->getLang('totalcost') ?>:</strong>
126bf67f2caSSzymon Olewniczak            <?php if ($tpl->get('thread')->task_sum_cost != ''): ?>
127bf67f2caSSzymon Olewniczak                <?php echo $tpl->get('thread')->task_sum_cost ?>
128bf67f2caSSzymon Olewniczak            <?php else: ?>
129bf67f2caSSzymon Olewniczak                <em>---</em>
130bf67f2caSSzymon Olewniczak            <?php endif ?>
131bf67f2caSSzymon Olewniczak        </td>
132bf67f2caSSzymon Olewniczak        <td>
133bf67f2caSSzymon Olewniczak            <strong><?php echo $tpl->getLang('coordinator') ?>:</strong>
134bf67f2caSSzymon Olewniczak            <?php echo $tpl->user_name($tpl->get('thread')->coordinator) ?>
135bf67f2caSSzymon Olewniczak        </td>
136bf67f2caSSzymon Olewniczak    </tr>
137bf67f2caSSzymon Olewniczak</table>
138