1<?php
2/**
3 * Function for DokuWiki template Typo
4 *
5 * @author Michael Klier <chi@chimeric.de>
6 */
7
8/**
9 * Prints the navigation
10 *
11 * @author Michael Klier <chi@chimeric.de>
12 */
13function tpl_navigation() {
14    global $ID;
15    global $conf;
16    $navpage = tpl_getConf('navigation_page');
17    list($ns, $chunk) = explode(':', $ID, 2);
18    $navpage = (page_exists($ns.':'.$navpage)) ? $ns.':'.$navpage : $navpage;
19
20    print '<div class="navigation">' . DOKU_LF;
21    if(!page_exists($navpage)) {
22        if(@file_exists(DOKU_TPLINC.'lang/'. $conf['lang'].'/nonavigation.txt')) {
23            $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC.'lang/'.$conf['lang'].'/nonavigation.txt')), $info);
24        } else {
25            $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC.'lang/en/nonavigation.txt')), $info);
26        }
27        $link = '<a href="' . wl($navpage) . '" class="wikilink2">' . $navpage . '</a>' . DOKU_LF;
28        print str_replace('LINK', $link, $out);
29    } else {
30        print p_wiki_xhtml($navpage);
31    }
32    print '</div>';
33}
34
35/**
36 * Prints the actions links
37 *
38 * @author Michael Klier <chi@chimeric.de>
39 */
40function tpl_actions() {
41    $actions = array('admin', 'revert', 'edit', 'history', 'recent', 'backlink', 'subscription', 'index', 'login', 'profile');
42
43    print '<div class="sidebar_box">' . DOKU_LF;
44    print '  <ul>' . DOKU_LF;
45
46    foreach($actions as $action) {
47        if(!actionOK($action)) continue;
48        // start output buffering
49        if($action == 'edit') {
50            // check if new page button plugin is available
51            if(!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
52                $npb = $npd->html_new_page_button(true);
53                if($npb) {
54                    print '    <li><div class="li">';
55                    print $npb;
56                    print '</div></li>' . DOKU_LF;
57                }
58            }
59        }
60        ob_start();
61        print '     <li><div class="li">';
62        if(tpl_actionlink($action)) {
63            print '</div></li>' . DOKU_LF;
64            ob_end_flush();
65        } else {
66            ob_end_clean();
67        }
68    }
69    print '  </ul>' . DOKU_LF;
70    print '</div>' . DOKU_LF;
71}
72
73// vim:ts=4:sw=4:et:enc=utf-8:
74