xref: /template/sprintdoc/tpl/nav-page-attributes.php (revision 3b38f6c6bf4558aecca53781af51e0069a606165)
1<?php
2
3if (!defined('DOKU_INC')) die();
4
5/** @var \helper_plugin_do $doPlugin */
6$doPlugin = plugin_load('helper', 'do');
7/** @var \helper_plugin_qc $qcPlugin */
8$qcPlugin = plugin_load('helper', 'qc');
9/** @var \action_plugin_starred $starredPlugin */
10$starredPlugin = plugin_load('action', 'starred');
11/** @var \helper_plugin_quicksubscribe $quickSubPlugin */
12$quickSubPlugin = plugin_load('helper', 'quicksubscribe');
13/** @var \helper_plugin_approve_tpl $approvePlugin */
14$approvePlugin = plugin_load('helper', 'approve_tpl');
15
16$items = [];
17
18
19if ($qcPlugin && $qcPlugin->shouldShow()) {
20    $qcPrefix = tpl_getLang('quality_trigger');
21    // filled by javascript
22    $items[] = '<li class="plugin_qc"><strong class="sr-out">' . hsc($qcPrefix) . ':</strong><a href="#"></a></li>';
23}
24
25
26if ($doPlugin !== null) {
27    $count = $doPlugin->getPageTaskCount();
28    $num = (int) $count['count'];
29    $title = '';
30
31    if ($num == 0) { // no tasks - does not exist do in plug-in
32        $class = 'do_none';
33        $title = tpl_getLang('tasks_page_none');
34    } elseif ($count['undone'] == 0) { // all tasks done
35        $class = 'do_done';
36        $title = $doPlugin->getLang('title_alldone');
37    } elseif ($count['late'] == 0) { // open tasks but none late
38        $class = 'do_undone';
39        $title = sprintf(tpl_getLang('tasks_page_intime'), $count['undone']);
40    } else { // late tasks
41        $class = 'do_late';
42        $title = sprintf(tpl_getLang('tasks_page_late'), $count['undone'], $count['late']);
43    }
44
45    $items[] = '<li class="plugin_do_pagetasks">' .
46        '<span title="' . hsc($title) . '" class="' . $class . '">' .
47        inlineSVG(DOKU_PLUGIN . 'do/pix/clipboard-text.svg') .
48        '</span>' .
49        '<span class="num">' . (int) $count['undone'] . '</span>' .
50        '</li>';
51}
52
53if ($starredPlugin !== null) {
54    $items[] = '<li class="plugin_starred">' . $starredPlugin->tpl_starred(false, false) . '</li>';
55}
56
57if ($quickSubPlugin !== null) {
58    $items[] = '<li class="plugin_quicksubscribe">' . $quickSubPlugin->tpl_subscribe() . '</li>';
59}
60
61if ($approvePlugin !== null && $approvePlugin->shouldDisplay()) {
62    global $ACT;
63    $items[] = '<li class="plugin_approve">' .
64        '<span class="plugin_approve-icon">' . inlineSVG(DOKU_PLUGIN . 'approve/admin.svg') . '</span>' .
65        '<div class="plugin_approve-banner-content">' .
66        $approvePlugin->banner($ACT) .
67        '</div>' .
68        '</li>';
69}
70
71if (!empty($items)) {
72    echo '<ul class="page-attributes">' . implode('', $items) . '</ul>';
73}
74