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