/**
  * Gets the HTML fragment for a watched page.
  *
  * @param MobilePage $mp a definition of the page to be rendered.
  * @return string
  */
 protected function getLineHtml(MobilePage $mp)
 {
     $thumb = $mp->getSmallThumbnailHtml();
     $title = $mp->getTitle();
     if (!$thumb) {
         $thumb = MobilePage::getPlaceHolderThumbnailHtml('list-thumb-none', 'list-thumb-x');
     }
     $timestamp = $mp->getLatestTimestamp();
     $user = $this->getUser();
     $titleText = $title->getPrefixedText();
     if ($timestamp) {
         $lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse();
         $edit = $mp->getLatestEdit();
         $dataAttrs = array('data-timestamp' => $edit['timestamp'], 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']);
         $className = 'title';
     } else {
         $className = 'title new';
         $lastModified = '';
         $dataAttrs = array();
     }
     $html = Html::openElement('li', array('class' => 'page-summary', 'title' => $titleText, 'data-id' => $title->getArticleId())) . Html::openElement('a', array('href' => $title->getLocalUrl(), 'class' => $className));
     $html .= $thumb;
     $html .= Html::element('h3', array(), $titleText);
     if ($lastModified) {
         $html .= Html::openElement('div', array('class' => 'info')) . Html::element('span', array_merge($dataAttrs, array('class' => 'modified-enhancement')), $lastModified) . Html::closeElement('div');
     }
     $html .= Html::closeElement('a') . Html::closeElement('li');
     return $html;
 }
 /**
  * Prepare the content for the 'last edited' message, e.g. 'Last edited on 30 August
  * 2013, at 23:31'. This message is different for the main page since main page
  * content is typically transcuded rather than edited directly.
  * @param Title $title The Title object of the page being viewed
  * @return array
  */
 protected function getHistoryLink(Title $title)
 {
     $user = $this->getUser();
     $isMainPage = $title->isMainPage();
     $mp = new MobilePage($this->getTitle(), false);
     $timestamp = $mp->getLatestTimestamp();
     // Main pages tend to include transclusions (see bug 51924)
     if ($isMainPage) {
         $lastModified = $this->msg('mobile-frontend-history')->plain();
     } else {
         $lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse();
     }
     $historyUrl = $this->mobileContext->getMobileUrl($title->getFullURL('action=history'));
     $edit = $mp->getLatestEdit();
     $link = array('data-timestamp' => $isMainPage ? '' : $edit['timestamp'], 'href' => $historyUrl, 'text' => $lastModified, 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']);
     $link['href'] = SpecialPage::getTitleFor('History', $title)->getLocalURL();
     return $link;
 }
Пример #3
0
 private function _assignMobileData($page)
 {
     $pageInfo = MobilePage::getPage($page->getEachNum());
     $pageInfo['item_count'] = $page->getTotalNum();
     MobilePage::formatPage($pageInfo);
     Tpl::output('pageInfo', $pageInfo);
 }
 /**
  * @param MobileCollection $collection
  * @return string html representation of collection in watchlist view
  */
 protected function getViewHtml(MobileCollection $collection)
 {
     $html = '<ul class="watchlist content-unstyled page-list thumbs page-summary-list">';
     foreach ($collection as $mobilePage) {
         $thumb = $mobilePage->getSmallThumbnailHtml();
         if (!$thumb) {
             $thumb = MobilePage::getPlaceHolderThumbnailHtml('list-thumb-none', 'list-thumb-x');
         }
         $title = $mobilePage->getTitle();
         $html .= self::getLineHtml($title, $title->getTouched(), $thumb);
     }
     $html .= '</ul>';
     return $html;
 }