[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class AlmanacInterfaceTableView extends AphrontView {
   4  
   5    private $interfaces;
   6    private $handles;
   7  
   8    public function setHandles(array $handles) {
   9      $this->handles = $handles;
  10      return $this;
  11    }
  12  
  13    public function getHandles() {
  14      return $this->handles;
  15    }
  16  
  17    public function setInterfaces(array $interfaces) {
  18      $this->interfaces = $interfaces;
  19      return $this;
  20    }
  21  
  22    public function getInterfaces() {
  23      return $this->interfaces;
  24    }
  25  
  26    public function render() {
  27      $interfaces = $this->getInterfaces();
  28      $handles = $this->getHandles();
  29      $viewer = $this->getUser();
  30  
  31      $rows = array();
  32      foreach ($interfaces as $interface) {
  33        $rows[] = array(
  34          $interface->getID(),
  35          $handles[$interface->getNetworkPHID()]->renderLink(),
  36          $interface->getAddress(),
  37          $interface->getPort(),
  38          phutil_tag(
  39            'a',
  40            array(
  41              'class' => 'small grey button',
  42              'href' => '/almanac/interface/edit/'.$interface->getID().'/',
  43            ),
  44            pht('Edit')),
  45        );
  46      }
  47  
  48      $table = id(new AphrontTableView($rows))
  49        ->setHeaders(
  50          array(
  51            pht('ID'),
  52            pht('Network'),
  53            pht('Address'),
  54            pht('Port'),
  55            null,
  56          ))
  57        ->setColumnClasses(
  58          array(
  59            '',
  60            'wide',
  61            '',
  62            '',
  63            'action',
  64          ));
  65  
  66      return $table;
  67    }
  68  
  69  }


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