[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/releeph/storage/ -> ReleephProductTransaction.php (source)

   1  <?php
   2  
   3  final class ReleephProductTransaction
   4    extends PhabricatorApplicationTransaction {
   5  
   6    const TYPE_ACTIVE = 'releeph:product:active';
   7  
   8    public function getApplicationName() {
   9      return 'releeph';
  10    }
  11  
  12    public function getApplicationTransactionType() {
  13      return ReleephProductPHIDType::TYPECONST;
  14    }
  15  
  16    public function getColor() {
  17      $old = $this->getOldValue();
  18      $new = $this->getNewValue();
  19  
  20      switch ($this->getTransactionType()) {
  21        case self::TYPE_ACTIVE:
  22          if ($new) {
  23            return 'green';
  24          } else {
  25            return 'black';
  26          }
  27          break;
  28      }
  29  
  30      return parent::getColor();
  31    }
  32  
  33    public function getIcon() {
  34      $old = $this->getOldValue();
  35      $new = $this->getNewValue();
  36  
  37      switch ($this->getTransactionType()) {
  38        case self::TYPE_ACTIVE:
  39          if ($new) {
  40            return 'fa-pencil';
  41          } else {
  42            return 'fa-times';
  43          }
  44          break;
  45      }
  46  
  47      return parent::getIcon();
  48    }
  49  
  50    public function getTitle() {
  51      $author_phid = $this->getAuthorPHID();
  52  
  53      $old = $this->getOldValue();
  54      $new = $this->getNewValue();
  55  
  56      switch ($this->getTransactionType()) {
  57        case self::TYPE_ACTIVE:
  58          if ($new) {
  59            return pht(
  60              '%s activated this product.',
  61              $this->renderHandleLink($author_phid));
  62          } else {
  63            return pht(
  64              '%s deactivated this product.',
  65              $this->renderHandleLink($author_phid));
  66          }
  67          break;
  68      }
  69  
  70      return parent::getTitle();
  71    }
  72  
  73    public function getTitleForFeed(PhabricatorFeedStory $story) {
  74      $author_phid = $this->getAuthorPHID();
  75      $object_phid = $this->getObjectPHID();
  76  
  77      $old = $this->getOldValue();
  78      $new = $this->getNewValue();
  79  
  80      switch ($this->getTransactionType()) {
  81        case self::TYPE_ACTIVE:
  82          if ($new) {
  83            return pht(
  84              '%s activated release product %s.',
  85              $this->renderHandleLink($author_phid),
  86              $this->renderHandleLink($object_phid));
  87          } else {
  88            return pht(
  89              '%s deactivated release product %s.',
  90              $this->renderHandleLink($author_phid),
  91              $this->renderHandleLink($object_phid));
  92          }
  93          break;
  94      }
  95  
  96      return parent::getTitleForFeed($story);
  97    }
  98  
  99    public function getNoEffectDescription() {
 100      switch ($this->getTransactionType()) {
 101        case self::TYPE_ACTIVE:
 102          return pht('The product is already in that state.');
 103      }
 104  
 105      return parent::getNoEffectDescription();
 106    }
 107  
 108  }


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