protected function renderResultList(array $macros, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($macros, 'PhabricatorFileImageMacro'); $viewer = $this->requireViewer(); $handles = $viewer->loadHandles(mpull($macros, 'getAuthorPHID')); $xform = PhabricatorFileTransform::getTransformByKey(PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD); $pinboard = new PHUIPinboardView(); foreach ($macros as $macro) { $file = $macro->getFile(); $item = id(new PHUIPinboardItemView())->setUser($viewer)->setObject($macro); if ($file) { $item->setImageURI($file->getURIForTransform($xform)); list($x, $y) = $xform->getTransformedDimensions($file); $item->setImageSize($x, $y); } if ($macro->getDateCreated()) { $datetime = phabricator_date($macro->getDateCreated(), $viewer); $item->appendChild(phutil_tag('div', array(), pht('Created on %s', $datetime))); } else { // Very old macros don't have a creation date. Rendering something // keeps all the pins at the same height and avoids flow issues. $item->appendChild(phutil_tag('div', array(), pht('Created in ages long past'))); } if ($macro->getAuthorPHID()) { $author_handle = $handles[$macro->getAuthorPHID()]; $item->appendChild(pht('Created by %s', $author_handle->renderLink())); } $item->setURI($this->getApplicationURI('/view/' . $macro->getID() . '/')); $item->setDisabled($macro->getisDisabled()); $item->setHeader($macro->getName()); $pinboard->addItem($item); } return $pinboard; }
protected function renderResultList(array $mocks, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($mocks, 'PholioMock'); $viewer = $this->requireViewer(); $board = new PHUIPinboardView(); foreach ($mocks as $mock) { $header = 'M' . $mock->getID() . ' ' . $mock->getName(); $item = id(new PHUIPinboardItemView())->setHeader($header)->setURI('/M' . $mock->getID())->setImageURI($mock->getCoverFile()->getThumb280x210URI())->setImageSize(280, 210)->setDisabled($mock->isClosed())->addIconCount('fa-picture-o', count($mock->getImages()))->addIconCount('fa-trophy', $mock->getTokenCount()); if ($mock->getAuthorPHID()) { $author_handle = $handles[$mock->getAuthorPHID()]; $datetime = phabricator_date($mock->getDateCreated(), $viewer); $item->appendChild(pht('By %s on %s', $author_handle->renderLink(), $datetime)); } $board->addItem($item); } return $board; }
protected function renderResultList(array $mocks, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($mocks, 'PholioMock'); $viewer = $this->requireViewer(); $handles = $viewer->loadHandles(mpull($mocks, 'getAuthorPHID')); $xform = PhabricatorFileTransform::getTransformByKey(PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD); $board = new PHUIPinboardView(); foreach ($mocks as $mock) { $image = $mock->getCoverFile(); $image_uri = $image->getURIForTransform($xform); list($x, $y) = $xform->getTransformedDimensions($image); $header = 'M' . $mock->getID() . ' ' . $mock->getName(); $item = id(new PHUIPinboardItemView())->setUser($viewer)->setHeader($header)->setObject($mock)->setURI('/M' . $mock->getID())->setImageURI($image_uri)->setImageSize($x, $y)->setDisabled($mock->isClosed())->addIconCount('fa-picture-o', count($mock->getImages()))->addIconCount('fa-trophy', $mock->getTokenCount()); if ($mock->getAuthorPHID()) { $author_handle = $handles[$mock->getAuthorPHID()]; $datetime = phabricator_date($mock->getDateCreated(), $viewer); $item->appendChild(pht('By %s on %s', $author_handle->renderLink(), $datetime)); } $board->addItem($item); } return $board; }
protected function renderResultList(array $macros, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($macros, 'PhabricatorFileImageMacro'); $viewer = $this->requireViewer(); $pinboard = new PHUIPinboardView(); foreach ($macros as $macro) { $file = $macro->getFile(); $item = new PHUIPinboardItemView(); if ($file) { $item->setImageURI($file->getThumb280x210URI()); $item->setImageSize(280, 210); } if ($macro->getDateCreated()) { $datetime = phabricator_date($macro->getDateCreated(), $viewer); $item->appendChild(phutil_tag('div', array(), pht('Created on %s', $datetime))); } else { // Very old macros don't have a creation date. Rendering something // keeps all the pins at the same height and avoids flow issues. $item->appendChild(phutil_tag('div', array(), pht('Created in ages long past'))); } if ($macro->getAuthorPHID()) { $author_handle = $handles[$macro->getAuthorPHID()]; $item->appendChild(pht('Created by %s', $author_handle->renderLink())); } $item->setURI($this->getApplicationURI('/view/' . $macro->getID() . '/')); $item->setDisabled($macro->getisDisabled()); $item->setHeader($macro->getName()); $pinboard->addItem($item); } return $pinboard; }