xref: /plugin/bez/tpl/8d.php (revision a12aad5c094bf7c7a76744afffe21cd05fc32e00)
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++ ?>
6*a12aad5cSSzymon Olewniczak<?php $corrective_done = array_filter($tpl->get('8d_tasks')['corrective'], function ($task) {
7*a12aad5cSSzymon Olewniczak    return $task->state == 'done';
8*a12aad5cSSzymon Olewniczak}) ?>
9*a12aad5cSSzymon Olewniczak<?php if (($tpl->get('variant') == 2 && count($corrective_done) > 0) ||
10*a12aad5cSSzymon Olewniczak    ($tpl->get('variant') == 1 && (count($tpl->get('risks')) > 0 || count($tpl->get('opportunities')) > 0))) $D++ ?>
11c8bd19cbSSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['preventive']) > 0) $D++ ?>
121fad0229SSzymon Olewniczak<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected') $D++ ?>
13c8bd19cbSSzymon Olewniczak
14e8fc7594Sghi<h1>
15620500d9SSzymon Olewniczak    <?php if ($tpl->get('variant') == 2): ?>
16c8bd19cbSSzymon Olewniczak	    <?php printf($tpl->getLang('8d_report_header'), $D); ?>
17620500d9SSzymon Olewniczak    <?php else: ?>
18620500d9SSzymon Olewniczak        <?php echo $tpl->getLang('noneconformities_report') ?>
19620500d9SSzymon Olewniczak    <?php endif ?>
20e8fc7594Sghi	<span id="bez_8d_send_button">[<a href="
21e8827d73SSzymon Olewniczak		<?php echo $tpl->mailto('',
22e8827d73SSzymon Olewniczak   $tpl->getLang('8d_report').': #'.$tpl->get('thread')->id.' '.$tpl->get('thread')->title,
232467512fSSzymon Olewniczak            $tpl->url('8d', 'id', $tpl->get('thread')->id) . '?t=' . $_GET['t']) ?>">
24e8827d73SSzymon Olewniczak<?php echo $tpl->getLang('send_mail') ?>
25e8fc7594Sghi	</a>]</span>
26e8fc7594Sghi</h1>
27f2f5b3feSghi
28f2f5b3feSghi<table>
29f2f5b3feSghi<tr>
30f2f5b3feSghi	<td>
3138ce6055Sghi		 <strong>
32e8827d73SSzymon Olewniczak		 	<a href="<?php echo $tpl->url('thread', 'id', $tpl->get('thread')->id) ?>">
33e8827d73SSzymon Olewniczak				#<?php echo  $tpl->get('thread')->id ?>
3438ce6055Sghi			</a>
3538ce6055Sghi		</strong>
36e8827d73SSzymon Olewniczak        <?php if (!empty($tpl->get('thread')->label_name)): ?>
37e8827d73SSzymon Olewniczak            <?php echo $tpl->get('thread')->label_name ?>
38e8827d73SSzymon Olewniczak        <?php else: ?>
39e8827d73SSzymon Olewniczak            <i style="color: #777"><?php echo $tpl->getLang('issue_type_no_specified') ?></i>
40e8827d73SSzymon Olewniczak        <?php endif ?>
41f2f5b3feSghi	</td>
42f2f5b3feSghi
43f2f5b3feSghi	<td>
44e8827d73SSzymon Olewniczak		<strong><?php echo $tpl->getLang('open_date') ?>:</strong>
45ff14b107SSzymon Olewniczak        <?php echo $tpl->date($tpl->get('thread')->create_date) ?>
46f2f5b3feSghi	</td>
47f2f5b3feSghi</tr>
48f2f5b3feSghi
49f2f5b3feSghi	<tr>
509fbfe943Sghi	<td colspan="2">
51e8827d73SSzymon Olewniczak		<strong><?php echo $tpl->getLang('title') ?>:</strong>
52e8827d73SSzymon Olewniczak		<?php echo  $tpl->get('thread')->title ?>
53f2f5b3feSghi	</td>
54f2f5b3feSghi</tr>
55f2f5b3feSghi</table>
56e2b0e8caSSzymon Olewniczak<?php $D = 1 ?>
57e8827d73SSzymon Olewniczak<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('1d') ?></h2>
5866b54849Sghi<ul>
59e8827d73SSzymon Olewniczak	<?php foreach($tpl->get('thread')->get_participants() as $participant): ?>
60e8827d73SSzymon Olewniczak		<li><?php echo $tpl->user_name($participant['user_id']) ?></li>
6166b54849Sghi	<?php endforeach ?>
6266b54849Sghi</ul>
63f2f5b3feSghi
64e8827d73SSzymon Olewniczak<h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('2d') ?></h2>
65e8827d73SSzymon Olewniczak<?php echo $tpl->get('thread')->content_html ?>
66f2f5b3feSghi
67e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['correction']) > 0): ?>
68e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('3d') ?></h2>
69e8827d73SSzymon Olewniczak    <?php $tpl->set('tasks', $tpl->get('8d_tasks')['correction']) ?>
7044189046SSzymon Olewniczak    <?php include '8d_tasks.php' ?>
71e2b0e8caSSzymon Olewniczak<?php endif ?>
72683e6b20Sghi
7379fbde34SSzymon Olewniczak<?php if (count($tpl->get('causes')) > 0): ?>
74e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('4d') ?></h2>
7579fbde34SSzymon Olewniczak    <?php $tpl->set('causes', $tpl->get('causes')) ?>
7644189046SSzymon Olewniczak    <?php include '8d_causes.php' ?>
77e2b0e8caSSzymon Olewniczak<?php endif ?>
7838ce6055Sghi
79e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['corrective']) > 0): ?>
80e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('5d') ?></h2>
81620500d9SSzymon Olewniczak    <?php if ($tpl->get('variant') == 2): ?>
82620500d9SSzymon Olewniczak        <?php $tpl->set('tasks', $tpl->get('8d_tasks')['corrective']) ?>
83620500d9SSzymon Olewniczak        <?php include '8d_tasks_no_closing.php' ?>
84620500d9SSzymon Olewniczak    <?php else: ?>
85e8827d73SSzymon Olewniczak        <?php $tpl->set('tasks', $tpl->get('8d_tasks')['corrective']) ?>
8644189046SSzymon Olewniczak        <?php include '8d_tasks.php' ?>
87e2b0e8caSSzymon Olewniczak    <?php endif ?>
88620500d9SSzymon Olewniczak<?php endif ?>
89f2f5b3feSghi
90620500d9SSzymon Olewniczak<?php if ($tpl->get('variant') == 2): ?>
91*a12aad5cSSzymon Olewniczak    <?php $corrective_closed = array_filter($tpl->get('8d_tasks')['corrective'], function ($task) {
92*a12aad5cSSzymon Olewniczak        return $task->state == 'closed';
93*a12aad5cSSzymon Olewniczak    }) ?>
94*a12aad5cSSzymon Olewniczak    <?php if (count($corrective_done) > 0): ?>
95620500d9SSzymon Olewniczak        <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('6d-var2') ?></h2>
96*a12aad5cSSzymon Olewniczak        <?php $tpl->set('tasks', $corrective_done) ?>
97*a12aad5cSSzymon Olewniczak        <?php include '8d_tasks_only_closing.php' ?>
987d2577fbSSzymon Olewniczak    <?php endif ?>
99620500d9SSzymon Olewniczak<?php else: ?>
10079fbde34SSzymon Olewniczak    <?php if (count($tpl->get('risks')) > 0 || count($tpl->get('opportunities')) > 0): ?>
101e8827d73SSzymon Olewniczak        <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('6d') ?></h2>
10279fbde34SSzymon Olewniczak        <?php if (count($tpl->get('risks')) > 0): ?>
10379fbde34SSzymon Olewniczak            <h3><?php echo $tpl->getLang('risks') ?></h3>
10479fbde34SSzymon Olewniczak            <?php $tpl->set('causes', $tpl->get('risks')) ?>
10544189046SSzymon Olewniczak            <?php include '8d_causes.php' ?>
106e2b0e8caSSzymon Olewniczak        <?php endif ?>
10779fbde34SSzymon Olewniczak        <?php if (count($tpl->get('opportunities')) > 0): ?>
10879fbde34SSzymon Olewniczak            <h3><?php echo $tpl->getLang('opportunities') ?></h3>
10979fbde34SSzymon Olewniczak            <?php $tpl->set('causes', $tpl->get('opportunities')) ?>
11079fbde34SSzymon Olewniczak            <?php include '8d_causes.php' ?>
11179fbde34SSzymon Olewniczak        <?php endif ?>
11279fbde34SSzymon Olewniczak    <?php endif ?>
113620500d9SSzymon Olewniczak<?php endif ?>
114620500d9SSzymon Olewniczak
115f2f5b3feSghi
116e8827d73SSzymon Olewniczak<?php if (count($tpl->get('8d_tasks')['preventive']) > 0): ?>
117e8827d73SSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('7d') ?></h2>
118*a12aad5cSSzymon Olewniczak    <?php if ($tpl->get('variant') == 2): ?>
119*a12aad5cSSzymon Olewniczak        <?php $preventive = array_merge($tpl->get('risks'), $tpl->get('opportunities')) ?>
120*a12aad5cSSzymon Olewniczak        <?php usort($preventive, function ($a, $b) {
121*a12aad5cSSzymon Olewniczak            return $a->id > $b->id;
122*a12aad5cSSzymon Olewniczak        }); ?>
123*a12aad5cSSzymon Olewniczak        <?php $tpl->set('causes', $preventive) ?>
124*a12aad5cSSzymon Olewniczak        <?php include '8d_causes.php' ?>
125*a12aad5cSSzymon Olewniczak
126e8827d73SSzymon Olewniczak        <?php $tpl->set('tasks', $tpl->get('8d_tasks')['preventive']) ?>
12744189046SSzymon Olewniczak        <?php include '8d_tasks.php' ?>
128*a12aad5cSSzymon Olewniczak    <?php else: ?>
129*a12aad5cSSzymon Olewniczak        <?php $tpl->set('tasks', $tpl->get('8d_tasks')['preventive']) ?>
130*a12aad5cSSzymon Olewniczak        <?php include '8d_tasks.php' ?>
131*a12aad5cSSzymon Olewniczak    <?php endif ?>
132e2b0e8caSSzymon Olewniczak<?php endif ?>
1330e31399aSSzymon Olewniczak
134e2b0e8caSSzymon Olewniczak
135bf67f2caSSzymon Olewniczak<?php if ($tpl->get('thread')->state == 'closed' || $tpl->get('thread')->state == 'rejected'): ?>
136bf67f2caSSzymon Olewniczak    <h2><?php echo $D++ ?>D - <?php echo $tpl->getLang('8d') ?></h2>
137bf67f2caSSzymon Olewniczak    <?php echo  $tpl->get('thread')->closing_comment() ?>
138bf67f2caSSzymon Olewniczak    <table>
139bf67f2caSSzymon Olewniczak        <tr>
140bf67f2caSSzymon Olewniczak            <td>
141bf67f2caSSzymon Olewniczak                <strong><?php echo $tpl->getLang('true_date') ?>:</strong>
142bf67f2caSSzymon Olewniczak                <?php echo $tpl->date($tpl->get('thread')->close_date) ?>
143bf67f2caSSzymon Olewniczak            </td>
144bf67f2caSSzymon Olewniczak            <td>
145bf67f2caSSzymon Olewniczak                <strong><?php echo $tpl->getLang('state') ?>:</strong>
146bf67f2caSSzymon Olewniczak                <?php echo $tpl->getLang('state_' . $tpl->get('thread')->state) ?>
147bf67f2caSSzymon Olewniczak            </td>
148bf67f2caSSzymon Olewniczak        </tr>
149bf67f2caSSzymon Olewniczak
150bf67f2caSSzymon Olewniczak        <tr>
151bf67f2caSSzymon Olewniczak            <td>
152bf67f2caSSzymon Olewniczak                <strong><?php echo $tpl->getLang('totalcost') ?>:</strong>
153bf67f2caSSzymon Olewniczak                <?php if ($tpl->get('thread')->task_sum_cost != ''): ?>
154bf67f2caSSzymon Olewniczak                    <?php echo $tpl->get('thread')->task_sum_cost ?>
155bf67f2caSSzymon Olewniczak                <?php else: ?>
156bf67f2caSSzymon Olewniczak                    <em>---</em>
157bf67f2caSSzymon Olewniczak                <?php endif ?>
158bf67f2caSSzymon Olewniczak            </td>
159bf67f2caSSzymon Olewniczak            <td>
160bf67f2caSSzymon Olewniczak                <strong><?php echo $tpl->getLang('coordinator') ?>:</strong>
161bf67f2caSSzymon Olewniczak                <?php echo $tpl->user_name($tpl->get('thread')->coordinator) ?>
162bf67f2caSSzymon Olewniczak            </td>
163bf67f2caSSzymon Olewniczak        </tr>
164bf67f2caSSzymon Olewniczak    </table>
165bf67f2caSSzymon Olewniczak<?php endif ?>
166