/**
  *
  * @param Title $oTitle
  * @return false|\ViewStateBarBodyElement
  */
 private function makeStateBarBodyCategories($oTitle)
 {
     global $wgUser;
     $aCurrentPagesCategories = $oTitle->getParentCategories();
     if (empty($aCurrentPagesCategories)) {
         return false;
     }
     wfProfileIn('BS::' . __METHOD__);
     $bIsProcessed = false;
     wfRunHooks('BSArticleInfoBeforeAddLastEditorView', array($this, &$aCurrentPagesCategories, &$bIsProcessed));
     if ($bIsProcessed === false) {
         ksort($aCurrentPagesCategories);
     }
     $oDbr = wfGetDB(DB_SLAVE);
     $res = $oDbr->select(array('page_props'), array('pp_page'), array('pp_propname' => 'hiddencat'));
     $aHiddenPageIDs = array();
     while ($row = $oDbr->fetchObject($res)) {
         $aHiddenPageIDs[] = $row->pp_page;
     }
     $sCategories = '';
     $sAllCategoriesWithUrls = '';
     $sAllCategoriesWithUrls = '';
     foreach ($aCurrentPagesCategories as $sCat => $sName) {
         $oCat = Title::newFromText($sCat);
         if (in_array($oCat->getArticleID(), $aHiddenPageIDs)) {
             $sAllCategoriesWithUrls .= '<li>' . BsLinkProvider::makeLink($oCat, $oCat->getText()) . '</li>';
             continue;
         }
         $sAllCategoriesWithUrls .= '<li>' . BsLinkProvider::makeLink($oCat, $oCat->getText()) . '</li>';
         //But all for the body element
     }
     if (!empty($sAllCategoriesWithUrls)) {
         $sCategories = '<ul>' . $sAllCategoriesWithUrls . '</ul>';
     }
     if ($wgUser->getBoolOption('showhiddencats')) {
         if (!empty($sAllCategoriesWithUrls)) {
             $sCategories .= '<h4>' . wfMessage('bs-articleinfo-hiddencats')->plain() . '</h4>' . '<ul>' . $sAllCategoriesWithUrls . '</ul>';
         }
     }
     if (empty($sCategories)) {
         $sCategories = wfMessage('bs-articleinfo-nocategories')->plain();
     }
     $oCategoriesLinkBodyElement = new ViewStateBarBodyElement();
     $oCategoriesLinkBodyElement->setKey('AllCategories');
     $oCategoriesLinkBodyElement->setHeading(wfMessage('bs-articleinfo-all-categories-heading')->plain());
     $oCategoriesLinkBodyElement->setBodyText($sCategories);
     wfRunHooks('BSArticleInfoBeforeAddCategoryBodyView', array($this, &$oCategoriesLinkBodyElement));
     wfProfileOut('BS::' . __METHOD__);
     return $oCategoriesLinkBodyElement;
 }
 /**
  * Renders the pagetemplates form which is displayed when creating a new article
  * @param bool $bReturnHTML If set, the form is returned as HTML, otherwise as wiki code.
  * @return string The rendered output
  */
 protected function renderPageTemplates()
 {
     global $wgDBtype;
     $oTitle = $this->getTitle();
     // if we are not on a wiki page, return. This is important when calling import scripts that try to create nonexistent pages, e.g. importImages
     if (!is_object($oTitle)) {
         return true;
     }
     $aRes = array();
     $aOutNs = array();
     $dbr = wfGetDB(DB_SLAVE);
     $aConds = array();
     if (BsConfig::get('MW::PageTemplates::HideIfNotInTargetNs')) {
         if ($wgDBtype == 'postgres') {
             $aConds[] = "pt_target_namespace IN ('" . $oTitle->getNamespace() . "', '-99')";
         } else {
             $aConds[] = 'pt_target_namespace IN (' . $oTitle->getNamespace() . ', -99)';
         }
     }
     if ($wgDBtype == 'postgres') {
         $aFields = array("pt_template_title, pt_template_namespace, pt_label, pt_desc, pt_target_namespace");
     } else {
         $aFields = array('pt_template_title', 'pt_template_namespace', 'pt_label', 'pt_desc', 'pt_target_namespace');
     }
     $res = $dbr->select(array('bs_pagetemplate'), $aFields, $aConds, __METHOD__, array('ORDER BY' => 'pt_label'));
     // There is always one template for empty page it is added some lines beneath that
     $iCount = $dbr->numRows($res) + 1;
     $sOut = wfMessage('bs-pagetemplates-choose-template', $iCount)->parse();
     $sOutAll = '';
     $oTargetNsTitle = null;
     $sOut .= '<br /><br /><ul><li>';
     $sOut .= BsLinkProvider::makeLink($oTitle, wfMessage('bs-pagetemplates-empty-page')->plain(), array(), array('preload' => ''));
     $sOut .= '<br />' . wfMessage('bs-pagetemplates-empty-page-desc')->plain();
     $sOut .= '</li></ul>';
     $oSortingTitle = Title::makeTitle(NS_MEDIAWIKI, 'PageTemplatesSorting');
     $vOrder = BsPageContentProvider::getInstance()->getContentFromTitle($oSortingTitle);
     $vOrder = explode('*', $vOrder);
     $vOrder = array_map('trim', $vOrder);
     if ($res && $dbr->numRows($res) > 0) {
         while ($row = $dbr->fetchObject($res)) {
             $aRes[] = $row;
         }
     }
     $dbr->freeResult($res);
     foreach ($aRes as $row) {
         $oNsTitle = Title::makeTitle($row->pt_template_namespace, $row->pt_template_title);
         // TODO MRG (06.09.11 12:53): -99 is "all namespaces". Pls use a more telling constant
         if (BsConfig::get('MW::PageTemplates::ForceNamespace') && $row->pt_target_namespace != "-99" || $row->pt_target_namespace == $oTitle->getNamespace() || BsConfig::get('MW::PageTemplates::HideIfNotInTargetNs') == false) {
             $sNamespaceName = BsNamespaceHelper::getNamespaceName($row->pt_target_namespace);
             if (!isset($aOutNs[$sNamespaceName])) {
                 $aOutNs[$sNamespaceName] = array();
             }
             if (BsConfig::get('MW::PageTemplates::ForceNamespace')) {
                 $oTargetNsTitle = Title::makeTitle($row->pt_target_namespace, $oTitle->getText());
             } else {
                 $oTargetNsTitle = $oTitle;
             }
             $sLink = BsLinkProvider::makeLink($oTargetNsTitle, $row->pt_label, array(), array('preload' => $oNsTitle->getPrefixedText()));
             $sLink = '<li>' . $sLink;
             if ($row->pt_desc) {
                 $sLink .= '<br/>' . $row->pt_desc;
             }
             $sLink .= '</li>';
             $aOutNs[$sNamespaceName][] = array('link' => $sLink, 'id' => $row->pt_target_namespace);
         } elseif ($row->pt_target_namespace == "-99") {
             $sLink = BsLinkProvider::makeLink($oTitle, $row->pt_label, array(), array('preload' => $oNsTitle->getPrefixedText()));
             $sOutAll .= '<li>' . $sLink;
             if ($row->pt_desc) {
                 $sOutAll .= '<br />' . $row->pt_desc;
             }
             $sOutAll .= '</li>';
         }
     }
     if (!empty($vOrder)) {
         $aTmp = array();
         foreach ($vOrder as $key => $value) {
             if (empty($value)) {
                 continue;
             }
             if (array_key_exists($value, $aOutNs)) {
                 $aTmp[$value] = $aOutNs[$value];
             }
         }
         $aOutNs = $aTmp + array_diff_key($aOutNs, $aTmp);
     }
     $aLeftCol = array();
     $aRightCol = array();
     foreach ($aOutNs as $sNs => $aTmpOut) {
         foreach ($aTmpOut as $key => $aAttribs) {
             $sNamespaceName = BsNamespaceHelper::getNamespaceName($aAttribs['id']);
             if ($aAttribs['id'] == $oTitle->getNamespace() || $aAttribs['id'] == -99) {
                 $aLeftCol[$sNamespaceName][] = '<ul>' . $aAttribs['link'] . '</ul>';
             } else {
                 $aRightCol[$sNamespaceName][] = '<ul>' . $aAttribs['link'] . '</ul>';
             }
         }
     }
     if ($sOutAll !== '') {
         $sSectionGeneral = wfMessage('bs-pagetemplates-general-section')->plain();
         $aLeftCol[$sSectionGeneral][] = '<ul>' . $sOutAll . '</ul>';
     }
     $sOut .= '<br />';
     if (!empty($aLeftCol) || !empty($aRightCol) && BsConfig::get('MW::PageTemplates::HideIfNotInTargetNs') == false) {
         $sOut .= '<table><tr>';
         if (!empty($aLeftCol)) {
             $sOut .= '<td style="vertical-align:top;">';
             foreach ($aLeftCol as $sNamespace => $aHtml) {
                 if ($sNamespace == wfMessage('bs-ns_all')->plain()) {
                     $sNamespace = wfMessage('bs-pagetemplates-general-section')->plain();
                 }
                 $sOut .= '<br />';
                 $sOut .= '<h3>' . $sNamespace . '</h3>';
                 $sOut .= implode('', $aHtml);
             }
             $sOut .= '</td>';
         }
         if (BsConfig::get('MW::PageTemplates::HideIfNotInTargetNs') == false) {
             if (!empty($aRightCol)) {
                 $sOut .= '<td style="vertical-align:top;">';
                 foreach ($aRightCol as $sNamespace => $aHtml) {
                     $sOut .= '<br />';
                     $sOut .= '<h3>' . $sNamespace . '</h3>';
                     $sOut .= implode('', $aHtml);
                 }
                 $sOut .= '</td>';
             }
         }
         $sOut .= '</tr></table>';
     }
     return $sOut;
 }
 public static function getResponsibleEditorsPortletData($iCount, $iUserId)
 {
     $iCount = BsCore::sanitize($iCount, 10, BsPARAMTYPE::INT);
     $oDbr = wfGetDB(DB_SLAVE);
     $res = $oDbr->select('bs_responsible_editors', 're_page_id', array('re_user_id' => $iUserId));
     $aResults = array();
     if ($oDbr->numRows($res) > 0) {
         $aResults[] = Html::openElement('ul');
         foreach ($res as $row) {
             $oTitle = Title::newFromID($row->re_page_id);
             if ($oTitle->exists()) {
                 $aResults[] = Html::openElement('li') . BsLinkProvider::makeLink($oTitle, $oTitle->getPrefixedText()) . Html::closeElement('li');
             }
         }
         $aResults[] = Html::closeElement('ul');
     } else {
         $aResults[] = wfMessage('bs-responsibleeditors-no-own-responsibilities')->plain();
     }
     return implode('', $aResults);
 }
 /**
  * Generate a link to a wiki page for a given result
  * @param object $oDocument Apache_Solr_Document
  * @param object $oTitle Title of wiki page
  * @param object $oParser Parser
  * @return string Anchor link to the wiki page
  */
 private function getWikiLink($oDocument, $oTitle, $oParser)
 {
     $sHtml = null;
     if (isset($this->oResponse->highlighting->{$oDocument->uid}->titleWord)) {
         $sHtml = $this->oResponse->highlighting->{$oDocument->uid}->titleWord[0];
     } elseif (isset($this->oResponse->highlighting->{$oDocument->uid}->titleReverse)) {
         $sHtml = $this->oResponse->highlighting->{$oDocument->uid}->titleReverse[0];
     }
     if (!is_null($sHtml)) {
         if ($oDocument->namespace != '0' && $oDocument->namespace != '998' && $oDocument->namespace != '999') {
             $sHtml = BsNamespaceHelper::getNamespaceName($oDocument->namespace) . ':' . $sHtml;
         }
         $sHtml = str_replace('_', ' ', $sHtml);
     }
     $sSearchLink = Linker::link($oTitle, $sHtml, $aCustomAttribs = array('class' => 'bs-extendedsearch-result-headline'), array(), array('known'));
     if (isset($this->oResponse->highlighting->{$oDocument->uid}->sections)) {
         $sSection = strip_tags($this->oResponse->highlighting->{$oDocument->uid}->sections[0], '<em>');
         $sSectionAnchor = $oParser->guessSectionNameFromWikiText($sSection);
         $sSectionLink = BsLinkProvider::makeLink($oTitle, $sSection, array(), array(), array('known'));
         $aMatches = array();
         preg_match('#.*?href="(.*?)".*?#', $sSectionLink, $aMatches);
         if (isset($aMatches[1])) {
             $sAnchor = $aMatches[1] . $sSectionAnchor;
             $sSectionLink = str_replace($aMatches[1], $sAnchor, $sSectionLink);
         }
         $sSearchLink .= ' <span class="bs-extendedsearch-sectionresult">(' . wfMessage('bs-extendedsearch-section')->plain() . ' ' . $sSectionLink . ')</span>';
     }
     return $sSearchLink;
 }
 /**
  * Send email notification to next user(s) on review list.
  * @param BsReviewProcess $oReviewProcess Review process users should be notified for.
  * @return Status
  */
 public function emailNotifyNextUsers($oReviewProcess)
 {
     $aNextUsers = $oReviewProcess->getNextUsers();
     // Identify owner
     $oOwner = User::newFromId($oReviewProcess->getOwner());
     $sOwnerRealName = BsCore::getUserDisplayName($oOwner);
     $oTitle = Title::newFromID($oReviewProcess->pid);
     $sTitleText = $oTitle->getPrefixedText();
     $sLink = BsLinkProvider::makeLink($oTitle, $oTitle->getFullURL());
     foreach ($aNextUsers as $aReviewer) {
         // dirty workaround, sometimes id comes as username
         if (is_numeric($aReviewer['id'])) {
             $oReviewer = User::newFromId($aReviewer['id']);
         } else {
             $oReviewer = User::newFromName($aReviewer['id']);
         }
         if (!BsConfig::getVarForUser('MW::Review::EmailNotifyReviewer', $oReviewer->getName())) {
             continue;
         }
         // Identify reviewer
         //PW(10.03.2015): Echo notifications
         $sReviewerMail = $oReviewer->getEmail();
         if (!$sReviewerMail) {
             continue;
         }
         $sReviewerLang = $oReviewer->getOption('language');
         $sSubject = wfMessage('bs-review-mail-invite-header', $sTitleText)->inLanguage($sReviewerLang)->text();
         $sMsg = wfMessage('bs-review-mail-invite-body', $sOwnerRealName, $oOwner->getName(), $sTitleText)->inLanguage($sReviewerLang)->text();
         $sMsg .= "\n\n" . $sLink;
         if ($aReviewer['comment']) {
             $sMsg .= "\n" . wfMessage('bs-review-mail-comment', $aReviewer['comment'])->inLanguage($sReviewerLang)->text();
         }
         //Send mail to next user in queue
         BsMailer::getInstance('MW')->send($oReviewer, $sSubject, $sMsg);
     }
 }
 /**
  * Generates list of most edited pages
  * @return String list of pages or empty
  */
 public function getActivePortlet($iCount, $iTime)
 {
     $oDbr = wfGetDB(DB_SLAVE);
     $iCount = BsCore::sanitize($iCount, 10, BsPARAMTYPE::INT);
     $iTime = BsCore::sanitize($iTime, 0, BsPARAMTYPE::INT);
     $aConditions = array();
     if ($iTime !== 0) {
         $this->getTimestampForQuery($aConditions, $iTime);
     }
     $res = $oDbr->select('revision', array('COUNT(rev_user) as edit_count', 'rev_user'), $aConditions, __METHOD__, array('GROUP BY' => 'rev_user', 'ORDER BY' => 'edit_count DESC'));
     $aList = array();
     if ($oDbr->numRows($res) > 0) {
         $aList[] = '<ol>';
         $i = 1;
         foreach ($res as $row) {
             if ($i > $iCount) {
                 break;
             }
             $oUser = User::newFromId($row->rev_user);
             if ($oUser->isIP($oUser->getName())) {
                 continue;
             }
             $oTitle = Title::makeTitle(NS_USER, $oUser->getName());
             $sLink = BsLinkProvider::makeLink($oTitle);
             $aList[] = '<li>' . $sLink . ' (' . $row->edit_count . ')</li>';
             $i++;
         }
         $aList[] = '</ol>';
     }
     $oDbr->freeResult($res);
     return implode("\n", $aList);
 }
 /**
  *
  * @param User $oCurrentUser
  * @param int $iCount
  * @param int $iMaxTitleLength
  * @param string $sOrder
  * @return ViewBaseElement
  */
 private function fetchWatchlist($oCurrentUser, $iCount = 10, $iMaxTitleLength = 50, $sOrder = 'pagename')
 {
     $aWatchlist = array();
     $aOptions = array();
     if ($sOrder == 'pagename') {
         $aOptions['ORDER BY'] = 'wl_title';
     }
     $aOptions['LIMIT'] = $iCount;
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('watchlist', array('wl_namespace', 'wl_title'), array('wl_user' => $oCurrentUser->getId(), 'NOT wl_notificationtimestamp' => NULL), __METHOD__, $aOptions);
     $oWatchedArticlesListView = new ViewBaseElement();
     $oWatchedArticlesListView->setTemplate('*{WIKILINK}' . "\n");
     foreach ($res as $row) {
         $oWatchedTitle = Title::newFromText($row->wl_title, $row->wl_namespace);
         if ($oWatchedTitle === null || $oWatchedTitle->exists() === false || $oWatchedTitle->userCan('read') === false) {
             continue;
         }
         $sDisplayTitle = BsStringHelper::shorten($oWatchedTitle->getPrefixedText(), array('max-length' => $iMaxTitleLength, 'position' => 'middle'));
         $oWatchedArticlesListView->addData(array('WIKILINK' => BsLinkProvider::makeEscapedWikiLinkForTitle($oWatchedTitle, $sDisplayTitle)));
     }
     return $oWatchedArticlesListView;
 }
 /**
  * Gets the recently visited pages of the current user.
  * @param int $iCount The number of pages to display
  * @param string $sNamespaces Comma separated list of requested namespaces, i.e. "1,5,Category,101"
  * @param int $iCurrentNamespaceId To determin wether the current namespace is in the list of requested namespaces
  * @param string $sSortOrder Defines the sorting of the list. 'time|pagename', default is 'time'
  * @return ViewBaseElement Contains the list in its _data member. The predefined template is '*[[{LINK}|{TITLE}]]\n'
  */
 private function makePagesVisitedWikiList($iCount = 5, $sNamespaces = 'all', $iCurrentNamespaceId = 0, $iMaxTitleLength = 20, $sSortOrder = 'time')
 {
     $oCurrentUser = $this->getUser();
     if (is_null($oCurrentUser)) {
         return null;
     }
     // in CLI
     //$sCacheKey = md5( $oCurrentUser->getName().$iCount.$sNamespaces.$iCurrentNamespaceId.$iMaxTitleLength );
     //if( isset( self::$prResultListViewCache[$sCacheKey] ) ) return self::$prResultListViewCache[$sCacheKey];
     $oErrorListView = new ViewTagErrorList($this);
     $oErrorView = null;
     $aConditions = array();
     $aNamespaceIndexes = array(0);
     try {
         $aNamespaceIndexes = BsNamespaceHelper::getNamespaceIdsFromAmbiguousCSVString($sNamespaces);
         //Returns array of integer indexes
     } catch (BsInvalidNamespaceException $oException) {
         $aInvalidNamespaces = $oException->getListOfInvalidNamespaces();
         $oVisitedPagesListView = new ViewBaseElement();
         $oVisitedPagesListView->setTemplate('<ul><li><em>{TEXT}</em></li></ul>' . "\n");
         $iCount = count($aInvalidNamespaces);
         $sNs = implode(', ', $aInvalidNamespaces);
         $sErrorMsg = wfMessage('bs-pagesvisited-error-nsnotvalid', $iCount, $sNs)->text();
         $oVisitedPagesListView->addData(array('TEXT' => $sErrorMsg));
         //self::$prResultListViewCache[$sCacheKey] = $oVisitedPagesListView;
         return $oVisitedPagesListView;
     }
     $aConditions = array('wo_user_id' => $oCurrentUser->getId(), 'wo_action' => 'view');
     $aConditions[] = 'wo_page_namespace IN (' . implode(',', $aNamespaceIndexes) . ')';
     //Add IN clause to conditions-array
     $aConditions[] = 'wo_page_namespace != -1';
     // TODO RBV (24.02.11 13:54): Filter SpecialPages because there are difficulties to list them
     $aOptions = array('GROUP BY' => 'wo_page_id, wo_page_namespace, wo_page_title', 'ORDER BY' => 'MAX(wo_timestamp) DESC');
     if ($sSortOrder == 'pagename') {
         $aOptions['ORDER BY'] = 'wo_page_title ASC';
     }
     //If the page the extension is used on appears in the result set we have to fetch one row more than neccessary.
     if (in_array($iCurrentNamespaceId, $aNamespaceIndexes)) {
         $aOptions['OFFSET'] = 1;
     }
     $aFields = array('wo_page_id', 'wo_page_namespace', 'wo_page_title');
     $sTable = 'bs_whoisonline';
     $dbr = wfGetDB(DB_SLAVE);
     global $wgDBtype;
     if ($wgDBtype == 'oracle') {
         $sRowNumField = 'rnk';
         $sTable = mb_strtoupper($dbr->tablePrefix() . $sTable);
         $sFields = implode(',', $aFields);
         $sConditions = $dbr->makeList($aConditions, LIST_AND);
         $aOptions['ORDER BY'] = $sSortOrder == 'pagename' ? $aOptions['ORDER BY'] : 'wo_timestamp DESC';
         $res = $dbr->query("SELECT " . $sFields . " FROM (\n\t\t\t\t\t\t\t\t\t\t\tSELECT " . $sFields . ", row_number() over (order by " . $aOptions['ORDER BY'] . ") " . $sRowNumField . "\n\t\t\t\t\t\t\t\t\t\t\tFROM " . $sTable . "\n\t\t\t\t\t\t\t\t\t\t\tWHERE " . $sConditions . "\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\tWHERE " . $sRowNumField . " BETWEEN (0) AND (" . $iCount . ") GROUP BY " . $aOptions["GROUP BY"] . "");
     } else {
         $res = $dbr->select($sTable, $aFields, $aConditions, __METHOD__, $aOptions);
     }
     $oVisitedPagesListView = new ViewBaseElement();
     $oVisitedPagesListView->setTemplate('*{WIKILINK}' . "\n");
     $iItems = 1;
     foreach ($res as $row) {
         if ($iItems > $iCount) {
             break;
         }
         $oVisitedPageTitle = Title::newFromID($row->wo_page_id);
         /*
         // TODO RBV (24.02.11 13:52): Make SpecialPages work...
         $oVisitedPageTitle = ( $row->wo_page_namespace != NS_SPECIAL )
         					? Title::newFromID( $row->wo_page_id )
         					//: SpecialPage::getTitleFor( $row->wo_page_title );
         					: Title::makeTitle( NS_SPECIAL, $row->wo_page_title );
         */
         if ($oVisitedPageTitle == null || $oVisitedPageTitle->exists() === false || $oVisitedPageTitle->quickUserCan('read') === false) {
             continue;
         }
         $sDisplayTitle = BsStringHelper::shorten($oVisitedPageTitle->getPrefixedText(), array('max-length' => $iMaxTitleLength, 'position' => 'middle'));
         $oVisitedPagesListView->addData(array('WIKILINK' => BsLinkProvider::makeEscapedWikiLinkForTitle($oVisitedPageTitle, $sDisplayTitle)));
         $iItems++;
     }
     //$dbr->freeResult( $res );
     //self::$prResultListViewCache[$sCacheKey] = $oVisitedPagesListView;
     return $oVisitedPagesListView;
 }
 /**
  * Creates a Widget and returns it
  * @return ViewWidget
  */
 public function onWidgetListKeyword()
 {
     $sTitle = wfMessage('bs-wantedarticle-tag-default-title')->plain();
     $aWishList = $this->getTitleListFromTitle($this->getDataSourceTemplateArticle()->getTitle());
     $sSort = BsConfig::get('MW::WantedArticle::Sort');
     switch ($sSort) {
         case 'title':
             $aTitleList = $this->sortWishListByTitle($aWishList);
             break;
         case 'time':
         default:
             $aTitleList = $this->getDefaultTitleList($aWishList);
     }
     if (BsConfig::get('MW::WantedArticle::Order') == 'DESC') {
         $aTitleList = array_reverse($aTitleList);
     }
     $iIncludeLimit = BsConfig::get('MW::WantedArticle::IncludeLimit');
     $iCount = count($aTitleList);
     $iCount = $iCount > $iIncludeLimit ? $iIncludeLimit : $iCount;
     $aWikiCodeList = array();
     $oTitle = null;
     $sWishTitle = '';
     for ($i = 0; $i < $iCount; $i++) {
         $oTitle = $aTitleList[$i];
         $sWishTitle = BsStringHelper::shorten($oTitle->getPrefixedText(), array('max-length' => 30, 'position' => 'middle'));
         $aWikiCodeList[] = '*' . BsLinkProvider::makeEscapedWikiLinkForTitle($oTitle, $sWishTitle);
     }
     $sBody = $this->mCore->parseWikiText(implode("\n", $aWikiCodeList), $this->getTitle());
     $oWidgetView = new ViewWidget();
     $oWidgetView->setTitle($sTitle)->setBody($sBody)->setTooltip($sTitle)->setAdditionalBodyClasses(array('bs-nav-links'));
     //For correct margin and fontsize
     return $oWidgetView;
 }