/** * Returns the html for the view * * @param array $data * @return string Html */ protected function getHtml($data = array()) { $html = ''; $html .= Html::openElement('div', array('class' => 'content gather-lists')); // Display protocol for hiding another users list if ($data['canHide']) { $html .= Html::rawElement('div', array('class' => 'hide-protocol'), wfMessage('gather-lists-hide-protocol')->parse()); } $html .= Html::openElement('ul', array()); $html .= Html::openElement('li', array('class' => 'heading')) . Html::element('span', array(), wfMessage('gather-lists-collection-title')) . Html::element('span', array(), wfMessage('gather-lists-collection-description')) . Html::element('span', array(), wfMessage('gather-lists-collection-count')) . Html::element('span', array(), wfMessage('gather-lists-collection-owner')) . Html::element('span', array(), wfMessage('gather-lists-collection-last-updated')); if ($data['canHide']) { $html .= Html::element('span', array(), ''); } $html .= Html::closeElement('li'); foreach ($this->collectionList as $collection) { $partial = new ReportTableRow($this->user, $this->language, $collection); $html .= $partial->getHtml($data); } $html .= Html::closeElement('ul'); if ($data['nextPageUrl']) { $html .= Pagination::more($data['nextPageUrl'], wfMessage('gather-lists-collection-more-link-label')); } $html .= Html::closeElement('div'); return $html; }
/** * Returns the html for the collections in a list * @param models\CollectionsList * @return string Html */ public static function getListItemsHtml($collectionsList) { $html = ''; // Show owner link on card when the collections list doesn't have an owner. $showOwnerLink = !$collectionsList->getOwner(); foreach ($collectionsList as $item) { $collectionsListItemCard = new CollectionsListItemCard($item, $showOwnerLink); $html .= $collectionsListItemCard->getHtml(); } $url = $collectionsList->getContinueUrl(); if ($url) { $messageKey = $collectionsList->getOwner() ? 'gather-lists-more' : 'gather-lists-more-no-owner'; $html .= Pagination::more($url, wfMessage($messageKey)->text()); } return $html; }
/** * @inheritdoc */ protected function getHtml($data = array()) { $collection = $this->collection; $owner = $collection->getOwner(); $html = Html::openElement('div', array('class' => 'collection content view-border-box', 'data-id' => $collection->getId(), 'data-label' => $collection->getTitle(), 'data-owner' => $owner ? $owner->getName() : false, 'data-is-public' => $collection->isPublic(), 'data-is-admin' => $this->user->isAllowed('gather-hidelist'), 'data-is-owner' => $collection->isOwner($this->user) ? true : false)) . $this->getHeaderHtml($collection); if ($collection->getCount() > 0) { $html .= $this->getCollectionItems($collection, $data); $url = $collection->getContinueUrl(); if ($url) { $html .= Pagination::more($url, wfMessage('gather-collection-more')->text(), array('data-pagination-query' => $collection->getContinueQuery())); } } else { $html .= $this->getEmptyCollectionMessage(); } $html .= Html::closeElement('div'); return $html; }