예제 #1
0
 public function previewWindow()
 {
     #echo $this->getID();
     #$relPath = $this->getRelPath();
     #echo $this->A("FileMimetype");
     $BD = new Button("Datei\nherunterladen", "save");
     $BD->style("margin:10px;float:right;");
     $BD->windowRme("File", $this->getID(), "download");
     $BD->onclick("" . OnEvent::closePopup("File"));
     $display = "";
     if ($this->A("FileIsDir") == "0") {
         switch ($this->A("FileMimetype")) {
             case "image/jpeg":
             case "image/png":
             case "image/gif":
             case "image/svg":
             case "image/svg+xml":
                 $display .= "{$BD}<div style=\"clear:both;width:600px;max-height:450px;overflow:auto;\"><img style=\"margin:10px;max-width:560px;\" src=\"data:" . $this->A("FileMimetype") . ";base64," . base64_encode(file_get_contents($this->getID())) . "\" /></div>";
                 break;
             case "text/plain":
             case "text/x-php":
             case "text/x-c++":
                 $display = "{$BD}<div style=\"clear:both;width:600px;max-height:450px;overflow:auto;\"><p>" . highlight_file($this->ID, true) . "</p></div>";
                 break;
             case "application/pdf":
                 $display = "<script type=\"text/javascript\">" . OnEvent::window($this, "previewPDF") . OnEvent::closePopup("File") . "</script>";
                 break;
             default:
                 $display = "<div  class=\"highlight\">{$BD}<p style=\"padding-top:10px;\">Es steht leider keine Vorschau<br />für diesen Dateityp zur Verfügung.</p><div style=\"clear:both;\"></div>";
         }
     } else {
         $display = "Verzeichnis";
     }
     echo $display;
 }