3 final class PholioMockEmbedView
extends AphrontView
{
6 private $images = array();
8 public function setMock(PholioMock
$mock) {
13 public function setImages(array $images) {
14 $this->images
= $images;
18 public function render() {
20 throw new PhutilInvalidStateException('setMock');
24 $images_to_show = array();
26 if (!empty($this->images
)) {
27 $images_to_show = array_intersect_key(
28 $this->mock
->getActiveImages(), array_flip($this->images
));
31 $xform = PhabricatorFileTransform
::getTransformByKey(
32 PhabricatorFileThumbnailTransform
::TRANSFORM_PINBOARD
);
34 if ($images_to_show) {
35 $image = head($images_to_show);
36 $thumbfile = $image->getFile();
37 $header = 'M'.$mock->getID().' '.$mock->getName().
38 ' (#'.$image->getID().')';
39 $uri = '/M'.$this->mock
->getID().'/'.$image->getID().'/';
41 $thumbfile = $mock->getCoverFile();
42 $header = 'M'.$mock->getID().' '.$mock->getName();
43 $uri = '/M'.$this->mock
->getID();
46 $thumbnail = $thumbfile->getURIForTransform($xform);
47 list($x, $y) = $xform->getTransformedDimensions($thumbfile);
49 $item = id(new PHUIPinboardItemView())
50 ->setUser($this->getUser())
54 ->setImageURI($thumbnail)
55 ->setImageSize($x, $y)
56 ->setDisabled($mock->isClosed())
57 ->addIconCount('fa-picture-o', count($mock->getActiveImages()))
58 ->addIconCount('fa-trophy', $mock->getTokenCount());