/** * @inheritdoc */ public function getHtml($data = array()) { $collection = $this->collection; $defaults = array('langdir' => 'ltr', 'articleCountMsg' => wfMessage('gather-article-count', $collection->getCount())->text(), 'privacyMsg' => $this->getPrivacyMsg(), 'collectionUrl' => $collection->getUrl(), 'hasImage' => $collection->hasImage(), 'image' => $this->image->getHtml(), 'title' => $this->getTitle()); $owner = $collection->getOwner(); if ($owner && $this->showOwnerLink) { $defaults['owner'] = array('link' => $collection->getOwnerUrl(), 'className' => helpers\CSS::iconClass('profile', 'before'), 'label' => $owner->getName()); } return Template::render('CollectionsListItemCard', array_merge($defaults, $data)); }
/** * @inheritdoc */ protected function getHtml($data = array()) { $dir = isset($data['langdir']) ? $data['langdir'] : 'ltr'; $item = $this->item; $title = $item->getTitle(); $img = $this->image->getHtml(); $pageUrl = $title->getLocalUrl(); $isMissing = $item->isMissing(); $data = array('dir' => $dir, 'page' => array('url' => $pageUrl, 'displayTitle' => $title->getPrefixedText()), 'msgMissing' => wfMessage('gather-page-not-found')->escaped(), 'isMissing' => $isMissing, 'progressiveAnchorClass' => CSS::anchorClass('progressive'), 'iconClass' => CSS::iconClass('collections-read-more', 'element', 'collections-read-more-arrow')); // Handle excerpt for titles with an extract or unknown pages if ($item->hasExtract()) { $data['extract'] = $item->getExtract(); } if ($img) { $data['cardImage'] = $img; } return Template::render('CollectionItemCard', $data); }
/** * Add collections link in personal tools menu * @param array &$items Items array to be added to menu */ public static function onMobilePersonalTools(&$items) { // Get an array with just watchlist in it. $itemArray = array_slice($items, 0, 1); // add collections after it. $itemArray[] = array('name' => 'collections', 'components' => array('text' => wfMessage('gather-lists-title')->escaped(), 'href' => SpecialPage::getTitleFor('Gather')->getLocalURL(), 'class' => CSS::iconClass('collections-icon', 'before', 'collection-menu-item hidden'), 'data-event-name' => 'collections')); // combine it with the rest of the array $items = array_merge($itemArray, array_slice($items, 1, count($items) - 1)); return true; }
/** * Returns the html for showing the owner on the collection header * * @param User $owner Owner of the collection * @return string Html */ private function getOwnerHtml($owner) { $ownerName = $owner->getName(); $userIconLink = Html::openElement('a', array('href' => SpecialPage::getTitleFor('Gather')->getSubPage('by')->getSubPage($ownerName)->getLocalUrl())) . Html::element('span', array('class' => CSS::iconClass('collection-owner', 'before', 'collection-owner-icon'))) . $owner->getName() . Html::closeElement('a'); return Html::openElement('div', array('class' => 'collection-owner')) . wfMessage('gather-collection-owner-text')->rawParams($userIconLink)->params($ownerName)->parse() . Html::closeElement('div'); }
/** * @param User $user * @return string */ public static function getUsernameCSSClasses(User $user) { $isAnon = $user->isAnon(); if ($isAnon) { return CSS::iconClass('anonymous', 'before', 'icon-16px mw-userlink mw-anonuserlink'); } else { return CSS::iconClass('user', 'before', 'icon-16px mw-userlink'); } }