[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/almanac/view/ -> AlmanacBindingTableView.php (source)

   1  <?php
   2  
   3  final class AlmanacBindingTableView extends AphrontView {
   4  
   5    private $bindings;
   6    private $handles;
   7    private $noDataString;
   8  
   9    public function setNoDataString($no_data_string) {
  10      $this->noDataString = $no_data_string;
  11      return $this;
  12    }
  13  
  14    public function getNoDataString() {
  15      return $this->noDataString;
  16    }
  17  
  18    public function setHandles(array $handles) {
  19      $this->handles = $handles;
  20      return $this;
  21    }
  22  
  23    public function getHandles() {
  24      return $this->handles;
  25    }
  26  
  27    public function setBindings(array $bindings) {
  28      $this->bindings = $bindings;
  29      return $this;
  30    }
  31  
  32    public function getBindings() {
  33      return $this->bindings;
  34    }
  35  
  36    public function render() {
  37      $bindings = $this->getBindings();
  38      $handles = $this->getHandles();
  39      $viewer = $this->getUser();
  40  
  41      $rows = array();
  42      foreach ($bindings as $binding) {
  43        $addr = $binding->getInterface()->getAddress();
  44        $port = $binding->getInterface()->getPort();
  45  
  46        $rows[] = array(
  47          $binding->getID(),
  48          $handles[$binding->getServicePHID()]->renderLink(),
  49          $handles[$binding->getDevicePHID()]->renderLink(),
  50          $handles[$binding->getInterface()->getNetworkPHID()]->renderLink(),
  51          $binding->getInterface()->renderDisplayAddress(),
  52          phutil_tag(
  53            'a',
  54            array(
  55              'class' => 'small grey button',
  56              'href' => '/almanac/binding/'.$binding->getID().'/',
  57            ),
  58            pht('Details')),
  59        );
  60      }
  61  
  62      $table = id(new AphrontTableView($rows))
  63        ->setNoDataString($this->getNoDataString())
  64        ->setHeaders(
  65          array(
  66            pht('ID'),
  67            pht('Service'),
  68            pht('Device'),
  69            pht('Network'),
  70            pht('Interface'),
  71            null,
  72          ))
  73        ->setColumnClasses(
  74          array(
  75            '',
  76            '',
  77            '',
  78            '',
  79            'wide',
  80            'action',
  81          ));
  82  
  83      return $table;
  84    }
  85  
  86  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1