function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     $this->setHeaders();
     $wgOut->setPageTitle(wfMsg('lqt-hot-topics'));
     $title = $this->getTitle();
     $view = new LqtView($wgOut, new Article($title), $title, $wgUser, $wgRequest);
     // Get hot topics
     $topics = LqtHotTopicsController::getHotThreads();
     foreach ($topics as $thread) {
         $view->showThread($thread);
     }
 }
Exemplo n.º 2
0
 protected function renderThread($row, $params, &$entry)
 {
     // Set up OutputPage
     $out = $this->getOutput();
     $oldOutputText = $out->getHTML();
     $out->clearHTML();
     // Setup
     $thread = Thread::newFromRow($row);
     $article = $thread->root();
     if (!$article) {
         return;
     }
     $title = $article->getTitle();
     $user = $this->getUser();
     $request = $this->getRequest();
     $view = new LqtView($out, $article, $title, $user, $request);
     // Parameters
     $view->threadNestingLevel = $params['renderlevel'];
     $renderpos = $params['renderthreadpos'];
     $rendercount = $params['renderthreadcount'];
     $options = array();
     if (isset($params['rendermaxthreadcount'])) {
         $options['maxCount'] = $params['rendermaxthreadcount'];
     }
     if (isset($params['rendermaxdepth'])) {
         $options['maxDepth'] = $params['rendermaxdepth'];
     }
     if (isset($params['renderstartrepliesat'])) {
         $options['startAt'] = $params['renderstartrepliesat'];
     }
     $view->showThread($thread, $renderpos, $rendercount, $options);
     $result = $out->getHTML();
     $out->clearHTML();
     $out->addHTML($oldOutputText);
     $entry['content'] = $result;
 }
 static function showLqtThread($details)
 {
     $title = $details["title"];
     $article = $details["article"];
     global $wgUser, $wgRequest, $wgOut;
     $oldOut = $wgOut->getHTML();
     $wgOut->clearHTML();
     $root = new Article($title, 0);
     $thread = Threads::withRoot($root);
     $view = new LqtView($wgOut, $article, $title, $wgUser, $wgRequest);
     $view->showThread($thread);
     $html = $wgOut->getHTML();
     $wgOut->clearHTML();
     $wgOut->getHTML($oldOut);
     return $html;
 }
Exemplo n.º 4
0
 /**
  * @param $thread Thread
  * @return String
  */
 protected function renderThreadPostAction($thread)
 {
     $thread = $thread->topmostThread();
     // Set up OutputPage
     $out = $this->getOutput();
     $oldOutputText = $out->getHTML();
     $out->clearHTML();
     // Setup
     $article = $thread->root();
     $title = $article->getTitle();
     $user = $this->getUser();
     $request = $this->getRequest();
     $view = new LqtView($out, $article, $title, $user, $request);
     $view->showThread($thread);
     $result = $out->getHTML();
     $out->clearHTML();
     $out->addHTML($oldOutputText);
     return $result;
 }
 static function renderThreadPostAction($thread)
 {
     $thread = $thread->topmostThread();
     // Set up OutputPage
     global $wgOut, $wgUser, $wgRequest;
     $oldOutputText = $wgOut->getHTML();
     $wgOut->clearHTML();
     // Setup
     $article = $thread->root();
     $title = $article->getTitle();
     $view = new LqtView($wgOut, $article, $title, $wgUser, $wgRequest);
     $view->showThread($thread);
     $result = $wgOut->getHTML();
     $wgOut->clearHTML();
     $wgOut->addHTML($oldOutputText);
     return $result;
 }