function _contentDownload($row)
 {
     global $Conf;
     if ($row->finalPaperStorageId != 0) {
         $finalsuffix = "f";
         $finaltitle = "Final version";
         $row->documentType = DTYPE_FINAL;
     } else {
         $finalsuffix = "";
         $finaltitle = null;
         $row->documentType = DTYPE_SUBMISSION;
     }
     if ($row->size == 0 || !$this->contact->can_view_pdf($row)) {
         return "";
     }
     if ($row->documentType == DTYPE_FINAL) {
         $this->any->final = true;
     }
     $this->any->paper = true;
     $t = "&nbsp;<a href=\"" . HotCRPDocument::url($row) . "\">";
     if ($row->mimetype == "application/pdf") {
         return $t . Ht::img("pdf{$finalsuffix}.png", "[PDF]", array("title" => $finaltitle)) . "</a>";
     } else {
         if ($row->mimetype == "application/postscript") {
             return $t . Ht::img("postscript{$finalsuffix}.png", "[PS]", array("title" => $finaltitle)) . "</a>";
         } else {
             return $t . Ht::img("generic{$finalsuffix}.png", "[Download]", array("title" => $finaltitle)) . "</a>";
         }
     }
 }
Esempio n. 2
0
function documentDownload($doc, $dlimg_class = "dlimg", $text = null, $no_size = false)
{
    global $Conf;
    $p = HotCRPDocument::url($doc);
    $finalsuffix = $doc->documentType == DTYPE_FINAL ? "f" : "";
    $sp = "&nbsp;";
    $imgsize = $dlimg_class[0] == "s" ? "" : "24";
    if ($doc->mimetype == "application/postscript") {
        $x = "<a href=\"{$p}\" class=\"q\">" . Ht::img("postscript{$finalsuffix}{$imgsize}.png", "[PS]", $dlimg_class);
    } else {
        if ($doc->mimetype == "application/pdf") {
            $x = "<a href=\"{$p}\" class=\"q\">" . Ht::img("pdf{$finalsuffix}{$imgsize}.png", "[PDF]", $dlimg_class);
        } else {
            $x = "<a href=\"{$p}\" class=\"q\">" . Ht::img("generic{$finalsuffix}{$imgsize}.png", "[Download]", $dlimg_class);
        }
    }
    if ($text) {
        $x .= $sp . $text;
    }
    if (isset($doc->size) && $doc->size > 0 && !$no_size) {
        $x .= "&nbsp;<span class=\"dlsize\">" . ($text ? "(" : "");
        if ($doc->size > 921) {
            $x .= round($doc->size / 1024);
        } else {
            $x .= max(round($doc->size / 102.4), 1) / 10;
        }
        $x .= "kB" . ($text ? ")" : "") . "</span>";
    }
    return $x . "</a>";
}