[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/layout/ -> PhabricatorFileLinkView.php (source)

   1  <?php
   2  
   3  final class PhabricatorFileLinkView extends AphrontView {
   4  
   5    private $fileName;
   6    private $fileDownloadURI;
   7    private $fileViewURI;
   8    private $fileViewable;
   9    private $filePHID;
  10    private $customClass;
  11  
  12    public function setCustomClass($custom_class) {
  13      $this->customClass = $custom_class;
  14      return $this;
  15    }
  16    public function getCustomClass() {
  17      return $this->customClass;
  18    }
  19  
  20    public function setFilePHID($file_phid) {
  21      $this->filePHID = $file_phid;
  22      return $this;
  23    }
  24    private function getFilePHID() {
  25      return $this->filePHID;
  26    }
  27  
  28    public function setFileViewable($file_viewable) {
  29      $this->fileViewable = $file_viewable;
  30      return $this;
  31    }
  32    private function getFileViewable() {
  33      return $this->fileViewable;
  34    }
  35  
  36    public function setFileViewURI($file_view_uri) {
  37      $this->fileViewURI = $file_view_uri;
  38      return $this;
  39    }
  40    private function getFileViewURI() {
  41      return $this->fileViewURI;
  42    }
  43  
  44    public function setFileDownloadURI($file_download_uri) {
  45      $this->fileDownloadURI = $file_download_uri;
  46      return $this;
  47    }
  48    private function getFileDownloadURI() {
  49      return $this->fileDownloadURI;
  50    }
  51  
  52    public function setFileName($file_name) {
  53      $this->fileName = $file_name;
  54      return $this;
  55    }
  56    private function getFileName() {
  57      return $this->fileName;
  58    }
  59  
  60    public function getMetadata() {
  61      return array(
  62        'phid'     => $this->getFilePHID(),
  63        'viewable' => $this->getFileViewable(),
  64        'uri'      => $this->getFileViewURI(),
  65        'dUri'     => $this->getFileDownloadURI(),
  66        'name'     => $this->getFileName(),
  67      );
  68    }
  69  
  70    public function render() {
  71      require_celerity_resource('phabricator-remarkup-css');
  72      require_celerity_resource('lightbox-attachment-css');
  73  
  74      $sigil       = null;
  75      $meta        = null;
  76      $mustcapture = false;
  77      if ($this->getFileViewable()) {
  78        $mustcapture = true;
  79        $sigil = 'lightboxable';
  80        $meta = $this->getMetadata();
  81      }
  82  
  83      $class = 'phabricator-remarkup-embed-layout-link';
  84      if ($this->getCustomClass()) {
  85        $class = $this->getCustomClass();
  86      }
  87  
  88      return javelin_tag(
  89        'a',
  90        array(
  91          'href'        => $this->getFileViewURI(),
  92          'class'       => $class,
  93          'sigil'       => $sigil,
  94          'meta'        => $meta,
  95          'mustcapture' => $mustcapture,
  96        ),
  97        $this->getFileName());
  98    }
  99  }


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