[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/harbormaster/storage/configuration/ -> HarbormasterBuildPlanTransaction.php (source)

   1  <?php
   2  
   3  final class HarbormasterBuildPlanTransaction
   4    extends PhabricatorApplicationTransaction {
   5  
   6    const TYPE_NAME = 'harbormaster:name';
   7    const TYPE_STATUS = 'harbormaster:status';
   8  
   9    public function getApplicationName() {
  10      return 'harbormaster';
  11    }
  12  
  13    public function getApplicationTransactionType() {
  14      return HarbormasterBuildPlanPHIDType::TYPECONST;
  15    }
  16  
  17    public function getIcon() {
  18      $old = $this->getOldValue();
  19      $new = $this->getNewValue();
  20  
  21      switch ($this->getTransactionType()) {
  22        case self::TYPE_NAME:
  23          if ($old === null) {
  24            return 'fa-plus';
  25          }
  26          break;
  27      }
  28  
  29      return parent::getIcon();
  30    }
  31  
  32    public function getColor() {
  33      $old = $this->getOldValue();
  34      $new = $this->getNewValue();
  35  
  36      switch ($this->getTransactionType()) {
  37        case self::TYPE_NAME:
  38          if ($old === null) {
  39            return 'green';
  40          }
  41          break;
  42      }
  43  
  44      return parent::getIcon();
  45    }
  46  
  47    public function getTitle() {
  48      $old = $this->getOldValue();
  49      $new = $this->getNewValue();
  50      $author_handle = $this->renderHandleLink($this->getAuthorPHID());
  51  
  52      switch ($this->getTransactionType()) {
  53        case self::TYPE_NAME:
  54          if ($old === null) {
  55            return pht(
  56              '%s created this build plan.',
  57              $author_handle);
  58          } else {
  59            return pht(
  60              '%s renamed this build plan from "%s" to "%s".',
  61              $author_handle,
  62              $old,
  63              $new);
  64          }
  65        case self::TYPE_STATUS:
  66          if ($new == HarbormasterBuildPlan::STATUS_DISABLED) {
  67            return pht(
  68              '%s disabled this build plan.',
  69              $author_handle);
  70          } else {
  71            return pht(
  72              '%s enabled this build plan.',
  73              $author_handle);
  74          }
  75      }
  76  
  77      return parent::getTitle();
  78    }
  79  
  80  }


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