[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @concrete-extensible 5 */ 6 class PhabricatorApplicationTransactionFeedStory 7 extends PhabricatorFeedStory { 8 9 public function getPrimaryObjectPHID() { 10 return $this->getValue('objectPHID'); 11 } 12 13 public function getRequiredObjectPHIDs() { 14 return $this->getValue('transactionPHIDs'); 15 } 16 17 public function getRequiredHandlePHIDs() { 18 $phids = array(); 19 $phids[] = $this->getValue('objectPHID'); 20 foreach ($this->getValue('transactionPHIDs') as $xaction_phid) { 21 $xaction = $this->getObject($xaction_phid); 22 foreach ($xaction->getRequiredHandlePHIDs() as $handle_phid) { 23 $phids[] = $handle_phid; 24 } 25 } 26 return $phids; 27 } 28 29 protected function getPrimaryTransactionPHID() { 30 return head($this->getValue('transactionPHIDs')); 31 } 32 33 public function getPrimaryTransaction() { 34 return $this->getObject($this->getPrimaryTransactionPHID()); 35 } 36 37 public function getFieldStoryMarkupFields() { 38 $xaction_phids = $this->getValue('transactionPHIDs'); 39 40 $fields = array(); 41 foreach ($xaction_phids as $xaction_phid) { 42 $xaction = $this->getObject($xaction_phid); 43 foreach ($xaction->getMarkupFieldsForFeed($this) as $field) { 44 $fields[] = $field; 45 } 46 } 47 48 return $fields; 49 } 50 51 public function getMarkupText($field) { 52 $xaction_phids = $this->getValue('transactionPHIDs'); 53 54 foreach ($xaction_phids as $xaction_phid) { 55 $xaction = $this->getObject($xaction_phid); 56 foreach ($xaction->getMarkupFieldsForFeed($this) as $xaction_field) { 57 if ($xaction_field == $field) { 58 return $xaction->getMarkupTextForFeed($this, $field); 59 } 60 } 61 } 62 63 return null; 64 } 65 66 public function renderView() { 67 $view = $this->newStoryView(); 68 69 $handle = $this->getHandle($this->getPrimaryObjectPHID()); 70 $view->setHref($handle->getURI()); 71 72 $view->setAppIconFromPHID($handle->getPHID()); 73 74 $xaction_phids = $this->getValue('transactionPHIDs'); 75 $xaction = $this->getPrimaryTransaction(); 76 77 $xaction->setHandles($this->getHandles()); 78 $view->setTitle($xaction->getTitleForFeed($this)); 79 80 foreach ($xaction_phids as $xaction_phid) { 81 $secondary_xaction = $this->getObject($xaction_phid); 82 $secondary_xaction->setHandles($this->getHandles()); 83 84 $body = $secondary_xaction->getBodyForFeed($this); 85 if (nonempty($body)) { 86 $view->appendChild($body); 87 } 88 } 89 90 $view->setImage( 91 $this->getHandle($xaction->getAuthorPHID())->getImageURI()); 92 93 return $view; 94 } 95 96 public function renderText() { 97 $xaction = $this->getPrimaryTransaction(); 98 $old_target = $xaction->getRenderingTarget(); 99 $new_target = PhabricatorApplicationTransaction::TARGET_TEXT; 100 $xaction->setRenderingTarget($new_target); 101 $xaction->setHandles($this->getHandles()); 102 $text = $xaction->getTitleForFeed($this); 103 $xaction->setRenderingTarget($old_target); 104 return $text; 105 } 106 107 public function renderAsTextForDoorkeeper( 108 DoorkeeperFeedStoryPublisher $publisher) { 109 110 $xactions = array(); 111 $xaction_phids = $this->getValue('transactionPHIDs'); 112 foreach ($xaction_phids as $xaction_phid) { 113 $xaction = $this->getObject($xaction_phid); 114 $xaction->setHandles($this->getHandles()); 115 $xactions[] = $xaction; 116 } 117 118 $primary = $this->getPrimaryTransaction(); 119 return $primary->renderAsTextForDoorkeeper($publisher, $this, $xactions); 120 } 121 122 }
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 |