Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $url = Url::fromRequest();
     $activeLimit = (int) $url->getParam('limit', $this->getDefaultLimit());
     $navigation = new Navigation();
     $navigation->setLayout(Navigation::LAYOUT_TABS);
     foreach (static::$limits as $limit => $label) {
         $navigation->addItem('limit_' . $limit, array('priority' => $limit, 'label' => $label, 'active' => $activeLimit === $limit, 'url' => $url->with(array('limit' => $limit)), 'title' => sprintf(t('Show %u rows on this page'), $limit)));
     }
     if ($activeLimit === 0) {
         $navigation->addItem('limit_0', array('active' => true, 'label' => t('all'), 'title' => t('Show all items on this page'), 'priority' => max(array_keys(static::$limits)) + 1));
     }
     return $navigation->getRenderer()->setCssClass(static::CSS_CLASS_LIMITER)->setHeading(t('Limiter'))->render();
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $url = Url::fromRequest();
     $activeLimit = (int) $url->getParam('limit', $this->getDefaultLimit());
     $navigation = new Navigation();
     $navigation->setLayout(Navigation::LAYOUT_TABS);
     foreach (static::$limits as $limit => $label) {
         $navigationItem = new NavigationItem($limit);
         $navigationItem->setActive($activeLimit === $limit)->setAttribute('title', sprintf(t('Show %u rows on this page'), $limit))->setLabel($label)->setUrl($url->with(array('limit' => $limit)));
         $navigation->addItem($navigationItem);
     }
     if ($activeLimit === 0) {
         $navigationItem = new NavigationItem(0);
         $navigationItem->setActive(true)->setAttribute('title', t('Show all items on this page'))->setLabel(t('all'));
         $navigation->addItem($navigationItem);
     }
     return $navigation->getRenderer()->setCssClass(static::CSS_CLASS_LIMITER)->setHeading(t('Limiter'))->render();
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $badges = new Navigation();
     $badges->setLayout(Navigation::LAYOUT_TABS);
     $this->createBadgeGroup(array(static::STATE_CRITICAL, static::STATE_CRITICAL_HANDLED), $badges)->createBadgeGroup(array(static::STATE_DOWN, static::STATE_DOWN_HANDLED), $badges)->createBadgeGroup(array(static::STATE_WARNING, static::STATE_WARNING_HANDLED), $badges)->createBadgeGroup(array(static::STATE_UNREACHABLE, static::STATE_UNREACHABLE_HANDLED), $badges)->createBadge(static::STATE_UNKNOWN, $badges)->createBadge(static::STATE_OK, $badges)->createBadge(static::STATE_UP, $badges)->createBadge(static::STATE_PENDING, $badges);
     return $badges->getRenderer()->setCssClass(static::CSS_CLASS)->render();
 }