Ejemplo n.º 1
0
 function getTOC($threads)
 {
     global $wgLang, $wgContLang;
     $html = '';
     $h2_header = Xml::tags('h2', null, wfMessage('lqt_contents_title')->parse());
     // Header row
     $headerRow = '';
     $headers = array('lqt_toc_thread_title', 'lqt_toc_thread_replycount', 'lqt_toc_thread_modified');
     foreach ($headers as $msg) {
         $headerRow .= Xml::tags('th', null, wfMessage($msg)->parse());
     }
     $headerRow = Xml::tags('tr', null, $headerRow);
     $headerRow = Xml::tags('thead', null, $headerRow);
     // Table body
     $rows = array();
     foreach ($threads as $thread) {
         if ($thread->root() && !$thread->root()->getContent() && !LqtView::threadContainsRepliesWithContent($thread)) {
             continue;
         }
         $row = '';
         $anchor = '#' . $this->anchorName($thread);
         $subject = Xml::tags('a', array('href' => $anchor), Threads::stripHTML($thread->formattedSubject()));
         $row .= Xml::tags('td', array('dir' => $wgContLang->getDir()), $subject);
         $row .= Xml::element('td', null, $wgLang->formatNum($thread->replyCount()));
         $timestamp = $wgLang->timeanddate($thread->modified(), true);
         $row .= Xml::element('td', null, $timestamp);
         $row = Xml::tags('tr', null, $row);
         $rows[] = $row;
     }
     $html .= $headerRow . "\n" . Xml::tags('tbody', null, implode("\n", $rows));
     $html = $h2_header . Xml::tags('table', array('class' => 'lqt_toc'), $html);
     // wrap our output in a div for containment
     $html = Xml::tags('div', array('class' => 'lqt-contents-wrapper'), $html);
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * @param $thread thread
  * @param $contextType string
  * @param $text null
  * @return mixed
  */
 static function linkInContext($thread, $contextType = 'page', $text = null)
 {
     list($title, $query) = self::linkInContextData($thread, $contextType);
     if (is_null($text)) {
         $text = Threads::stripHTML($thread->formattedSubject());
     }
     return Linker::link($title, $text, array(), $query);
 }
Ejemplo n.º 3
0
 static function linkInContext($thread, $contextType = 'page', $text = null)
 {
     list($title, $query) = self::linkInContextData($thread, $contextType);
     if (is_null($text)) {
         $text = Threads::stripHTML($thread->formattedSubject());
     }
     $linker = class_exists('DummyLinker') ? new DummyLinker() : new Linker();
     return $linker->link($title, $text, array(), $query);
 }