xref: /dokuwiki/lib/plugins/extension/GuiAdmin.php (revision 981e70cabab67fd2c1ea32d1f7d1ee51fe3e16a6)
1<?php
2
3namespace dokuwiki\plugin\extension;
4
5class GuiAdmin extends Gui
6{
7    public function render()
8    {
9        $html = '<div id="extension__manager">';
10
11        $html .= $this->tabNavigation();
12
13        switch ($this->currentTab()) {
14            case 'search':
15                $html .= $this->tabSearch();
16                break;
17            case 'templates':
18                $html .= $this->tabTemplates();
19                break;
20            case 'install':
21                $html .= $this->tabInstall();
22                break;
23            case 'plugins':
24            default:
25                $html .= $this->tabPlugins();
26        }
27
28        $html .= '</div>';
29        return $html;
30    }
31
32    /**
33     * Print the tab navigation
34     *
35     */
36    public function tabNavigation()
37    {
38        $html = '<ul class="tabs">';
39        foreach ($this->tabs as $tab) {
40            $url = $this->tabURL($tab);
41            if ($this->currentTab() == $tab) {
42                $class = ' active';
43            } else {
44                $class = '';
45            }
46            $html .= '<li class="' . $tab . $class . '"><a href="' . $url . '">' .
47                $this->getLang('tab_' . $tab) . '</a></li>';
48        }
49        $html .= '</ul>';
50        return $html;
51    }
52
53    public function tabPlugins()
54    {
55        $html = '<div class="panelHeader">';
56        $html .= $this->helper->locale_xhtml('intro_plugins');
57        $html .= '</div>';
58
59        $pluginlist = plugin_list('', true);
60
61        $html .= '<div id="extension__list">';
62        // FIXME wrap in form
63        foreach ($pluginlist as $name) {
64            $ext = Extension::createFromId($name);
65            $gui = new GuiExtension($ext);
66            $html .= $gui->render();
67        }
68        $html .= '</div>';
69
70        return $html;
71    }
72}
73