[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class HeraldRuleTransaction 4 extends PhabricatorApplicationTransaction { 5 6 const TYPE_EDIT = 'herald:edit'; 7 const TYPE_DISABLE = 'herald:disable'; 8 9 public function getApplicationName() { 10 return 'herald'; 11 } 12 13 public function getApplicationTransactionType() { 14 return HeraldRulePHIDType::TYPECONST; 15 } 16 17 public function getApplicationTransactionCommentObject() { 18 return new HeraldRuleTransactionComment(); 19 } 20 21 public function getColor() { 22 $old = $this->getOldValue(); 23 $new = $this->getNewValue(); 24 25 switch ($this->getTransactionType()) { 26 case self::TYPE_DISABLE: 27 if ($new) { 28 return 'red'; 29 } else { 30 return 'green'; 31 } 32 } 33 34 return parent::getColor(); 35 } 36 37 public function getActionName() { 38 $old = $this->getOldValue(); 39 $new = $this->getNewValue(); 40 41 switch ($this->getTransactionType()) { 42 case self::TYPE_DISABLE: 43 if ($new) { 44 return pht('Disabled'); 45 } else { 46 return pht('Enabled'); 47 } 48 } 49 50 return parent::getActionName(); 51 } 52 53 public function getIcon() { 54 $old = $this->getOldValue(); 55 $new = $this->getNewValue(); 56 57 switch ($this->getTransactionType()) { 58 case self::TYPE_DISABLE: 59 if ($new) { 60 return 'fa-pause'; 61 } else { 62 return 'fa-play'; 63 } 64 } 65 66 return parent::getIcon(); 67 } 68 69 70 public function getTitle() { 71 $author_phid = $this->getAuthorPHID(); 72 73 $old = $this->getOldValue(); 74 $new = $this->getNewValue(); 75 76 switch ($this->getTransactionType()) { 77 case self::TYPE_DISABLE: 78 if ($new) { 79 return pht( 80 '%s disabled this rule.', 81 $this->renderHandleLink($author_phid)); 82 } else { 83 return pht( 84 '%s enabled this rule.', 85 $this->renderHandleLink($author_phid)); 86 } 87 } 88 89 return parent::getTitle(); 90 } 91 92 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |