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 /** 54 * Return the HTML for the list of installed plugins 55 * 56 * @return string 57 */ 58 public function tabPlugins() 59 { 60 $html = '<div class="panelHeader">'; 61 $html .= $this->helper->locale_xhtml('intro_plugins'); 62 $html .= '</div>'; 63 64 $plugins = (new Local())->getTemplates(); 65 66 $html .= '<div id="extension__list">'; 67 $html .= '<form action="' . $this->tabURL('plugins') . '" method="post">'; 68 $html .= '<input type="hidden" name="overwrite" value="1">'; 69 $html .= formSecurityToken(false); 70 foreach ($plugins as $ext) { 71 $gui = new GuiExtension($ext); 72 $html .= $gui->render(); 73 } 74 $html .= '</form>'; 75 $html .= '</div>'; 76 77 return $html; 78 } 79 80 /** 81 * Return the HTML for the list of installed templates 82 * 83 * @return string 84 */ 85 public function tabTemplates() { 86 $html = '<div class="panelHeader">'; 87 $html .= $this->helper->locale_xhtml('intro_templates'); 88 $html .= '</div>'; 89 90 $templates = (new Local())->getTemplates(); 91 92 $html .= '<div id="extension__list">'; 93 $html .= '<form action="' . $this->tabURL('templates') . '" method="post">'; 94 $html .= '<input type="hidden" name="overwrite" value="1">'; 95 $html .= formSecurityToken(false); 96 foreach ($templates as $ext) { 97 $gui = new GuiExtension($ext); 98 $html .= $gui->render(); 99 } 100 $html .= '</form>'; 101 $html .= '</div>'; 102 103 return $html; 104 } 105 106} 107