本文整理汇总了PHP中CFile::ShowFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::ShowFile方法的具体用法?PHP CFile::ShowFile怎么用?PHP CFile::ShowFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::ShowFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPrepareComments
function OnPrepareComments()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
$arMessages =& $arResult['MESSAGES'];
$arResult['FILES'] = array();
if (!empty($arMessages)) {
$res = array_keys($arMessages);
$arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED_AND_MINE" => $GLOBALS["USER"]->GetId(), ">MESSAGE_ID" => intVal(min($res)) - 1, "<MESSAGE_ID" => intVal(max($res)) + 1);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] == "Y") {
unset($arFilter["APPROVED_AND_MINE"]);
}
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && ($res = $db_files->Fetch())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $this->imageSize, $this->imageSize, true, "border=0", false);
$arMessages[$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"];
}
$arMessages[$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult['FILES'][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
}
}
}
示例2: addTableFileCell
function addTableFileCell($intPropID, $arPropInfo)
{
static $maxImageSize = null;
if (null === $maxImageSize) {
$maxImageSize = array("W" => COption::GetOptionString("iblock", "list_image_size"), "H" => COption::GetOptionString("iblock", "list_image_size"));
}
if (!array_key_exists('UF_FILE', $arPropInfo)) {
return '';
}
$arPropInfo["UF_FILE"] = intval($arPropInfo["UF_FILE"]);
if (!CModule::IncludeModule('fileman')) {
return '';
}
$strShowFile = '';
if (0 < $arPropInfo["UF_FILE"]) {
$strShowFile = CFile::ShowFile($arPropInfo["UF_FILE"], 0, $maxImageSize['W'], $maxImageSize['H'], false);
if ('' !== $strShowFile) {
$strShowFile .= '<br>';
}
}
return $strShowFile . CFile::InputFile("PROPERTY_DIRECTORY_VALUES[{$intPropID}][FILE]", 20, $arPropInfo["UF_FILE"], false, 0, "IMAGE", "", 0, "class=typeinput", "", true, false);
}
示例3: obtainProps
/**
* Function gets order properties from database
* @param mixed[] $cached Cached data taken from obtainDataCachedStructure()
* @return void
*/
protected function obtainProps(&$cached)
{
if (empty($this->dbResult["ID"])) {
return;
}
$props = array();
$dbOrderProps = CSaleOrderPropsValue::GetOrderProps($this->dbResult["ID"]);
$iGroup = -1;
while ($arOrderProps = $dbOrderProps->GetNext()) {
if (empty($this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]]) || !in_array($arOrderProps["ORDER_PROPS_ID"], $this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]])) {
if ($arOrderProps["ACTIVE"] == "Y" && $arOrderProps["UTIL"] == "N") {
$arOrderPropsTmp = $arOrderProps;
if ($iGroup != intval($arOrderProps["PROPS_GROUP_ID"])) {
$arOrderPropsTmp["SHOW_GROUP_NAME"] = "Y";
$iGroup = intval($arOrderProps["PROPS_GROUP_ID"]);
}
if ($arOrderProps["TYPE"] == "SELECT" || $arOrderProps["TYPE"] == "RADIO") {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
$arOrderPropsTmp["VALUE"] = htmlspecialcharsEx($arVal["NAME"]);
} elseif ($arOrderProps["TYPE"] == "MULTISELECT") {
$arOrderPropsTmp["VALUE"] = "";
$curVal = explode(",", $arOrderProps["VALUE"]);
for ($i = 0, $intCount = count($curVal); $i < $intCount; $i++) {
$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
if ($i > 0) {
$arOrderPropsTmp["VALUE"] .= ", ";
}
$arOrderPropsTmp["VALUE"] .= htmlspecialcharsEx($arVal["NAME"]);
}
} elseif ($arOrderProps["TYPE"] == "LOCATION") {
$locationName = "";
if (CSaleLocation::isLocationProMigrated()) {
$locationName = Location\Admin\LocationHelper::getLocationStringById($arOrderProps["VALUE"]);
} else {
$arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANGUAGE_ID);
$locationName .= !strlen($arVal["COUNTRY_NAME"]) ? "" : $arVal["COUNTRY_NAME"];
if (strlen($arVal["COUNTRY_NAME"]) && strlen($arVal["REGION_NAME"])) {
$locationName .= " - " . $arVal["REGION_NAME"];
} elseif (strlen($arVal["REGION_NAME"])) {
$locationName .= $arVal["REGION_NAME"];
}
if (strlen($arVal["COUNTRY_NAME"]) || strlen($arVal["REGION_NAME"])) {
$locationName .= " - " . $arVal["CITY_NAME"];
} elseif (strlen($arVal["CITY_NAME"])) {
$locationName .= $arVal["CITY_NAME"];
}
}
$arOrderPropsTmp["VALUE"] = $locationName;
} elseif ($arOrderProps["TYPE"] == "FILE") {
if (strpos($arOrderProps["VALUE"], ",") !== false) {
$fileValue = "";
$values = explode(",", $arOrderProps["VALUE"]);
if (self::isNonemptyArray($values)) {
foreach ($values as $fileId) {
$fileValue .= CFile::ShowFile(trim($fileId), 0, 90, 90, true) . "<br/>";
}
}
$arOrderPropsTmp["VALUE"] = $fileValue;
} else {
$arOrderPropsTmp["VALUE"] = CFile::ShowFile($arOrderProps["VALUE"], 0, 90, 90, true);
}
}
$props[] = $arOrderPropsTmp;
}
}
}
$cached["ORDER_PROPS"] = $props;
}
示例4: elseif
$bNeedLoop = $bBreakLoop = false;
if ($db_files && ($res = $db_files->Fetch())) {
$bNeedLoop = true;
} elseif ($bNeedFirstMessage) {
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $arResult["MESSAGE_FIRST"]["ID"]));
if ($db_files && ($res = $db_files->Fetch())) {
$bNeedLoop = $bBreakLoop = true;
}
}
while ($bNeedLoop) {
do {
$res["SRC"] = CFile::GetFileSRC($res["FILE_NAME"]);
if ($arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
}
if ($arResult["MESSAGE_FIRST"]["ID"] == $res["MESSAGE_ID"]) {
$arResult["MESSAGE_FIRST"]["FILES"][$res["FILE_ID"]] = $res;
if (!$bNeedFirstMessage) {
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
}
} else {
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
}
$arResult["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
$bNeedLoop = false;
if ($bNeedFirstMessage && !$bBreakLoop) {
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $arResult["MESSAGE_FIRST"]["ID"]));
if ($db_files && ($res = $db_files->Fetch())) {
示例5: intval
$arFilter["APPROVED"] = "Y";
$arFilterProps = $arFilter;
if (min($res) > 1)
$arFilterProps[">ID"] = $arFilter[">MESSAGE_ID"] = intval(min($res) - 1);
$arFilterProps["<ID"] = $arFilter["<MESSAGE_ID"] = intval(max($res) + 1);
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && $res = $db_files->Fetch())
{
do
{
$res["SRC"] = CFile::GetFileSRC($res);
if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"])
{
// attach for custom
$arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0,
$arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
$arMessages[$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"];
}
$arMessages[$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult["FILES"][$res["FILE_ID"]] = $res;
}while ($res = $db_files->Fetch());
}
if (!empty($arParams["USER_FIELDS"]))
{
$db_props = CForumMessage::GetList(array("ID" => "ASC"), $arFilterProps, false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
while ($db_props && ($res = $db_props->Fetch()))
{
$arMessages[$res["ID"]]["PROPS"] = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
}
}
/************** Message info ***************************************/
示例6: list
);*/
list($dbRecordsList, $dbRecordsList1) = CBPVirtualDocument::GetList(array(), array("ID" => $arParams["BP_ID"], "IBLOCK_ID" => $arParams["BLOCK_ID"], "CHECK_BP_VIRTUAL_PERMISSIONS" => "read"), false, false, $arSelectFields);
if ($arRecord = $dbRecordsList->GetNext()) {
$arKeys = array_keys($arRecord);
foreach ($arKeys as $key) {
if ($arDocumentFields[$key]["BaseType"] == "file") {
$ar = $arRecord[$key];
if (!is_array($ar)) {
$ar = array($ar);
}
$arRecord[$key] = "";
foreach ($ar as $v) {
if (strlen($arRecord[$key]) > 0) {
$arRecord[$key] .= " ";
}
$arRecord[$key] .= CFile::ShowFile($v, 100000, 300, 300, true);
}
}
if (is_array($arRecord[$key])) {
$ar = $arRecord[$key];
$arRecord[$key] = "";
foreach ($ar as $val) {
if (strlen($arRecord[$key]) > 0) {
$arRecord[$key] .= ", ";
}
$arRecord[$key] .= $val;
}
}
if (CheckDateTime($arRecord[$key])) {
$arRecord[$key] = FormatDateFromDB($arRecord[$key]);
}
示例7: array
$arResult["MESSAGE"]["FILES"] = array();
$db_res = CForumFiles::GetList(array(), array("MESSAGE_ID" => $arResult["MESSAGE"]["ID"]));
if ($db_res && ($res = $db_res->GetNext())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
$arResult["MESSAGE"]["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_res->GetNext());
}
$res = $arResult["MESSAGE"];
$res["POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
$res["POST_MESSAGE_TEXT"] = $parser->convert($res["POST_MESSAGE_TEXT"], $arAllow, "html", $res["FILES"]);
$res["FILES_PARSED"] = $parser->arFilesIDParsed;
// ************************message attach img****************************************
$res["ATTACH_IMG"] = "";
if (intVal($res["~ATTACH_IMG"]) > 0 && in_array($arResult["FORUM"]["ALLOW_UPLOAD"], array("Y", "A", "F"))) {
$res["ATTACH_IMG"] = CFile::ShowFile($res["~ATTACH_IMG"], 0, 300, 300, true, "border=0", false);
}
if (!empty($res["EDITOR_ID"])) {
$res["EDITOR_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["EDITOR_ID"]));
}
if (strLen(trim($res["EDIT_DATE"])) > 0) {
$res["EDIT_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["EDIT_DATE"], CSite::GetDateFormat()));
}
$arResult["MESSAGE"] = $res;
}
}
/************** Navigation *****************************************/
if (intVal($arResult["FORUM"]["FORUM_GROUP_ID"]) > 0) {
$PARENT_ID = intVal($arResult["FORUM"]["FORUM_GROUP_ID"]);
while ($PARENT_ID > 0) {
$res = $arResult["GROUPS"][$PARENT_ID];
示例8: while
$topics[$res["TOPIC_ID"]]["MESSAGES"][$res["ID"]] = $res;
$arResult["MESSAGE_LIST"][$res["ID"]] = $res;
} while ($res = $db_res->GetNext());
}
/************** Attach files ***************************************/
if (!empty($arResult["MESSAGE_LIST"])) {
$arFilter = array("@FILE_MESSAGE_ID" => array_keys($arResult["MESSAGE_LIST"]));
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && ($res = $db_files->Fetch())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
if ($arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
$res["TOPIC_ID"] = $arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["TOPIC_ID"];
$res["FORUM_ID"] = $arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FORUM_ID"];
// attach for custom
$topics[$res["TOPIC_ID"]]["MESSAGES"][$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
$topics[$res["TOPIC_ID"]]["MESSAGES"][$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
}
$topics[$res["TOPIC_ID"]]["MESSAGES"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
}
if (!empty($arParams["USER_FIELDS"])) {
$db_props = CForumMessage::GetList(array("ID" => "ASC"), array("@ID" => array_keys($arResult["MESSAGE_LIST"])), false, 0, array("SELECT" => $arParams["USER_FIELDS"]));
while ($db_props && ($res = $db_props->Fetch())) {
$props = array_intersect_key($res, array_flip($arParams["USER_FIELDS"]));
$arResult["MESSAGE_LIST"][$res["ID"]]["PROPS"] = $topics[$res["TOPIC_ID"]]["MESSAGES"][$res["ID"]]["PROPS"] = $props;
$arResult["MESSAGE_LIST"][$res["ID"]]["ALLOW"] = array_merge($arResult["MESSAGE_LIST"][$res["ID"]]["ALLOW"], array("USERFIELDS" => $props));
}
}
/************** Message info ***************************************/
示例9: elseif
}
$row->AddViewField("PROPERTY_" . $aProp['ID'], $PropV);
} elseif ($aProp['PROPERTY_TYPE'] == 'E') {
if ($t = GetElementName($arRes["PROPERTY_" . $aProp['ID']])) {
$row->AddViewField("PROPERTY_" . $aProp['ID'], $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("IBLOCK_ELSEARCH_ELEMENT_EDIT") . '">' . $t['ID'] . '</a>]');
}
}
} else {
$v = '';
$arPropMultVal = array();
$arPropMultValID = array();
$dbPVals = CIBlockElement::GetProperty($IBLOCK_ID, $arRes["ID"], $xxord, $xxby, array("ID" => $aProp['ID']));
while ($arPVals = $dbPVals->Fetch()) {
$res = '';
if ($aProp['PROPERTY_TYPE'] == 'F') {
$res = CFile::ShowFile($arPVals['VALUE'], 100000, 50, 50, true);
} elseif ($aProp['PROPERTY_TYPE'] == 'G') {
$t = CIBlockSection::GetByID($arPVals['VALUE']);
if ($t = $t->GetNext()) {
$res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminSectionEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("IBLOCK_ELSEARCH_SECTION_EDIT") . '">' . $t['ID'] . '</a>]';
}
} elseif ($aProp['PROPERTY_TYPE'] == 'E') {
if ($t = GetElementName($arPVals['VALUE'])) {
$res = $t['NAME'] . ' [<a href="' . htmlspecialcharsbx(CIBlock::GetAdminElementEditLink($t['IBLOCK_ID'], $t['ID'])) . '" title="' . GetMessage("IBLOCK_ELSEARCH_ELEMENT_EDIT") . '">' . $t['ID'] . '</a>]';
}
} else {
$res = htmlspecialcharsex($arPVals['VALUE_ENUM'] ? $arPVals['VALUE_ENUM'] : $arPVals['VALUE']);
}
$v .= ($v != '' ? ' / ' : '') . $res;
$arPropMultVal[] = $arPVals['VALUE_ENUM'] ? $arPVals['VALUE_ENUM'] : $arPVals['VALUE'];
$arPropMultValID[$arPVals['PROPERTY_VALUE_ID']] = $arPVals['VALUE'];
示例10: __ShowFileFieldTmp
function __ShowFileFieldTmp($name, $multiple, $key, $value, $form_name, $arParams)
{
echo CFile::InputFile($name . ($multiple ? '[' . $key . ']' : ''), 40, $value, false, 0, "");
if (IntVal($value) > 0) {
echo "<br>";
echo CFile::ShowFile($value, 5000000, 300, 300, true) . "<br>";
}
}