1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/conpherence/view/ConpherenceFileWidgetView.php
Joshua Spence 3cf9a5820f Minor formatting changes
Summary: Apply some autofix linter rules.

Test Plan: `arc lint` and `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D10585
2014-10-08 08:39:49 +11:00

77 lines
1.9 KiB
PHP

<?php
final class ConpherenceFileWidgetView extends ConpherenceWidgetView {
public function render() {
require_celerity_resource('sprite-docs-css');
$conpherence = $this->getConpherence();
$widget_data = $conpherence->getWidgetData();
$files = $widget_data['files'];
$files_authors = $widget_data['files_authors'];
$files_html = array();
foreach ($files as $file) {
$icon_class = $file->getDisplayIconForMimeType();
$icon_view = phutil_tag(
'div',
array(
'class' => 'file-icon sprite-docs '.$icon_class,
),
'');
$file_view = id(new PhabricatorFileLinkView())
->setFilePHID($file->getPHID())
->setFileName(id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(28)
->truncateString($file->getName()))
->setFileViewable($file->isViewableImage())
->setFileViewURI($file->getBestURI())
->setCustomClass('file-title');
$who_done_it_text = '';
// system generated files don't have authors
if ($file->getAuthorPHID()) {
$who_done_it_text = pht(
'By %s ',
$files_authors[$file->getPHID()]->renderLink());
}
$date_text = phabricator_relative_date(
$file->getDateCreated(),
$this->getUser());
$who_done_it = phutil_tag(
'div',
array(
'class' => 'file-uploaded-by',
),
pht('%s%s.', $who_done_it_text, $date_text));
$files_html[] = phutil_tag(
'div',
array(
'class' => 'file-entry',
),
array(
$icon_view,
$file_view,
$who_done_it,
));
}
if (empty($files)) {
$files_html[] = javelin_tag(
'div',
array(
'class' => 'no-files',
'sigil' => 'no-files',
),
pht('No files.'));
}
return phutil_tag(
'div',
array('class' => 'file-list'),
$files_html);
}
}