本文整理汇总了PHP中CFile::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::GetList方法的具体用法?PHP CFile::GetList怎么用?PHP CFile::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileData
/**
* Возвращает информацию о файле
*
* @param int|array $fid ID файла, либо массив ID файлов
* @return array - данные информация о файле
*/
public static function getFileData($fid)
{
if (!isset($fid)) {
return;
}
if (is_array($fid)) {
$rsFile = CFile::GetList(array(), array("@ID" => implode(",", $fid)));
} else {
$rsFile = CFile::GetByID($fid);
}
$ret = array();
while ($ifile = $rsFile->Fetch()) {
$ret[$ifile['ID']] = array("SRC" => P_UPLOAD . $ifile["SUBDIR"] . "/" . $ifile['FILE_NAME'], "WIDTH" => $ifile["WIDTH"], "HEIGHT" => $ifile["HEIGHT"], "DATA" => $ifile);
}
if (is_array($fid)) {
return $ret;
} else {
return $ret[$fid];
}
}
示例2: clearUpload
public function clearUpload(){
if (!CModule::IncludeModule("iblock")):
return false;
endif;
$res = CFile::GetList(array(), array("MODULE_ID"=>"iblock"));
while($res_arr = $res->GetNext()){
$arFilesDB[$res_arr["SUBDIR"]][] = $res_arr["FILE_NAME"];
}
foreach ($arFilesDB as $dir => $arFile) :
$dirUpload = $_SERVER["DOCUMENT_ROOT"]."/upload/".$dir."/";
$arDirUpload = scandir($dirUpload);
array_shift($arDirUpload); // удаляем из массива '.'
array_shift($arDirUpload); // удаляем из массива '..'
$arrayDiff = array_diff($arDirUpload, $arFile);
if (is_array($arrayDiff)):
foreach ($arrayDiff as $key => $fileName) :
$dirUnlinkFiles = $dirUpload.$fileName;
unlink($dirUnlinkFiles);
endforeach;
endif;
$this->removeDir($dirUpload);
endforeach;
return true;
}
示例3: array
$arInfoRecalc = @unserialize($arResult["GALLERY"]["~UF_GALLERY_RECALC"]);
if (empty($arInfoRecalc) || !is_array($arInfoRecalc) || $arInfoRecalc["STATUS"] == "DONE" || $sSatus != "CONTINUE") {
$arInfoRecalc = array("STEP" => 0, "LAST_ELEMENT_ID" => 0, "FILE_SIZE" => 0, "FILE_COUNT" => 0, "STATUS" => "BEGIN");
}
$arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "SUBSECTION" => array(array($arResult["GALLERY"]["LEFT_MARGIN"], $arResult["GALLERY"]["RIGHT_MARGIN"])), ">ID" => $arInfoRecalc["LAST_ELEMENT_ID"]);
$db_res = CIBlockElement::GetList(array("ID" => "ASC"), $arFilter, false, array("nTopCount" => $arResult["ROW_COUNT"]), array("PROPERTY_REAL_PICTURE"));
while ($res = $db_res->GetNextElement()) {
$arElement = $res->GetFields();
$arElements[] = $arElement;
if (intVal($arElement["PROPERTY_REAL_PICTURE_VALUE"]) > 0) {
$arFile["ID"][] = $arElement["PROPERTY_REAL_PICTURE_VALUE"];
}
$arInfoRecalc["LAST_ELEMENT_ID"] = $arElement["ID"];
}
if (!empty($arFile["ID"])) {
$db_res = CFile::GetList(array(), array("@ID" => implode(",", $arFile["ID"])));
while ($res = $db_res->Fetch()) {
$arFile["SIZE"] += doubleVal($res["FILE_SIZE"]);
$arFile["COUNT"]++;
}
}
$arInfoRecalc["STEP"]++;
$arInfoRecalc["LAST_ELEMENT_ID"] = $arInfoRecalc["LAST_ELEMENT_ID"];
$arInfoRecalc["FILE_SIZE"] = doubleVal($arInfoRecalc["FILE_SIZE"]) + doubleVal($arFile["SIZE"]);
$arInfoRecalc["FILE_COUNT"] = doubleVal($arInfoRecalc["FILE_COUNT"]) + doubleVal($arFile["COUNT"]);
$arInfoRecalc["STATUS"] = count($arFile["ID"]) < $arResult["ROW_COUNT"] ? "DONE" : "CONTINUE";
if ($arInfoRecalc["STATUS"] == "DONE") {
$arFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "UF_GALLERY_RECALC" => serialize($arInfoRecalc), "UF_GALLERY_SIZE" => $arInfoRecalc["FILE_SIZE"]);
$GLOBALS["UF_GALLERY_RECALC"] = $arFields["UF_GALLERY_RECALC"];
$GLOBALS["UF_GALLERY_SIZE"] = $arFields["UF_GALLERY_SIZE"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
示例4: _processFileCallback
function _processFileCallback($matches)
{
static $sImageAlign = '';
$bLink = false;
if ($matches[1] == ':') {
$bLink = true;
}
// if the internal file then get it
$sFile = $sFileName = $sPath = trim($matches[3]);
$bOur = false;
if (is_numeric($sFile) && in_array($sFile, $this->arFile)) {
$arFile = CFile::GetFileArray($sFile);
if ($arFile != false) {
$bOur = true;
$sPath = $arFile['SRC'];
$sFileName = $arFile['ORIGINAL_NAME'];
}
} else {
if (isset($this->arVersionFile[strtolower($sFile)])) {
$sPath = $this->arVersionFile[strtolower($sFile)];
$sFileName = $sFile;
} else {
if (!empty($this->arFile)) {
$arFilter = array('@ID' => implode(',', $this->arFile));
$rsFile = CFile::GetList(array(), $arFilter);
while ($arFile = $rsFile->Fetch()) {
if ($arFile['ORIGINAL_NAME'] == $sFile) {
$bOur = true;
$sFile = $arFile['ID'];
$sPath = CFile::GetFileSRC($arFile);
$sFileName = $arFile['ORIGINAL_NAME'];
break;
}
}
}
}
}
// if the image is processed as a picture
$sName = bx_basename($sPath);
if (CFile::IsImage($sName)) {
if ($bOur) {
$imageFile = CFile::MakeFileArray($sPath);
$checkRes = CFile::CheckImageFile($imageFile);
if ($checkRes != null) {
return $checkRes;
}
if ($bLink) {
$sReturn = '<a href="' . htmlspecialcharsbx($sPath) . '" title="' . ($s = htmlspecialcharsbx($sFileName)) . '">' . $s . '</a>';
} else {
$sReturn = CFile::ShowImage($sFile, COption::GetOptionString('wiki', 'image_max_width', 600), COption::GetOptionString('wiki', 'image_max_height', 600), 'border="0" align="' . $sImageAlign . '"');
}
} else {
if ($bLink) {
$sReturn = '<a href="' . htmlspecialcharsbx($sPath) . '" title="' . ($s = htmlspecialcharsbx($sName)) . '">' . $s . '</a>';
} else {
$sReturn = '<img src="' . htmlspecialcharsbx($sPath) . '" alt="' . htmlspecialcharsbx($sFileName) . '"/>';
}
}
} else {
if (strpos($sPath, 'http://') === 0) {
$sReturn = ' [ <a href="' . htmlspecialcharsbx($sFile) . '" title="' . GetMessage('FILE_FILE_DOWNLOAD') . '">' . GetMessage('FILE_DOWNLOAD') . '</a> ] ';
} else {
$sReturn = '[' . GetMessage('FILE_NAME') . ':' . htmlspecialcharsbx(is_numeric($sFile) || empty($sFileName) ? $sFile : $sFileName) . ']';
}
}
return $sReturn;
}
示例5: array
$arImageID = array();
//массив ID изображений
$sImageID = "";
//строка ID изображений через ",", для выборки из БД необходимых изображений
$index = 0;
//индекс для ID изображений
$dbImages;
//результат запроса к БД
$sImagePath = "";
//путь к изображению
$strImageStorePath = COption::GetOptionString("main", "upload_dir", "upload");
// путь к директории, где хранятся изображения
//имя информационного блока, по его хешу будет формироваться id слайдера
$sTypeId = CIBlock::GetByID($arParams["IBLOCK_ID"])->GetNext()["IBLOCK_TYPE_ID"];
$arResult["HTML_ID"] = "slider_" . SliderImageIndex::get();
$dbImages = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, false, array("ID", "NAME", "DETAIL_PICTURE", "DETAIL_TEXT"));
while ($arrImages = $dbImages->GetNext()) {
$arImageID[] = $arrImages["DETAIL_PICTURE"];
$arResult["IMAGES"][$arrImages["DETAIL_PICTURE"]]["ALT"] = $arrImages["DETAIL_TEXT"];
}
$sImageID = implode(",", $arImageID);
$dbImages = CFile::GetList(array(), array("@ID" => $sImageID));
while ($arrImages = $dbImages->GetNext()) {
$sImagePath = "/" . $strImageStorePath . "/" . $arrImages["SUBDIR"] . "/" . $arrImages["FILE_NAME"];
$arResult["IMAGES"][$arImageID[$index++]]["SRC"] = $sImagePath;
}
$this->IncludeComponentTemplate();
}
?>
示例6: getUFForPostForm
public static function getUFForPostForm($arParams)
{
$arFileData = array();
$arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], LANGUAGE_ID);
$ufCode = $arParams["UF_CODE"];
if (!empty($arUF[$ufCode]) && !empty($arUF[$ufCode]["VALUE"])) {
if ($arParams["IS_DISK_OR_WEBDAV_INSTALLED"]) {
if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::IncludeModule('disk')) {
$userFieldManager = \Bitrix\Disk\Driver::getInstance()->getUserFieldManager();
$urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
$userFieldManager->loadBatchAttachedObject($arUF[$ufCode]["VALUE"]);
foreach ($arUF[$ufCode]["VALUE"] as $attachedId) {
$attachedObject = $userFieldManager->getAttachedObjectById($attachedId);
if ($attachedObject) {
$file = $attachedObject->getObject();
$fileName = $file->getName();
$fileUrl = $urlManager->getUrlUfController('download', array('attachedId' => $attachedId));
$fileUrl = str_replace("/bitrix/tools/disk/uf.php", SITE_DIR . "mobile/ajax.php", $fileUrl);
$fileUrl = $fileUrl . (strpos($fileUrl, "?") === false ? "?" : "&") . "mobile_action=disk_uf_view&filename=" . $fileName;
if (\Bitrix\Disk\TypeFile::isImage($file) && ($realFile = $file->getFile())) {
$previewImageUrl = $urlManager->getUrlUfController('show', array('attachedId' => $attachedId, 'width' => 144, 'height' => 144, 'exact' => 'Y', 'signature' => \Bitrix\Disk\Security\ParameterSigner::getImageSignature($attachedId, 144, 144)));
} else {
$previewImageUrl = false;
}
$icon = CMobileHelper::mobileDiskGetIconByFilename($fileName);
$iconUrl = CComponentEngine::makePathFromTemplate('/bitrix/components/bitrix/mobile.disk.file.detail/images/' . $icon);
$fileFata = array('type' => $file->getExtension(), 'ufCode' => $ufCode, 'id' => $attachedId, 'extension' => $file->getExtension(), 'name' => $fileName, 'url' => $fileUrl, 'iconUrl' => $iconUrl);
if ($previewImageUrl) {
$fileFata['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
}
$arFileData[] = $fileFata;
}
}
} else {
$data = CWebDavIblock::getRootSectionDataForUser($GLOBALS["USER"]->GetID());
if (is_array($data)) {
$ibe = new CIBlockElement();
$dbWDFile = $ibe->GetList(array(), array('ID' => $arUF[$ufCode]["VALUE"], 'IBLOCK_ID' => $data["IBLOCK_ID"]), false, false, array('ID', 'IBLOCK_ID', 'PROPERTY_FILE'));
while ($arWDFile = $dbWDFile->Fetch()) {
if ($arFile = CFile::GetFileArray($arWDFile["PROPERTY_FILE_VALUE"])) {
if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
$imageResized = CFile::ResizeImageGet($arFile["ID"], array("width" => 144, "height" => 144), BX_RESIZE_IMAGE_EXACT, false, true);
$previewImageUrl = $imageResized["src"];
} else {
$previewImageUrl = false;
}
$fileExtension = GetFileExtension($arFile["FILE_NAME"]);
$fileData = array('type' => $fileExtension, 'ufCode' => $ufCode, 'id' => $arWDFile["ID"], 'extension' => $fileExtension, 'name' => $arFile["FILE_NAME"], 'url' => $arFile["SRC"]);
if ($previewImageUrl) {
$fileData['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
}
$arFileData[] = $fileData;
}
}
}
}
} else {
$dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arUF[$ufCode]["VALUE"])));
while ($arFile = $dbRes->GetNext()) {
if (CFile::IsImage($arFile["FILE_NAME"], $arFile["CONTENT_TYPE"])) {
$imageResized = CFile::ResizeImageGet($arFile["ID"], array("width" => 144, "height" => 144), BX_RESIZE_IMAGE_EXACT, false, true);
$previewImageUrl = $imageResized["src"];
} else {
$previewImageUrl = false;
}
$fileExtension = GetFileExtension($arFile["FILE_NAME"]);
$fileData = array('type' => $fileExtension, 'ufCode' => $ufCode, 'id' => $arFile["ID"], 'extension' => $fileExtension, 'name' => $arFile["FILE_NAME"], 'downloadUrl' => $arFile["SRC"]);
if ($previewImageUrl) {
$fileData['previewImageUrl'] = CHTTP::URN2URI($previewImageUrl);
}
$arFileData[] = $fileData;
}
}
}
return $arFileData;
}
示例7: md5
$arParams['MULTIPLE'] = $arParams['MULTIPLE'] == 'N' ? 'N' : 'Y';
if (!$arParams['INPUT_NAME'])
{
showError(GetMessage('MFI_ERR_NO_INPUT_NAME'));
return false;
}
$arResult['CONTROL_UID'] = md5(randString(15));
$_SESSION["MFI_UPLOADED_FILES_".$arResult['CONTROL_UID']] = array();
$arResult['FILES'] = array();
if (is_array($arParams['INPUT_VALUE']) && strlen(implode(",", $arParams["INPUT_VALUE"])) > 0)
{
$dbRes = CFile::GetList(array(), array("@ID" => implode(",", $arParams["INPUT_VALUE"])));
while ($arFile = $dbRes->GetNext())
{
$arFile['URL'] = CHTTP::URN2URI($APPLICATION->GetCurPageParam("mfi_mode=down&fileID=".$arFile['ID']."&cid=".$arResult['CONTROL_UID']."&".bitrix_sessid_get(), array("mfi_mode", "fileID", "cid")));
$arFile['FILE_SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']);
$arResult['FILES'][$arFile['ID']] = $arFile;
$_SESSION["MFI_UPLOADED_FILES_".$arResult['CONTROL_UID']][] = $arFile['ID'];
}
}
CUtil::InitJSCore(array('ajax'));
$this->IncludeComponentTemplate();
return $arParams['CONTROL_ID'];
示例8: intval
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arParams["LIVEFEED_ID"]));
}
}
$arFileID = array();
$arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "CHECK_PERMISSIONS" => "Y", "SECTION_ID" => $arResult["SECTION"]["ID"], "INCLUDE_SUBSECTIONS" => "N", "ACTIVE" => "Y");
$rsElement = CIBlockElement::GetList(array("ID" => "DESC"), $arFilter, false, false, array("ID", "DETAIL_PICTURE", "PROPERTY_REAL_PICTURE"));
while ($arElement = $rsElement->Fetch()) {
if (intval($arElement["PROPERTY_REAL_PICTURE_VALUE"]) > 0) {
$arFileID[] = $arElement["PROPERTY_REAL_PICTURE_VALUE"];
}
}
if (count($arFileID) > 0) {
$strFileID = implode(",", $arFileID);
$rsFile = CFile::GetList(array("ID" => "DESC"), array("@ID" => $strFileID));
while ($arFile = $rsFile->Fetch()) {
$arResult["SECTION_ELEMENTS_SRC"][$arFile["ID"]] = CFile::GetFileSRC($arFile, false, $arFile["HANDLER_ID"] > 0);
}
}
if (is_object($cache)) {
$arCacheData = array("SECTION_ELEMENTS_SRC" => $arResult["SECTION_ELEMENTS_SRC"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
}
示例9: array
$arFiles2TasksMap = array();
// Mapped FILE_ID to array of TASK_ID, that contains this file
$arFilesIds = array();
$rsTaskFiles = CTaskFiles::GetList(array(), array("TASK_ID" => $arTasksIDs));
while ($arTaskFile = $rsTaskFiles->Fetch()) {
$fileId = (int) $arTaskFile['FILE_ID'];
$taskId = (int) $arTaskFile['TASK_ID'];
$arFilesIds[] = $fileId;
if (!isset($arFiles2TasksMap['f' . $fileId])) {
$arFiles2TasksMap['f' . $fileId] = array();
}
$arFiles2TasksMap['f' . $fileId][] = $taskId;
}
$arFilesIds = array_unique($arFilesIds);
if (!empty($arFilesIds)) {
$rsFiles = CFile::GetList(array(), array('@ID' => implode(',', $arFilesIds)));
while ($arFile = $rsFiles->Fetch()) {
$arTasksIdsWithFile = array_unique($arFiles2TasksMap['f' . $arFile['ID']]);
foreach ($arTasksIdsWithFile as $taskId) {
$arResult['TASKS'][$taskId]['FILES'][] = $arFile;
}
}
}
}
$arResult["GROUPS"] = array();
$arOpenedProjects = CUserOptions::GetOption("tasks", "opened_projects", array());
if (!empty($arGroupsIDs)) {
$rsGroups = CSocNetGroup::GetList(array("ID" => "ASC"), array("ID" => $arGroupsIDs));
while ($arGroup = $rsGroups->GetNext()) {
$arGroup["EXPANDED"] = array_key_exists($arGroup["ID"], $arOpenedProjects) && $arOpenedProjects[$arGroup["ID"]] == "false" ? false : true;
$arResult["GROUPS"][$arGroup["ID"]] = $arGroup;
示例10: implode
?>
</div>
<?php
if ($arData["FILES"]) {
?>
<div class="webform-row task-attachments-row">
<div class="webform-field webform-field-attachments">
<ol class="webform-field-upload-list" id="webform-field-upload-list">
<?php
if (is_array($arData["FILES"])) {
$strFilesIds = implode(",", $arData["FILES"]);
} else {
$strFilesIds = $arData["FILES"];
}
$resFiles = CFile::GetList(array(), array("@ID" => $strFilesIds));
?>
<?php
while ($file = $resFiles->GetNext()) {
?>
<li class="saved"><a
href="/bitrix/components/bitrix/tasks.task.detail/show_file.php?fid=<?php
echo $file["ID"];
?>
"
target="_blank"
title="<?php
echo htmlspecialcharsbx($file["ORIGINAL_NAME"]);
?>
"
class="upload-file-name"><?php
示例11: ListAddEnumFieldsValue
//.........这里部分代码省略.........
}
}
$arReplaceValue[$ID][$FIELD_NAME] = '';
} else {
if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'file' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'employee' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_element' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'enumeration' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_section') {
$bSecondLoop = true;
$arVal = $arValue[$ID][$FIELD_NAME];
$arReplaceValue[$ID][$FIELD_NAME] = '';
if (!is_array($arVal)) {
$arVal = array($arVal);
}
foreach ($arVal as $value) {
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][$value] = $value;
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['ID'][] = $value;
}
} else {
if ($arUserField['MULTIPLE'] == 'Y' && is_array($arValue[$ID][$FIELD_NAME])) {
array_walk($arValue[$ID][$FIELD_NAME], create_function('&$v', '$v = htmlspecialcharsbx($v);'));
$arReplaceValue[$ID][$FIELD_NAME] = implode($delimiter, $arValue[$ID][$FIELD_NAME]);
}
}
}
}
}
}
unset($arUserField);
// The second loop for special field
if ($bSecondLoop) {
$arValueReplace = array();
$arList = array();
foreach ($arValuePrepare as $KEY => $VALUE) {
// collect multi data
if ($KEY == 'iblock_section') {
$dbRes = CIBlockSection::GetList(array('left_margin' => 'asc'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'file') {
$dbRes = CFile::GetList(array(), array('@ID' => implode(',', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'iblock_element') {
$dbRes = CIBlockElement::GetList(array('SORT' => 'DESC', 'NAME' => 'ASC'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'employee') {
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', array('ID' => implode('|', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'enumeration') {
foreach ($VALUE['ID'] as $___value) {
$rsEnum = CUserFieldEnum::GetList(array(), array('ID' => $___value));
while ($arRes = $rsEnum->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
}
} elseif ($KEY == 'crm') {
if (isset($VALUE['LEAD']) && !empty($VALUE['LEAD'])) {
$dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $VALUE['LEAD']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['LEAD'][$arRes['ID']] = $arRes;
}
}
示例12: getFileByHash
public static function getFileByHash($hash, $use_cache = true)
{
$param_string = serialize(func_get_args());
if ($use_cache) {
$result = static::getCache(__FUNCTION__ . $param_string . '_file');
}
if (empty($result['RESULT'])) {
$obFile = new \CFile();
$arFile = $obFile->GetList(array(), array("EXTERNAL_ID" => $hash))->GetNext();
$result['RESULT'] = $arFile;
static::setCache(__FUNCTION__ . $param_string . '_file', $result['RESULT']);
}
return $result['RESULT'];
}
示例13: str_replace
if (!$arTask["CHANGED_DATE"]) {
$arTask["CHANGED_DATE"] = $arTask["CREATED_DATE"];
$arTask["CHANGED_BY"] = $arTask["CREATED_BY"];
}
// Temporary fix for http://jabber.bx/view.php?id=29741
if (strpos($arTask['DESCRIPTION'], 'player/mediaplayer/player.swf') !== false) {
$arTask['~DESCRIPTION'] = str_replace(' src="/bitrix/components/bitrix/player/mediaplayer/player.swf" ', ' src="/bitrix/components/bitrix/player/mediaplayer/player" ', $arTask['~DESCRIPTION']);
$arTask['DESCRIPTION'] = str_replace(' src="/bitrix/components/bitrix/player/mediaplayer/player.swf" ', ' src="/bitrix/components/bitrix/player/mediaplayer/player" ', $arTask['DESCRIPTION']);
}
// group
if ($arTask["GROUP_ID"]) {
$arGroup = CSocNetGroup::GetByID($arTask["GROUP_ID"]);
$arTask["GROUP_NAME"] = $arGroup["NAME"];
}
if ($arTask["FILES"]) {
$rsFiles = CFile::GetList(array(), array("@ID" => implode(",", $arTask["FILES"])));
$arTask["FILES"] = array();
while ($file = $rsFiles->GetNext()) {
$arTask["FILES"][] = $file;
}
}
// comments files
$arTask["FORUM_FILES"] = array();
if ($arTask["FORUM_TOPIC_ID"]) {
$rsFiles = CForumFiles::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $arTask["FORUM_TOPIC_ID"]));
while ($arFile = $rsFiles->GetNext()) {
$arTask["FORUM_FILES"][] = $arFile;
}
}
// templates
$rsTemplates = CTaskTemplates::GetList(array("ID" => "DESC"), array("CREATED_BY" => $loggedInUserId, 'BASE_TEMPLATE_ID' => false, '!TPARAM_TYPE' => CTaskTemplates::TYPE_FOR_NEW_USER), array('NAV_PARAMS' => array('nTopCount' => 10)), array(), array('ID', 'TITLE', 'TASK_ID', 'REPLICATE_PARAMS'));
示例14: GetFilesData
public static function GetFilesData($arInput, $arFrom = null)
{
$arFiles = array();
if (is_array($arInput) && count($arInput) > 0) {
$dbFiles = CFile::GetList(array(), array("@ID" => implode(",", array_keys($arInput))));
while ($arFile = $dbFiles->GetNext()) {
$fileSrc = intval($arInput[$arFile['ID']]);
$fileUrl = CFile::GetFileSRC($arFile);
$fileLink = $fileUrl;
if (is_array($arFrom)) {
$fileLink = '/bitrix/tools/ajax_meeting.php?fileId=' . $arFile['ID'];
if ($arFrom['REPORT']) {
$fileLink .= '&reportId=' . intval($arFrom['REPORT']);
} elseif ($arFrom['ITEM']) {
$fileLink .= '&itemId=' . intval($arFrom['ITEM']);
} elseif ($arFrom['MEETING']) {
$fileLink .= '&meetingId=' . intval($arFrom['MEETING']);
}
}
$arFiles[] = array('ID' => $arFile['ID'], 'ORIGINAL_NAME' => $arFile['ORIGINAL_NAME'], 'FILE_SIZE' => $arFile['FILE_SIZE'], 'DOWNLOAD_URL' => CHTTP::URN2URI($fileLink), 'FILE_SIZE_FORMATTED' => CFile::FormatSize($arFile['FILE_SIZE']), 'FILE_SRC' => $fileSrc);
}
}
return $arFiles;
}
示例15: getAppFiles
/**
* Return files of the application
* @param $appCode - application code
* @return array
*/
public static function getAppFiles($appCode)
{
$result = AppTable::getById($appCode);
$appData = $result->fetchAll();
$files = array();
if (count($appData) > 0) {
//TODO fix, use module_id in the filter
$result = \CFile::GetList(array("ID" => "desc"), array("@ID" => implode(",", $appData[0]["FILES"])));
while ($file = $result->Fetch()) {
$image = \CFile::ResizeImageGet($file["ID"], array("width" => self::PREVIEW_IMAGE_SIZE, "height" => self::PREVIEW_IMAGE_SIZE), BX_RESIZE_IMAGE_EXACT, false, false, true);
$files["file_" . $file["ID"]] = array("id" => $file["ID"], "src" => \CFile::GetFileSRC($file), "preview" => $image["src"]);
}
}
return $files;
}