コード例 #1
0
 private function buildPropertyListView(DrydockLease $lease, PhabricatorActionListView $actions)
 {
     $viewer = $this->getViewer();
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     $view->addProperty(pht('Status'), DrydockLeaseStatus::getNameForStatus($lease->getStatus()));
     $view->addProperty(pht('Resource Type'), $lease->getResourceType());
     $owner_phid = $lease->getOwnerPHID();
     if ($owner_phid) {
         $owner_display = $viewer->renderHandle($owner_phid);
     } else {
         $owner_display = phutil_tag('em', array(), pht('No Owner'));
     }
     $view->addProperty(pht('Owner'), $owner_display);
     $authorizing_phid = $lease->getAuthorizingPHID();
     if ($authorizing_phid) {
         $authorizing_display = $viewer->renderHandle($authorizing_phid);
     } else {
         $authorizing_display = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Authorized By'), $authorizing_display);
     $resource_phid = $lease->getResourcePHID();
     if ($resource_phid) {
         $resource_display = $viewer->renderHandle($resource_phid);
     } else {
         $resource_display = phutil_tag('em', array(), pht('No Resource'));
     }
     $view->addProperty(pht('Resource'), $resource_display);
     $until = $lease->getUntil();
     if ($until) {
         $until_display = phabricator_datetime($until, $viewer);
     } else {
         $until_display = phutil_tag('em', array(), pht('Never'));
     }
     $view->addProperty(pht('Expires'), $until_display);
     $attributes = $lease->getAttributes();
     if ($attributes) {
         $view->addSectionHeader(pht('Attributes'), 'fa-list-ul');
         foreach ($attributes as $key => $value) {
             $view->addProperty($key, $value);
         }
     }
     return $view;
 }