xref: /dokuwiki/lib/plugins/extension/GuiAdmin.php (revision 80bc92fb6cebd3143ca97b0ad5aa529a28f2cc39)
1981e70caSAndreas Gohr<?php
2981e70caSAndreas Gohr
3981e70caSAndreas Gohrnamespace dokuwiki\plugin\extension;
4981e70caSAndreas Gohr
5981e70caSAndreas Gohrclass GuiAdmin extends Gui
6981e70caSAndreas Gohr{
7981e70caSAndreas Gohr    public function render()
8981e70caSAndreas Gohr    {
9981e70caSAndreas Gohr        $html = '<div id="extension__manager">';
10981e70caSAndreas Gohr
11981e70caSAndreas Gohr        $html .= $this->tabNavigation();
12981e70caSAndreas Gohr
13981e70caSAndreas Gohr        switch ($this->currentTab()) {
14981e70caSAndreas Gohr            case 'search':
15981e70caSAndreas Gohr                $html .= $this->tabSearch();
16981e70caSAndreas Gohr                break;
17981e70caSAndreas Gohr            case 'templates':
18981e70caSAndreas Gohr                $html .= $this->tabTemplates();
19981e70caSAndreas Gohr                break;
20981e70caSAndreas Gohr            case 'install':
21981e70caSAndreas Gohr                $html .= $this->tabInstall();
22981e70caSAndreas Gohr                break;
23981e70caSAndreas Gohr            case 'plugins':
24981e70caSAndreas Gohr            default:
25981e70caSAndreas Gohr                $html .= $this->tabPlugins();
26981e70caSAndreas Gohr        }
27981e70caSAndreas Gohr
28981e70caSAndreas Gohr        $html .= '</div>';
29981e70caSAndreas Gohr        return $html;
30981e70caSAndreas Gohr    }
31981e70caSAndreas Gohr
32981e70caSAndreas Gohr    /**
33981e70caSAndreas Gohr     * Print the tab navigation
34981e70caSAndreas Gohr     *
35981e70caSAndreas Gohr     */
36981e70caSAndreas Gohr    public function tabNavigation()
37981e70caSAndreas Gohr    {
38981e70caSAndreas Gohr        $html = '<ul class="tabs">';
39981e70caSAndreas Gohr        foreach ($this->tabs as $tab) {
40981e70caSAndreas Gohr            $url = $this->tabURL($tab);
41981e70caSAndreas Gohr            if ($this->currentTab() == $tab) {
42981e70caSAndreas Gohr                $class = ' active';
43981e70caSAndreas Gohr            } else {
44981e70caSAndreas Gohr                $class = '';
45981e70caSAndreas Gohr            }
46981e70caSAndreas Gohr            $html .= '<li class="' . $tab . $class . '"><a href="' . $url . '">' .
47981e70caSAndreas Gohr                $this->getLang('tab_' . $tab) . '</a></li>';
48981e70caSAndreas Gohr        }
49981e70caSAndreas Gohr        $html .= '</ul>';
50981e70caSAndreas Gohr        return $html;
51981e70caSAndreas Gohr    }
52981e70caSAndreas Gohr
53981e70caSAndreas Gohr    public function tabPlugins()
54981e70caSAndreas Gohr    {
55981e70caSAndreas Gohr        $html = '<div class="panelHeader">';
56981e70caSAndreas Gohr        $html .= $this->helper->locale_xhtml('intro_plugins');
57981e70caSAndreas Gohr        $html .= '</div>';
58981e70caSAndreas Gohr
59981e70caSAndreas Gohr        $pluginlist = plugin_list('', true);
60981e70caSAndreas Gohr
61981e70caSAndreas Gohr        $html .= '<div id="extension__list">';
62*80bc92fbSAndreas Gohr        $html .= '<form action="' . $this->tabURL('plugins') . '" method="post">';
63*80bc92fbSAndreas Gohr        $html .= '<input type="hidden" name="overwrite" value="1">';
64*80bc92fbSAndreas Gohr        $html .= formSecurityToken(false);
65981e70caSAndreas Gohr        foreach ($pluginlist as $name) {
66981e70caSAndreas Gohr            $ext = Extension::createFromId($name);
67981e70caSAndreas Gohr            $gui = new GuiExtension($ext);
68981e70caSAndreas Gohr            $html .= $gui->render();
69981e70caSAndreas Gohr        }
70*80bc92fbSAndreas Gohr        $html .= '</form>';
71981e70caSAndreas Gohr        $html .= '</div>';
72981e70caSAndreas Gohr
73981e70caSAndreas Gohr        return $html;
74981e70caSAndreas Gohr    }
75981e70caSAndreas Gohr}
76