コード例 #1
0
 /**
  * Get the header for the watchlist page
  * @param User $user
  * @param int $id
  * @param string $actionUrl
  * @return string Parsed HTML
  */
 private function getHeader(User $user, $id, $actionUrl)
 {
     $html = Html::openElement('form', array('action' => $actionUrl)) . Html::openElement('select', array('name' => 'collection-id'));
     $collections = models\CollectionsList::newFromApi($user, true);
     foreach ($collections as $collection) {
         $attrs = array('value' => $collection->getId());
         if ($collection->getId() === $id) {
             $attrs['selected'] = true;
         }
         $html .= Html::element('option', $attrs, $collection->getTitle());
     }
     $html .= Html::closeElement('select') . Html::submitButton(wfMessage('gather-editfeed-show'), array('class' => CSS::buttonClass('progressive'))) . Html::closeElement('form');
     return '<div class="gather-edit-feed-header content-header">' . $html . '</div>';
 }
コード例 #2
0
 /**
  * Returns the html for the view
  *
  * @param array $data
  * @return string Html
  */
 public function getHtml($data = array())
 {
     $lang = $this->language;
     $user = $this->user;
     $collection = $this->collection;
     $action = isset($data['action']) ? $data['action'] : 'hide';
     $ts = $lang->userTimeAndDate($collection->getUpdated(), $user);
     $owner = $collection->getOwner();
     $title = $collection->getTitle();
     $id = $collection->getId();
     $desc = $collection->getDescription();
     $html = Html::openElement('li') . $this->collectionLink($collection) . Html::element('span', $desc ? array() : array('class' => 'empty'), $desc) . Html::element('span', array(), $collection->getCount()) . $this->userLink($owner) . Html::element('span', array(), $ts);
     if ($data['canHide']) {
         $className = CSS::buttonClass($action === 'hide' ? 'destructive' : 'constructive', 'moderate-collection');
         $label = $action === 'hide' ? wfMessage('gather-lists-hide-collection-label')->text() : wfMessage('gather-lists-show-collection-label')->text();
         $html .= Html::openElement('span', array()) . Html::element('button', array('class' => $className, 'data-id' => $id, 'data-action' => $action, 'data-label' => $title, 'data-owner' => $owner->getName()), $label) . Html::closeElement('span');
     }
     $html .= Html::closeElement('li');
     return $html;
 }
コード例 #3
0
 /**
  * Get the HTML for the more collections button (infinite scrolling)
  * @param string $url url where the more button will point to
  * @param string $text text for the button
  * @param string $data data attributes for the button
  * @param string $classes Additional css classes for the pagination button
  */
 public static function more($url, $text, $data = array(), $classes = '')
 {
     return Html::openElement('div', array('class' => 'collections-pagination')) . Html::element('a', array_merge(array('href' => $url, 'class' => CSS::buttonClass('progressive', $classes)), $data), $text) . Html::closeElement('div');
 }
コード例 #4
0
 /**
  * Get the edit button html if user should edit
  * FIXME: Move this to JavaScript.
  */
 public function getEditButtonHtml()
 {
     $id = $this->collection->getId();
     // Do not edit watchlist
     if ($id !== 0 && $this->collection->isOwner($this->user)) {
         return Html::element('a', array('href' => '#/edit-collection/' . $id, 'class' => CSS::buttonClass('progressive', 'collection-action-button edit-collection')), wfMessage('gather-edit-button')->text());
     } else {
         return '';
     }
 }