[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory { 4 5 public function getPrimaryObjectPHID() { 6 return $this->getValue('phid'); 7 } 8 9 public function getRequiredHandlePHIDs() { 10 $required_phids = parent::getRequiredHandlePHIDs(); 11 $from_phid = $this->getStoryData()->getValue('movedFromPHID'); 12 if ($from_phid) { 13 $required_phids[] = $from_phid; 14 } 15 return $required_phids; 16 } 17 18 public function renderView() { 19 $data = $this->getStoryData(); 20 21 $author_phid = $data->getAuthorPHID(); 22 $author_link = $this->linkTo($author_phid); 23 $document_phid = $data->getValue('phid'); 24 25 $view = $this->newStoryView(); 26 $view->setAppIcon('phriction-dark'); 27 28 $action = $data->getValue('action'); 29 $verb = PhrictionActionConstants::getActionPastTenseVerb($action); 30 31 switch ($action) { 32 case PhrictionActionConstants::ACTION_MOVE_HERE: 33 $from_phid = $data->getValue('movedFromPHID'); 34 35 // Older feed stories may not have 'moved_from_phid', in that case 36 // we fall back to the default behaviour (hence the fallthrough) 37 if ($from_phid) { 38 $document_handle = $this->getHandle($document_phid); 39 $from_handle = $this->getHandle($from_phid); 40 $view->setTitle(pht( 41 '%s moved the document %s from %s to %s.', 42 $author_link, 43 $document_handle->renderLink(), 44 phutil_tag( 45 'a', 46 array( 47 'href' => $from_handle->getURI(), 48 ), 49 $from_handle->getURI()), 50 phutil_tag( 51 'a', 52 array( 53 'href' => $document_handle->getURI(), 54 ), 55 $document_handle->getURI()))); 56 break; 57 } 58 /* Fallthrough */ 59 default: 60 $view->setTitle(pht( 61 '%s %s the document %s.', 62 $author_link, 63 $verb, 64 $this->linkTo($document_phid))); 65 break; 66 } 67 68 $view->setImage($this->getHandle($author_phid)->getImageURI()); 69 switch ($action) { 70 case PhrictionActionConstants::ACTION_CREATE: 71 $content = $this->renderSummary($data->getValue('content')); 72 $view->appendChild($content); 73 break; 74 } 75 76 return $view; 77 } 78 79 public function renderText() { 80 $author_handle = $this->getHandle($this->getAuthorPHID()); 81 $author_name = $author_handle->getName(); 82 83 $document_handle = $this->getHandle($this->getPrimaryObjectPHID()); 84 $document_title = $document_handle->getLinkName(); 85 $document_uri = PhabricatorEnv::getURI($document_handle->getURI()); 86 87 $action = $this->getValue('action'); 88 $verb = PhrictionActionConstants::getActionPastTenseVerb($action); 89 90 $text = "{$author_name} {$verb} the document". 91 " {$document_title} {$document_uri}"; 92 93 return $text; 94 } 95 96 }
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 |