[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/conpherence/view/ -> ConpherenceFileWidgetView.php (source)

   1  <?php
   2  
   3  final class ConpherenceFileWidgetView extends ConpherenceWidgetView {
   4  
   5    public function render() {
   6      require_celerity_resource('sprite-docs-css');
   7      $conpherence = $this->getConpherence();
   8      $widget_data = $conpherence->getWidgetData();
   9      $files = $widget_data['files'];
  10      $files_authors = $widget_data['files_authors'];
  11      $files_html = array();
  12  
  13      foreach ($files as $file) {
  14        $icon_class = $file->getDisplayIconForMimeType();
  15        $icon_view = phutil_tag(
  16          'div',
  17          array(
  18            'class' => 'file-icon sprite-docs '.$icon_class,
  19          ),
  20          '');
  21        $file_view = id(new PhabricatorFileLinkView())
  22          ->setFilePHID($file->getPHID())
  23          ->setFileName(id(new PhutilUTF8StringTruncator())
  24            ->setMaximumGlyphs(28)
  25            ->truncateString($file->getName()))
  26          ->setFileViewable($file->isViewableImage())
  27          ->setFileViewURI($file->getBestURI())
  28          ->setCustomClass('file-title');
  29  
  30        $who_done_it_text = '';
  31        // system generated files don't have authors
  32        if ($file->getAuthorPHID()) {
  33          $who_done_it_text = pht(
  34            'By %s ',
  35            $files_authors[$file->getPHID()]->renderLink());
  36        }
  37        $date_text = phabricator_relative_date(
  38          $file->getDateCreated(),
  39          $this->getUser());
  40  
  41        $who_done_it = phutil_tag(
  42          'div',
  43          array(
  44            'class' => 'file-uploaded-by',
  45          ),
  46          pht('%s%s.', $who_done_it_text, $date_text));
  47  
  48        $files_html[] = phutil_tag(
  49          'div',
  50          array(
  51            'class' => 'file-entry',
  52          ),
  53          array(
  54            $icon_view,
  55            $file_view,
  56            $who_done_it,
  57          ));
  58      }
  59  
  60      if (empty($files)) {
  61        $files_html[] = javelin_tag(
  62          'div',
  63          array(
  64            'class' => 'no-files',
  65            'sigil' => 'no-files',
  66          ),
  67          pht('No files.'));
  68      }
  69  
  70      return phutil_tag(
  71        'div',
  72        array('class' => 'file-list'),
  73        $files_html);
  74  
  75    }
  76  
  77  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1