[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class HarbormasterBuildTransaction 4 extends PhabricatorApplicationTransaction { 5 6 const TYPE_CREATE = 'harbormaster:build:create'; 7 const TYPE_COMMAND = 'harbormaster:build:command'; 8 9 public function getApplicationName() { 10 return 'harbormaster'; 11 } 12 13 public function getApplicationTransactionType() { 14 return HarbormasterBuildPHIDType::TYPECONST; 15 } 16 17 public function getTitle() { 18 $author_phid = $this->getAuthorPHID(); 19 20 $old = $this->getOldValue(); 21 $new = $this->getNewValue(); 22 23 switch ($this->getTransactionType()) { 24 case self::TYPE_CREATE: 25 return pht( 26 '%s created this build.', 27 $this->renderHandleLink($author_phid)); 28 case self::TYPE_COMMAND: 29 switch ($new) { 30 case HarbormasterBuildCommand::COMMAND_RESTART: 31 return pht( 32 '%s restarted this build.', 33 $this->renderHandleLink($author_phid)); 34 case HarbormasterBuildCommand::COMMAND_RESUME: 35 return pht( 36 '%s resumed this build.', 37 $this->renderHandleLink($author_phid)); 38 case HarbormasterBuildCommand::COMMAND_STOP: 39 return pht( 40 '%s stopped this build.', 41 $this->renderHandleLink($author_phid)); 42 } 43 } 44 return parent::getTitle(); 45 } 46 47 public function getIcon() { 48 $author_phid = $this->getAuthorPHID(); 49 50 $old = $this->getOldValue(); 51 $new = $this->getNewValue(); 52 53 switch ($this->getTransactionType()) { 54 case self::TYPE_CREATE: 55 return 'fa-plus'; 56 case self::TYPE_COMMAND: 57 switch ($new) { 58 case HarbormasterBuildCommand::COMMAND_RESTART: 59 return 'fa-backward'; 60 case HarbormasterBuildCommand::COMMAND_RESUME: 61 return 'fa-play'; 62 case HarbormasterBuildCommand::COMMAND_STOP: 63 return 'fa-stop'; 64 } 65 } 66 67 return parent::getIcon(); 68 } 69 70 public function getColor() { 71 $author_phid = $this->getAuthorPHID(); 72 73 $old = $this->getOldValue(); 74 $new = $this->getNewValue(); 75 76 switch ($this->getTransactionType()) { 77 case self::TYPE_CREATE: 78 return 'green'; 79 case self::TYPE_COMMAND: 80 switch ($new) { 81 case HarbormasterBuildCommand::COMMAND_STOP: 82 return 'red'; 83 } 84 } 85 return parent::getColor(); 86 } 87 }
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 |