[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/people/customfield/ -> PhabricatorUserRolesField.php (source)

   1  <?php
   2  
   3  final class PhabricatorUserRolesField
   4    extends PhabricatorUserCustomField {
   5  
   6    private $value;
   7  
   8    public function getFieldKey() {
   9      return 'user:roles';
  10    }
  11  
  12    public function getFieldName() {
  13      return pht('Roles');
  14    }
  15  
  16    public function getFieldDescription() {
  17      return pht('Shows roles like "Administrator" and "Disabled".');
  18    }
  19  
  20    public function shouldAppearInPropertyView() {
  21      return true;
  22    }
  23  
  24    public function renderPropertyViewValue(array $handles) {
  25      $user = $this->getObject();
  26  
  27      $roles = array();
  28      if ($user->getIsAdmin()) {
  29        $roles[] = pht('Administrator');
  30      }
  31      if ($user->getIsDisabled()) {
  32        $roles[] = pht('Disabled');
  33      }
  34      if (!$user->getIsApproved()) {
  35        $roles[] = pht('Not Approved');
  36      }
  37      if ($user->getIsSystemAgent()) {
  38        $roles[] = pht('Bot');
  39      }
  40  
  41      if ($roles) {
  42        return implode(', ', $roles);
  43      }
  44  
  45      return null;
  46    }
  47  
  48  }


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