public function getForm() { global $wgScriptPath; $form = ''; $registeredModules = WikiAdmin::getRegisteredModules(); foreach ($registeredModules as $module => $params) { $title = SpecialPage::getTitleFor('WikiAdmin'); $url = $title->getLocalURL('mode=' . $module); // TODO SU (04.07.11 10:56): Gehört eigentlich in eine view. $form .= '<div class="bs-admincontrolbtn">'; $form .= '<a href="' . $url . '">'; $form .= '<img src="' . $wgScriptPath . $params['image'] . '" alt="' . $module . '" title="' . $module . '">'; $form .= '<div class="bs-admin-label">'; $form .= wfMessage($params['message'])->plain(); $form .= '</div>'; $form .= '</a>'; $form .= '</div>'; } return $form; }
/** * Adds WikiAdmin tab to main navigation * @param SkinTemplate $sktemplate * @param BaseTemplate $tpl * @return boolean Always true to keep hook running */ public static function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl) { if ($sktemplate->getUser()->isAllowed('wikiadmin') === false) { return true; } $oSpecialPage = SpecialPage::getTitleFor('WikiAdmin'); $aRegisteredModules = WikiAdmin::getRegisteredModules(); $aOutSortable = array(); $aOut = array(); $aOut[] = '<ul>'; foreach ($aRegisteredModules as $sModuleKey => $aModulParams) { $skeyLower = mb_strtolower($sModuleKey); $sModulLabel = wfMessage('bs-' . $skeyLower . '-label')->plain(); $sUrl = $oSpecialPage->getLocalURL(array('mode' => $sModuleKey)); //$sUrl = str_replace( '&', '&', $sUrl ); $sLink = Html::element('a', array('id' => 'bs-admin-' . $skeyLower, 'href' => $sUrl, 'title' => $sModulLabel), $sModulLabel); $aOutSortable[$sModulLabel] = '<li>' . $sLink . '</li>'; } $aOutSortable['Shop'] = self::getShopListItem(); $aOutSortable['SpecialPages'] = self::getMediaWikiSpecialPageItem(); ksort($aOutSortable); $aOut[] = implode("\n", $aOutSortable) . '</ul>'; $aOut[] = '</ul>'; if ($tpl instanceof BsBaseTemplate) { $tpl->data['bs_navigation_main']['bs-wikiadmin'] = array('position' => 100, 'label' => wfMessage('bs-tab_admin')->plain(), 'class' => 'icon-cog', 'content' => implode("\n", $aOut)); } else { $tpl->data['sidebar'][wfMessage('bs-tab_admin')->plain()] = implode("\n", $aOut); } return true; }