/**
  * Builds the HTML code for this component
  *
  * @return String the HTML code
  */
 public function getHtml()
 {
     $skintemplate = $this->getSkinTemplate();
     $idRegistry = IdRegistry::getRegistry();
     // START content
     $ret = $this->indent() . '<!-- start the content area -->' . $this->indent() . $idRegistry->openElement('div', array('id' => 'content', 'class' => 'mw-body ' . $this->getClassString())) . $idRegistry->element('a', array('id' => 'top')) . $this->indent() . '<div ' . \Html::expandAttributes(array('id' => $idRegistry->getId('mw-js-message'), 'style' => 'display:none;')) . $skintemplate->get('userlangattributes') . '></div>';
     // START contentHeader
     $ret .= $this->indent(1) . '<div class ="contentHeader">' . $this->indent(1) . '<!-- title of the page -->' . $this->indent() . $idRegistry->element('h1', array('id' => 'firstHeading', 'class' => 'firstHeading'), $skintemplate->get('title')) . $this->indent() . '<!-- tagline; usually goes something like "From WikiName" primary purpose of this seems to be for printing to identify the source of the content -->' . $this->indent() . $idRegistry->element('div', array('id' => 'siteSub'), $skintemplate->getMsg('tagline')->escaped());
     if ($skintemplate->get('subtitle')) {
         // TODO: should not use class 'small', better use class 'contentSub' and do styling in a less file
         $ret .= $this->indent() . '<!-- subtitle line; used for various things like the subpage hierarchy -->' . $this->indent() . $idRegistry->element('div', array('id' => 'contentSub', 'class' => 'small'), $skintemplate->get('subtitle'));
     }
     if ($skintemplate->get('undelete')) {
         // TODO: should not use class 'small', better use class 'contentSub2' and do styling in a less file
         $ret .= $this->indent() . '<!-- undelete message -->' . $this->indent() . $idRegistry->element('div', array('id' => 'contentSub2', 'class' => 'small'), $skintemplate->get('undelete'));
     }
     // TODO: Do we need this? Seems to be an accessibility thing. It's used in vector to jump to the nav wich is at the bottom of the document, but our nav is usually at the top
     $ret .= $idRegistry->element('div', array('id' => 'jump-to-nav', 'class' => 'mw-jump'), $skintemplate->getMsg('jumpto')->escaped() . '<a href="#mw-navigation">' . $skintemplate->getMsg('jumptonavigation')->escaped() . '</a>' . $skintemplate->getMsg('comma-separator')->escaped() . '<a href="#p-search">' . $skintemplate->getMsg('jumptosearch')->escaped() . '</a>');
     $ret .= $this->indent(-1) . '</div>';
     // END contentHeader
     // START content body
     $ret .= $idRegistry->element('div', array('id' => 'bodyContent'), $this->indent() . '<!-- body text -->' . "\n" . $this->indent() . $skintemplate->get('bodytext'));
     // END content body
     // TODO: Category links should be a separate component, but
     // * dataAfterContent should come after the the category links.
     // * only one extension is known to use it dataAfterContent and it is geared specifically towards MonoBook
     // => provide an attribut hideCatLinks for the XML and -if present- hide category links and assume somebody knows what they are doing
     $ret .= $this->indent() . '<!-- category links -->' . $this->indent() . $skintemplate->get('catlinks');
     if ($skintemplate->get('dataAfterContent')) {
         $ret .= $this->indent() . '<!-- data blocks which should go somewhere after the body text, but not before the catlinks block-->' . $this->indent() . $skintemplate->get('dataAfterContent');
     }
     $ret .= $this->indent(-1) . '</div>' . "\n";
     // END content
     return $ret;
 }
 /**
  * This method basically replicates SkinTemplate::makeSearchButton, but uses buttons instead of inputs to ensure
  * proper styling by Bootstrap
  *
  * @param string $mode 'go' or 'fulltext', optional, default='fulltext'
  *
  * @return string
  */
 private function getSearchButton($mode = 'fulltext')
 {
     if ($mode === 'go') {
         $buttonAttrs = array('value' => $this->getSkinTemplate()->translator->translate('searcharticle'), 'id' => IdRegistry::getRegistry()->getId('searchGoButton'), 'name' => 'go');
         $glyphicon = 'share-alt';
     } else {
         $buttonAttrs = array('value' => $this->getSkinTemplate()->translator->translate('searchbutton'), 'id' => IdRegistry::getRegistry()->getId('mw-searchButton'), 'name' => 'fulltext');
         $glyphicon = 'search';
     }
     $buttonAttrs = array_merge($buttonAttrs, Linker::tooltipAndAccesskeyAttribs("search-{$mode}"), array('type' => 'submit', 'class' => $buttonAttrs['id'] . ' btn btn-default'));
     return \Html::rawElement('button', $buttonAttrs, '<span class="glyphicon glyphicon-' . $glyphicon . '"></span>');
 }
 /**
  * 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;
 }
 /**
  * Builds the HTML code for this component
  *
  * @return String the HTML code
  */
 public function getHtml()
 {
     $this->mHtml = '';
     if ($this->getDomElement() === null) {
         return $this->mHtml;
     }
     // if a fixed navbar is requested
     if (filter_var($this->getDomElement()->getAttribute('fixed'), FILTER_VALIDATE_BOOLEAN)) {
         // first build the actual navbar and set a class so it will be fixed
         $this->getDomElement()->setAttribute('fixed', '0');
         $realNav = new self($this->getSkinTemplate(), $this->getDomElement(), $this->getIndent());
         $realNav->addClasses('navbar-fixed-top');
         $this->mHtml .= $realNav->getHtml();
         // then add an invisible copy of the nav bar that will act as a spacer
         $this->addClasses('navbar-static-top invisible');
     }
     $this->mHtml .= $this->indent() . '<!-- navigation bar -->' . $this->indent() . \HTML::openElement('nav', array('class' => 'navbar navbar-default p-navbar ' . $this->getClassString(), 'role' => 'navigation', 'id' => IdRegistry::getRegistry()->getId('mw-navigation'))) . $this->indent(1) . '<ul class="nav navbar-nav">';
     $this->indent(1);
     $children = $this->getDomElement()->hasChildNodes() ? $this->getDomElement()->childNodes : array();
     // add components
     foreach ($children as $node) {
         if (is_a($node, 'DOMElement') && $node->tagName === 'component' && $node->hasAttribute('type')) {
             switch ($node->getAttribute('type')) {
                 case 'Logo':
                     $this->mHtml .= $this->getLogo($node);
                     break;
                 case 'NavMenu':
                     $this->mHtml .= $this->getNavMenu($node);
                     break;
                 case 'PageTools':
                     $this->mHtml .= $this->getPageTools($node);
                     break;
                 case 'SearchBar':
                     $this->mHtml .= $this->getSearchBar($node);
                     break;
                 case 'PersonalTools':
                     $this->mHtml .= $this->getPersonalTools($node);
                     break;
             }
         }
     }
     $this->mHtml .= $this->indent(-1) . '</ul>' . $this->indent(-1) . '</nav>' . "\n";
     return $this->mHtml;
 }
 /**
  * @return string
  */
 private function getHtmlId()
 {
     if ($this->htmlId === null) {
         $this->htmlId = IdRegistry::getRegistry()->getId('mw-navigation');
     }
     return $this->htmlId;
 }
 /**
  * @return string
  */
 protected function buildContentBody()
 {
     return IdRegistry::getRegistry()->element('div', array('id' => 'bodyContent'), $this->indent() . '<!-- body text -->' . "\n" . $this->indent() . $this->getSkinTemplate()->get('bodytext') . $this->buildDataAfterContent());
 }
 /**
  * Generates a list item for a navigation, portlet, portal, sidebar... list
  *
  * Overrides the parent function to ensure ids are unique.
  *
  * @param $key     string, usually a key from the list you are generating this link from.
  * @param $item    array, of list item data containing some of a specific set of keys.
  *
  * The "id" and "class" keys will be used as attributes for the list item,
  * if "active" contains a value of true a "active" class will also be appended to class.
  *
  * @param $options array
  *
  * @return string
  */
 function makeListItem($key, $item, $options = array())
 {
     foreach (array('id', 'single-id') as $attrib) {
         if (isset($item[$attrib])) {
             $item[$attrib] = IdRegistry::getRegistry()->getId($item[$attrib], $this);
         }
     }
     return parent::makeListItem($key, $item, $options);
 }
 /**
  * @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;
 }
 /**
  * @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;
 }