[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorDashboardTransaction 4 extends PhabricatorApplicationTransaction { 5 6 const TYPE_NAME = 'dashboard:name'; 7 const TYPE_LAYOUT_MODE = 'dashboard:layoutmode'; 8 9 public function getApplicationName() { 10 return 'dashboard'; 11 } 12 13 public function getApplicationTransactionType() { 14 return PhabricatorDashboardDashboardPHIDType::TYPECONST; 15 } 16 17 public function getTitle() { 18 $author_phid = $this->getAuthorPHID(); 19 $object_phid = $this->getObjectPHID(); 20 21 $old = $this->getOldValue(); 22 $new = $this->getNewValue(); 23 24 $author_link = $this->renderHandleLink($author_phid); 25 26 $type = $this->getTransactionType(); 27 switch ($type) { 28 case self::TYPE_NAME: 29 if (!strlen($old)) { 30 return pht( 31 '%s created this dashboard.', 32 $author_link); 33 } else { 34 return pht( 35 '%s renamed this dashboard from "%s" to "%s".', 36 $author_link, 37 $old, 38 $new); 39 } 40 } 41 42 return parent::getTitle(); 43 } 44 45 public function getTitleForFeed(PhabricatorFeedStory $story) { 46 $author_phid = $this->getAuthorPHID(); 47 $object_phid = $this->getObjectPHID(); 48 49 $old = $this->getOldValue(); 50 $new = $this->getNewValue(); 51 52 $author_link = $this->renderHandleLink($author_phid); 53 $object_link = $this->renderHandleLink($object_phid); 54 55 $type = $this->getTransactionType(); 56 switch ($type) { 57 case self::TYPE_NAME: 58 if (!strlen($old)) { 59 return pht( 60 '%s created dashboard %s.', 61 $author_link, 62 $object_link); 63 } else { 64 return pht( 65 '%s renamed dashboard %s from "%s" to "%s".', 66 $author_link, 67 $object_link, 68 $old, 69 $new); 70 } 71 } 72 73 return parent::getTitleForFeed($story); 74 } 75 76 public function getColor() { 77 $old = $this->getOldValue(); 78 $new = $this->getNewValue(); 79 80 switch ($this->getTransactionType()) { 81 case self::TYPE_NAME: 82 if (!strlen($old)) { 83 return PhabricatorTransactions::COLOR_GREEN; 84 } 85 break; 86 } 87 88 return parent::getColor(); 89 } 90 91 public function shouldHide() { 92 $old = $this->getOldValue(); 93 $new = $this->getNewValue(); 94 95 switch ($this->getTransactionType()) { 96 case self::TYPE_LAYOUT_MODE: 97 return true; 98 } 99 return parent::shouldHide(); 100 } 101 }
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 |