Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/view/ConpherenceFileWidgetView.php
| Show All 9 Lines | public function render() { | ||||
| $files_authors = $widget_data['files_authors']; | $files_authors = $widget_data['files_authors']; | ||||
| $files_html = array(); | $files_html = array(); | ||||
| foreach ($files as $file) { | foreach ($files as $file) { | ||||
| $icon_class = $file->getDisplayIconForMimeType(); | $icon_class = $file->getDisplayIconForMimeType(); | ||||
| $icon_view = phutil_tag( | $icon_view = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'file-icon sprite-docs '.$icon_class | 'class' => 'file-icon sprite-docs '.$icon_class, | ||||
| ), | ), | ||||
| ''); | ''); | ||||
| $file_view = id(new PhabricatorFileLinkView()) | $file_view = id(new PhabricatorFileLinkView()) | ||||
| ->setFilePHID($file->getPHID()) | ->setFilePHID($file->getPHID()) | ||||
| ->setFileName(id(new PhutilUTF8StringTruncator()) | ->setFileName(id(new PhutilUTF8StringTruncator()) | ||||
| ->setMaximumGlyphs(28) | ->setMaximumGlyphs(28) | ||||
| ->truncateString($file->getName())) | ->truncateString($file->getName())) | ||||
| ->setFileViewable($file->isViewableImage()) | ->setFileViewable($file->isViewableImage()) | ||||
| Show All 9 Lines | foreach ($files as $file) { | ||||
| } | } | ||||
| $date_text = phabricator_relative_date( | $date_text = phabricator_relative_date( | ||||
| $file->getDateCreated(), | $file->getDateCreated(), | ||||
| $this->getUser()); | $this->getUser()); | ||||
| $who_done_it = phutil_tag( | $who_done_it = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'file-uploaded-by' | 'class' => 'file-uploaded-by', | ||||
| ), | ), | ||||
| pht('%s%s.', $who_done_it_text, $date_text)); | pht('%s%s.', $who_done_it_text, $date_text)); | ||||
| $files_html[] = phutil_tag( | $files_html[] = phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'file-entry' | 'class' => 'file-entry', | ||||
| ), | ), | ||||
| array( | array( | ||||
| $icon_view, | $icon_view, | ||||
| $file_view, | $file_view, | ||||
| $who_done_it | $who_done_it, | ||||
| )); | )); | ||||
| } | } | ||||
| if (empty($files)) { | if (empty($files)) { | ||||
| $files_html[] = javelin_tag( | $files_html[] = javelin_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'no-files', | 'class' => 'no-files', | ||||
| 'sigil' => 'no-files'), | 'sigil' => 'no-files', | ||||
| ), | |||||
| pht('No files.')); | pht('No files.')); | ||||
| } | } | ||||
| return phutil_tag( | return phutil_tag( | ||||
| 'div', | 'div', | ||||
| array('class' => 'file-list'), | array('class' => 'file-list'), | ||||
| $files_html); | $files_html); | ||||
| } | } | ||||
| } | } | ||||