[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PholioUploadedImageView extends AphrontView { 4 5 private $image; 6 private $replacesPHID; 7 8 public function setReplacesPHID($replaces_phid) { 9 $this->replacesPHID = $replaces_phid; 10 return $this; 11 } 12 13 public function setImage(PholioImage $image) { 14 $this->image = $image; 15 return $this; 16 } 17 18 public function render() { 19 require_celerity_resource('pholio-edit-css'); 20 21 $image = $this->image; 22 $file = $image->getFile(); 23 $phid = $file->getPHID(); 24 $replaces_phid = $this->replacesPHID; 25 26 $remove = $this->renderRemoveElement(); 27 28 $title = id(new AphrontFormTextControl()) 29 ->setName('title_'.$phid) 30 ->setValue($image->getName()) 31 ->setSigil('image-title') 32 ->setLabel(pht('Title')); 33 34 $description = id(new PhabricatorRemarkupControl()) 35 ->setUser($this->getUser()) 36 ->setName('description_'.$phid) 37 ->setValue($image->getDescription()) 38 ->setSigil('image-description') 39 ->setLabel(pht('Description')); 40 41 $thumb_frame = phutil_tag( 42 'div', 43 array( 44 'class' => 'pholio-thumb-frame', 45 'style' => 'background-image: url('.$file->getThumb280x210URI().');', 46 )); 47 48 $handle = javelin_tag( 49 'div', 50 array( 51 'class' => 'pholio-drag-handle', 52 'sigil' => 'pholio-drag-handle', 53 )); 54 55 $content = hsprintf( 56 '<div class="pholio-thumb-box"> 57 <div class="pholio-thumb-title"> 58 %s 59 <div class="pholio-thumb-name">%s</div> 60 </div> 61 %s 62 </div> 63 <div class="pholio-image-details"> 64 %s 65 %s 66 </div>', 67 $remove, 68 $file->getName(), 69 $thumb_frame, 70 $title, 71 $description); 72 73 $input = phutil_tag( 74 'input', 75 array( 76 'type' => 'hidden', 77 'name' => 'file_phids[]', 78 'value' => $phid, 79 )); 80 81 $replaces_input = phutil_tag( 82 'input', 83 array( 84 'type' => 'hidden', 85 'name' => 'replaces['.$replaces_phid.']', 86 'value' => $phid, 87 )); 88 89 return javelin_tag( 90 'div', 91 array( 92 'class' => 'pholio-uploaded-image', 93 'sigil' => 'pholio-drop-image', 94 'meta' => array( 95 'filePHID' => $file->getPHID(), 96 'replacesPHID' => $replaces_phid, 97 ), 98 ), 99 array( 100 $handle, 101 $content, 102 $input, 103 $replaces_input, 104 )); 105 } 106 107 private function renderRemoveElement() { 108 return javelin_tag( 109 'a', 110 array( 111 'class' => 'button grey', 112 'sigil' => 'pholio-drop-remove', 113 ), 114 'X'); 115 } 116 117 }
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 |