示例#1
0
function ew_GetFileViewTag($fld, $fn)
{
    if (!ew_EmptyStr($fn)) {
        if ($fld->IsBlobImage || ew_IsImageFile($fn)) {
            if ($fld->HrefValue == "" && !$fld->UseColorbox) {
                return "<img class=\"ewImage\" src=\"" . $fn . "\" alt=\"\"" . $fld->ViewAttributes() . ">";
            } else {
                return "<a" . $fld->LinkAttributes() . "><img class=\"ewImage\" src=\"" . $fn . "\" alt=\"\"" . $fld->ViewAttributes() . "></a>";
            }
        } else {
            if ($fld->FldDataType == EW_DATATYPE_BLOB) {
                $name = $fld->Upload->FileName != "" ? $fld->Upload->FileName : $fld->FldCaption();
            } else {
                $name = basename($fn);
            }
            return "<div><a href=\"" . $fn . "\">" . $name . "</a></div>";
        }
    } else {
        return "";
    }
}
示例#2
0
function ew_GetFileViewTag(&$fld, $val)
{
    global $Page;
    if (!ew_EmptyStr($val)) {
        if ($fld->UploadMultiple) {
            $wrkfiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $val);
        } else {
            $wrkfiles = array($val);
        }
        $bMultiple = count($wrkfiles) > 1;
        $href = $fld->HrefValue;
        $images = "";
        foreach ($wrkfiles as $wrkfile) {
            if ($fld->FldDataType == EW_DATATYPE_BLOB) {
                $fn = $val;
            } elseif ($Page && ($Page->TableType == "REPORT" && ($Page->Export == "excel" && defined('EW_USE_PHPEXCEL') || $Page->Export == "word" && defined('EW_USE_PHPWORD')) || $Page->TableType != "REPORT" && ($Page->CustomExport == "pdf" || $Page->CustomExport == "email"))) {
                $fn = ew_GetFileTempImage($fld, $wrkfile);
            } else {
                $fn = ew_GetFileUploadUrl($fld, $wrkfile, $fld->ImageResize);
            }
            if ($fld->FldViewTag == "IMAGE" && ($fld->IsBlobImage || ew_IsImageFile($wrkfile))) {
                if ($href == "" && !$fld->UseColorbox) {
                    $image = "<img class=\"ewImage\" src=\"" . $fn . "\"" . $fld->ViewAttributes() . ">";
                    //***
                } else {
                    if ($fld->UploadMultiple && strpos($href, "%u") !== FALSE) {
                        $fld->HrefValue = str_replace("%u", ew_GetFileUploadUrl($fld, $wrkfile), $href);
                    }
                    $image = "<a" . $fld->LinkAttributes() . "><img class=\"ewImage\" src=\"" . $fn . "\"" . $fld->ViewAttributes() . "></a>";
                    //***
                }
            } else {
                if ($fld->FldDataType == EW_DATATYPE_BLOB) {
                    $name = $fld->Upload->FileName != "" ? $fld->Upload->FileName : $fld->FldCaption();
                } else {
                    $name = basename($wrkfile);
                }
                $image = "<a href=\"" . $fn . "\">" . $name . "</a>";
            }
            if ($bMultiple) {
                $images .= "<li>" . $image . "</li>";
            } else {
                $images .= $image;
            }
        }
        if ($bMultiple && $images != "") {
            $images = "<ul class=\"list-inline\">" . $images . "</ul>";
        }
        return $images;
    } else {
        return "";
    }
}
示例#3
0
function ew_GetFileViewTag($fld, $fn)
{
    if ($fn != "") {
        if ($fld->IsBlobImage) {
            return "<img src=\"" . $fn . "\" alt=\"\"" . $fld->ViewAttributes() . ">";
        } elseif (ew_IsImageFile($fn)) {
            if ($fld->HrefValue == "") {
                return "<img src=\"" . $fn . "\" alt=\"\"" . $fld->ViewAttributes() . ">";
            } else {
                return "<a href=\"" . $fld->HrefValue . "\"><img src=\"" . $fn . "\" alt=\"\"" . $fld->ViewAttributes() . "></a>";
            }
        } else {
            if ($fld->FldDataType == EW_DATATYPE_BLOB) {
                return $fld->Upload->FileName != "" ? $fld->Upload->FileName : $fld->FldCaption();
            } else {
                return "<div><a href=\"" . $fn . "\">" . basename($fn) . "</a></div>";
            }
        }
    } else {
        return "";
    }
}