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