/** * Builds the HTML code for this component * * @return String the HTML code */ public function getHtml() { $ret = $this->indent() . '<!-- footer links -->' . $this->indent() . \Html::openElement('ul', array('class' => 'footer-info ' . $this->getClassString(), 'id' => IdRegistry::getRegistry()->getId('footer-info'))); $footerlinks = $this->getSkinTemplate()->getFooterLinks(); $this->indent(1); foreach ($footerlinks as $category => $links) { if ($category !== 'places') { $ret .= $this->indent() . '<!-- ' . htmlspecialchars($category) . ' -->'; foreach ($links as $key) { $ret .= $this->indent() . '<li>' . $this->getSkinTemplate()->get($key) . '</li>'; } } } $ret .= $this->indent(-1) . '</ul>' . "\n"; return $ret; }
/** * @param string $category * * @return string */ protected function buildTabGroupOpeningTags($category) { // output the name of the current category (e.g. 'namespaces', 'views', ...) $ret = $this->indent() . \Html::openElement('li', array('id' => IdRegistry::getRegistry()->getId('p-' . $category))) . $this->indent(1) . '<ul class="list-inline" >'; $this->indent(1); return $ret; }
/** * Create a single dropdown * * @param string $boxName * @param array $box * @param bool $flatten * * @return string */ protected function getDropdownForNavMenu($boxName, $box, $flatten = false) { // open list item containing the dropdown $ret = $this->indent() . '<!-- ' . $boxName . ' -->'; $menuitems = ''; // build the list of submenu items if (is_array($box['content']) && count($box['content']) > 0) { $this->indent($flatten ? 0 : 2); foreach ($box['content'] as $key => $item) { $menuitems .= $this->indent() . $this->getSkinTemplate()->makeListItem($key, $item); } $this->indent($flatten ? 0 : -2); } else { $menuitems .= $this->indent() . '<!-- empty -->'; } if ($flatten) { // if the menu is to be flattened, just return the introducing comment and the list of menu items as is $ret .= $menuitems; } elseif (!is_array($box['content']) || count($box['content']) === 0) { //if the menu is not to be flattened, but is empty, return an inert link $ret .= $this->indent() . \Html::rawElement('li', array('class' => '', 'title' => Linker::titleAttrib($box['id'])), '<a href="#">' . htmlspecialchars($box['header']) . '</a>'); } else { // open list item containing the dropdown $ret .= $this->indent() . \Html::openElement('li', array('class' => 'dropdown', 'title' => Linker::titleAttrib($box['id']))); // add the dropdown toggle $ret .= $this->indent(1) . '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . htmlspecialchars($box['header']) . ' <b class="caret"></b></a>'; // open list of dropdown menu items $ret .= $this->indent() . $this->indent() . \Html::openElement('ul', array('class' => 'dropdown-menu ' . $box['id'], 'id' => IdRegistry::getRegistry()->getId($box['id']))); // add list of menu items $ret .= $menuitems; // close list of dropdown menu items and the list item containing the dropdown $ret .= $this->indent() . '</ul>' . $this->indent(-1) . '</li>'; } return $ret; }
/** * Create a dropdown containing the page tools (page, talk, edit, history, ...) * * @param \DOMElement $domElement * * @return string */ protected function getPageTools(\DOMElement $domElement = null) { $pageTools = new PageTools($this->getSkinTemplate(), $domElement, $this->getIndent()); $pageTools->setFlat(true); $pageTools->removeClasses('text-center list-inline'); $pageTools->addClasses('dropdown-menu'); $ret = $pageTools->getHtml(); if ($ret !== '') { $ret = $this->indent() . '<!-- page tools -->' . $this->indent() . \Html::openElement('li', array('class' => 'dropdown')) . $this->indent(1) . '<a data-toggle="dropdown" class="dropdown-toggle" href="#">Page Tools <b class="caret"></b></a>' . $ret . $this->indent(-1) . '</li>' . "\n"; } return $ret; }
/** * @param mixed[] $menuDescription * * @return string */ protected function buildDropdownOpeningTags($menuDescription) { // open list item containing the dropdown $ret = $this->indent() . \Html::openElement('li', array('class' => 'dropdown', 'title' => Linker::titleAttrib($menuDescription['id']))); // add the dropdown toggle $ret .= $this->indent(1) . '<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . htmlspecialchars($menuDescription['header']) . ' <b class="caret"></b></a>'; // open list of dropdown menu items $ret .= $this->indent() . $this->indent() . \Html::openElement('ul', array('class' => 'dropdown-menu ' . $menuDescription['id'], 'id' => IdRegistry::getRegistry()->getId($menuDescription['id']))); return $ret; }
/** * Builds the HTML code for this component * * @return String the HTML code */ public function getHtml() { $attribs = array_merge(array('href' => $this->getSkinTemplate()->data['nav_urls']['mainpage']['href']), Linker::tooltipAndAccesskeyAttribs('p-logo')); $contents = \Html::element('img', array('src' => $this->getSkinTemplate()->data['logopath'], 'alt' => $this->getSkinTemplate()->data['sitename'])); return $this->indent() . '<!-- logo and main page link -->' . $this->indent() . \Html::openElement('div', array('id' => IdRegistry::getRegistry()->getId('p-logo'), 'class' => 'p-logo ' . $this->getClassString(), 'role' => 'banner')) . $this->indent(1) . \Html::rawElement('a', $attribs, $contents) . $this->indent(-1) . '</div>' . "\n"; }
/** * Builds the HTML code for this component * * @return String the HTML code */ public function getHtml() { $navigation = $this->getSkinTemplate()->data['content_navigation']; $hideSelectedNameSpace = false; if ($this->getDomElement() !== null) { $hideSelectedNameSpace = filter_var($this->getDomElement()->getAttribute('hideSelectedNameSpace'), FILTER_VALIDATE_BOOLEAN); } if ($hideSelectedNameSpace) { $namespacekey = $this->getNamespaceKey(); unset($navigation['namespaces'][$namespacekey]); } $ret = ''; $this->indent(2); foreach ($navigation as $category => $tabs) { // TODO: visually group all links of one category (e.g. some space between categories) if (empty($tabs)) { continue; } $ret .= $this->indent() . '<!-- ' . $category . ' -->'; if (!$this->mFlat) { // output the name of the current category (e.g. 'namespaces', 'views', ...) $ret .= $this->indent() . \Html::openElement('li', array('id' => IdRegistry::getRegistry()->getId('p-' . $category))) . $this->indent(1) . '<ul class="list-inline" >'; $this->indent(1); } foreach ($tabs as $key => $tab) { // skip redundant links (i.e. the 'view' link) // TODO: make this dependent on an option if (array_key_exists('redundant', $tab) && $tab['redundant'] === true) { continue; } // apply a link class if specified, e.g. for the currently active namespace $options = array(); if (array_key_exists('class', $tab)) { $options['link-class'] = $tab['class']; } $ret .= $this->indent() . $this->getSkinTemplate()->makeListItem($key, $tab, $options); } if (!$this->mFlat) { $ret .= $this->indent(-1) . '</ul>' . $this->indent(-1) . '</li>'; } } $this->indent(-2); if ($ret !== '') { $ret = $this->indent(1) . '<!-- Content navigation -->' . $this->indent() . \Html::openElement('ul', array('class' => 'p-contentnavigation ' . $this->getClassString(), 'id' => IdRegistry::getRegistry()->getId('p-contentnavigation'))) . $ret . $this->indent() . '</ul>'; } return $ret; }