/** * Возвращает информацию о файле * * @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]; } }
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; }
$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);
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; }
$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(); } ?>
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; }
$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'];
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(); } } } }
$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;
?> </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
public function ListAddEnumFieldsValue($arParams, &$arValue, &$arReplaceValue, $delimiter = '<br />', $textonly = false, $arOptions = array()) { global $APPLICATION; $arUserFields = $this->GetUserFields($this->sEntityID, 0, LANGUAGE_ID); $bSecondLoop = false; $arValuePrepare = array(); if (!is_array($arOptions)) { $arOptions = array(); } // The first loop to collect all the data fields foreach ($arUserFields as $FIELD_NAME => &$arUserField) { foreach ($arValue as $ID => $data) { if (!isset($arValue[$ID][$FIELD_NAME]) && $arUserField['USER_TYPE']['USER_TYPE_ID'] != 'boolean') { continue; } if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'boolean') { if (isset($arValue[$ID][$FIELD_NAME])) { $arValue[$ID][$FIELD_NAME] == ($arValue[$ID][$FIELD_NAME] == 1 || $arValue[$ID][$FIELD_NAME] == 'Y' ? 'Y' : 'N'); } $arVal = $arValue[$ID][$FIELD_NAME]; if (!is_array($arVal)) { $arVal = array($arVal); } foreach ($arVal as $val) { $val = (string) $val; if (strlen($val) <= 0) { //Empty value is always 'N' (not default field value) $val = 'N'; } $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . ($val == 1 ? GetMessage('MAIN_YES') : GetMessage('MAIN_NO')); if ($arUserField['MULTIPLE'] == 'Y') { $arValue[$ID][$FIELD_NAME][] = $val == 1 || $val == 'Y' ? 'Y' : 'N'; } else { $arValue[$ID][$FIELD_NAME] = $val == 1 || $val == 'Y' ? 'Y' : 'N'; } } } elseif ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'crm_status') { $ar = CCrmStatus::GetStatusList($arUserField['SETTINGS']['ENTITY_TYPE']); $arReplaceValue[$ID][$FIELD_NAME] = isset($ar[$arValue[$ID][$FIELD_NAME]]) ? $ar[$arValue[$ID][$FIELD_NAME]] : ''; } else { if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'crm') { $arParams['CRM_ENTITY_TYPE'] = array(); if ($arUserField['SETTINGS']['LEAD'] == 'Y') { $arParams['CRM_ENTITY_TYPE'][] = 'LEAD'; } if ($arUserField['SETTINGS']['CONTACT'] == 'Y') { $arParams['CRM_ENTITY_TYPE'][] = 'CONTACT'; } if ($arUserField['SETTINGS']['COMPANY'] == 'Y') { $arParams['CRM_ENTITY_TYPE'][] = 'COMPANY'; } if ($arUserField['SETTINGS']['DEAL'] == 'Y') { $arParams['CRM_ENTITY_TYPE'][] = 'DEAL'; } $arParams['CRM_PREFIX'] = false; if (count($arParams['CRM_ENTITY_TYPE']) > 1) { $arParams['CRM_PREFIX'] = true; } $bSecondLoop = true; $arVal = $arValue[$ID][$FIELD_NAME]; if (!is_array($arVal)) { $arVal = array($arVal); } foreach ($arVal as $value) { if ($arParams['CRM_PREFIX']) { $ar = explode('_', $value); $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']][CUserTypeCrm::GetLongEntityType($ar[0])][] = intval($ar[1]); $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][CUserTypeCrm::GetLongEntityType($ar[0])][intval($ar[1])] = intval($ar[1]); } else { if (is_numeric($value)) { $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']][$arParams['CRM_ENTITY_TYPE'][0]][] = $value; $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][$arParams['CRM_ENTITY_TYPE'][0]][$value] = $value; } else { $ar = explode('_', $value); $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']][CUserTypeCrm::GetLongEntityType($ar[0])][] = intval($ar[1]); $arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][CUserTypeCrm::GetLongEntityType($ar[0])][intval($ar[1])] = intval($ar[1]); } } } $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; } } if (isset($VALUE['CONTACT']) && !empty($VALUE['CONTACT'])) { $dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $VALUE['CONTACT'])); while ($arRes = $dbRes->Fetch()) { $arList[$KEY]['CONTACT'][$arRes['ID']] = $arRes; } } if (isset($VALUE['COMPANY']) && !empty($VALUE['COMPANY'])) { $dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => $VALUE['COMPANY'])); while ($arRes = $dbRes->Fetch()) { $arList[$KEY]['COMPANY'][$arRes['ID']] = $arRes; } } if (isset($VALUE['DEAL']) && !empty($VALUE['DEAL'])) { $dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), array('ID' => $VALUE['DEAL'])); while ($arRes = $dbRes->Fetch()) { $arList[$KEY]['DEAL'][$arRes['ID']] = $arRes; } } } // assemble multi data foreach ($VALUE['FIELD'] as $ID => $arFIELD_NAME) { foreach ($arFIELD_NAME as $FIELD_NAME => $FIELD_VALUE) { foreach ($FIELD_VALUE as $FIELD_VALUE_NAME => $FIELD_VALUE_ID) { if ($KEY == 'iblock_section') { $sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']); $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname; } if ($KEY == 'iblock_element') { $sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']); if (!$textonly) { $surl = GetIBlockElementLinkById($arList[$KEY][$FIELD_VALUE_ID]['ID']); if ($surl && strlen($surl) > 0) { $sname = '<a href="' . $surl . '">' . $sname . '</a>'; } } $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname; } else { if ($KEY == 'employee') { $sname = CUser::FormatName(CSite::GetNameFormat(false), $arList[$KEY][$FIELD_VALUE_ID], false, true); if (!$textonly) { $ar['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_user_profile'), array('user_id' => $arList[$KEY][$FIELD_VALUE_ID]['ID'])); $sname = '<a href="' . $ar['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '">' . $sname . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . ', "balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '", "");</script>'; } $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname; } else { if ($KEY == 'enumeration') { $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['VALUE']); } else { if ($KEY == 'file') { $fileInfo = $arList[$KEY][$FIELD_VALUE_ID]; if ($textonly) { $fileUrl = CFile::GetFileSRC($fileInfo); } else { $fileUrlTemplate = isset($arOptions['FILE_URL_TEMPLATE']) ? $arOptions['FILE_URL_TEMPLATE'] : ''; $fileUrl = $fileUrlTemplate === '' ? CFile::GetFileSRC($fileInfo) : CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('owner_id' => $ID, 'field_name' => $FIELD_NAME, 'file_id' => $fileInfo['ID'])); } $sname = $textonly ? $fileUrl : '<a href="' . htmlspecialcharsbx($fileUrl) . '" target="_blank">' . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['FILE_NAME']) . '</a>'; $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname; } else { if ($KEY == 'crm') { foreach ($FIELD_VALUE_ID as $CID) { $link = ''; $title = ''; $prefix = ''; if ($FIELD_VALUE_NAME == 'LEAD') { $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $CID)); $title = $arList[$KEY]['LEAD'][$CID]['TITLE']; $prefix = 'L'; } elseif ($FIELD_VALUE_NAME == 'CONTACT') { $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $CID)); $title = CCrmContact::GetFullName($arList[$KEY]['CONTACT'][$CID], true); $prefix = 'C'; } elseif ($FIELD_VALUE_NAME == 'COMPANY') { $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $CID)); $title = $arList[$KEY]['COMPANY'][$CID]['TITLE']; $prefix = 'CO'; } elseif ($FIELD_VALUE_NAME == 'DEAL') { $link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $CID)); $title = $arList[$KEY]['DEAL'][$CID]['TITLE']; $prefix = 'D'; } $sname = htmlspecialcharsbx($title); if (!$textonly) { $tooltip = '<script type="text/javascript">BX.tooltip(' . $CID . ', "balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '", "/bitrix/components/bitrix/crm.' . strtolower($FIELD_VALUE_NAME) . '.show/card.ajax.php", "crm_balloon' . ($FIELD_VALUE_NAME == 'LEAD' || $FIELD_VALUE_NAME == 'DEAL' || $FIELD_VALUE_NAME == 'QUOTE' ? '_no_photo' : '_' . strtolower($FIELD_VALUE_NAME)) . '", true);</script>'; $sname = '<a href="' . $link . '" target="_blank" id="balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '">' . $sname . '</a>' . $tooltip; } else { $sname = "[{$prefix}]{$sname}"; } $arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname; } } } } } } } } } } } }
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']; }
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'));
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; }
/** * 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; }
protected function BuildOffers(&$allCategories) { $basePriceId = COption::GetOptionString($this->MODULE_ID, $this->CRM_CATALOG_BASE_PRICE . (is_null($this->profileID) === false ? '_' . $this->profileID : ''), 1); foreach ($this->iblocks as $key => $id) { // Get Info by infoblocks $iblock['IBLOCK_DB'] = CIBlock::GetByID($id)->Fetch(); $iblockOffer = CCatalogSKU::GetInfoByProductIBlock($id); $arSelect = array("ID", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "NAME", "DETAIL_PICTURE", "DETAIL_TEXT", "DETAIL_PICTURE", "LANG_DIR", "DETAIL_PAGE_URL", "CATALOG_GROUP_" . $basePriceId); // Set selected properties foreach ($this->propertiesProduct[$id] as $key => $propProduct) { if ($this->propertiesProduct[$id][$key] != "") { $arSelect[] = "PROPERTY_" . $propProduct; $arSelect[] = "PROPERTY_" . $propProduct . ".NAME"; } } $arSelectOffer = array('ID', 'ACTIVE', "NAME", "DETAIL_TEXT", "DETAIL_PAGE_URL", "DETAIL_PICTURE", 'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'], "CATALOG_GROUP_" . $basePriceId); // Set selected properties foreach ($this->propertiesSKU[$id] as $key => $propSKU) { if ($this->propertiesSKU[$id][$key] != "") { $arSelectOffer[] = "PROPERTY_" . $propSKU; $arSelectOffer[] = "PROPERTY_" . $propSKU . ".NAME"; } } // Set filter $filter = array("IBLOCK_ID" => $id); $order = array("id"); $arNavStatParams = array("iNumPage" => 1, "nPageSize" => $this->pageSize); // Cycle page to page do { // Get products on this page $elems = array(); $dbResProductsIds = CIBlockElement::GetList($order, $filter, false, $arNavStatParams, array('ID')); while ($obIds = $dbResProductsIds->Fetch()) { $elems[] = $obIds['ID']; } $arfilter = array("IBLOCK_ID" => $id, "ID" => $elems); $dbResProducts = CIBlockElement::GetList($order, $arfilter, false, false, $arSelect); $pictures = array(); $products = array(); while ($product = $dbResProducts->GetNext()) { // Compile products to array $products[$product['ID']] = $product; $products[$product['ID']]['offers'] = array(); $detailPicture = intval($product["DETAIL_PICTURE"]); $previewPicture = intval($product["PREVIEW_PICTURE"]); if ($detailPicture > 0 || $previewPicture > 0) { $picture = $detailPicture; if ($picture <= 0) { $picture = $previewPicture; } // Link pictureID and productID $pictures[$picture] = $product['ID']; } } unset($product); unset($detailPicture, $previewPicture, $picture); $pictureIDs = array_keys($pictures); // Get pathes of pictures $dbFiles = CFile::GetList(array(), array("@ID" => implode(',', $pictureIDs))); while ($file = $dbFiles->GetNext()) { // Link picture to product $products[$pictures[$file['ID']]]['PICTURE'] = ($_SERVER["HTTPS"] == 'on' ? "https://" : "http://") . $this->serverName . '/upload/' . $file['SUBDIR'] . '/' . $file['FILE_NAME']; } unset($pictures); if (!empty($iblockOffer['IBLOCK_ID'])) { $arFilterOffer = array('IBLOCK_ID' => $iblockOffer['IBLOCK_ID'], 'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => array_keys($products)); // Get all offers for products on this page $dbResOffers = CIBlockElement::GetList(array(), $arFilterOffer, false, array('nTopCount' => $this->pageSize * $this->offerPageSize), $arSelectOffer); while ($offer = $dbResOffers->GetNext()) { // Link offers to products $products[$offer['PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] . '_VALUE']]['offers'][$offer['ID']] = $offer; } unset($offer, $dbResOffers); } $stringOffers = ""; foreach ($products as $product) { // Get properties of product $resPropertiesProduct = array(); foreach ($this->propertiesProduct[$id] as $key => $propProduct) { $resPropertiesProduct[$key] = ""; if ($propProduct != "") { if (isset($product["PROPERTY_" . $propProduct . "_NAME"])) { $resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_NAME"]; } elseif (isset($product["PROPERTY_" . $propProduct . "_VALUE"])) { $resPropertiesProduct[$key] = $product["PROPERTY_" . $propProduct . "_VALUE"]; } elseif (isset($product[$propProduct])) { $resPropertiesProduct[$key] = $product[$propProduct]; } if (array_key_exists($key, $this->propertiesUnitProduct[$id])) { $resPropertiesProduct[$key] *= $this->measurement[$this->propertiesUnitProduct[$id][$key]]; $resPropertiesProduct[$key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitProduct[$id][$key]]; } } } // Get categories of product $categories = array(); $dbResCategories = CIBlockElement::GetElementGroups($product['ID'], true); while ($arResCategory = $dbResCategories->Fetch()) { $categories[$arResCategory["ID"]] = array('ID' => $arResCategory["ID"], 'NAME' => $arResCategory["NAME"]); } if (count($categories) == 0) { $catId = $this->mainSection + $id; $categories[$catId] = $allCategories[$catId]; } $existOffer = false; if (!empty($iblockOffer['IBLOCK_ID'])) { foreach ($product['offers'] as $offer) { $offer['PRODUCT_ID'] = $product["ID"]; $offer['DETAIL_PAGE_URL'] = $product["DETAIL_PAGE_URL"]; $offer['PICTURE'] = $product["PICTURE"]; $offer['PRODUCT_NAME'] = $product["NAME"]; $offer['PRODUCT_ACTIVE'] = $product["ACTIVE"]; $offer['PRICE'] = $offer['CATALOG_PRICE_' . $basePriceId]; $offer['PURCHASE_PRICE'] = $offer['CATALOG_PURCHASING_PRICE']; $offer['QUANTITY'] = $offer["CATALOG_QUANTITY"]; // Get properties of product foreach ($this->propertiesSKU[$id] as $key => $propSKU) { if ($propSKU != "") { if (isset($offer["PROPERTY_" . $propSKU . "_NAME"])) { $offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_NAME"]; } elseif (isset($offer["PROPERTY_" . $propSKU . "_VALUE"])) { $offer['_PROP_' . $key] = $offer["PROPERTY_" . $propSKU . "_VALUE"]; } elseif (isset($offer[$propSKU])) { $offer['_PROP_' . $key] = $offer[$propSKU]; } if (array_key_exists($key, $this->propertiesUnitSKU[$id])) { $offer['_PROP_' . $key] *= $this->measurement[$this->propertiesUnitSKU[$id][$key]]; $offer['_PROP_' . $key . "_UNIT"] = $this->measurementLink[$this->propertiesUnitSKU[$id][$key]]; } } } foreach ($resPropertiesProduct as $key => $propProduct) { if ($this->propertiesProduct[$id][$key] != "" && !isset($offer[$key])) { $offer['_PROP_' . $key] = $propProduct; } } $stringOffers .= $this->BuildOffer($offer, $categories, $iblock, $allCategories); $existOffer = true; } } if (!$existOffer) { $product['PRODUCT_ID'] = $product["ID"]; $product['PRODUCT_NAME'] = $product["NAME"]; $product['PRODUCT_ACTIVE'] = $product["ACTIVE"]; $product['PRICE'] = $product['CATALOG_PRICE_' . $basePriceId]; $product['PURCHASE_PRICE'] = $product['CATALOG_PURCHASING_PRICE']; $product['QUANTITY'] = $product["CATALOG_QUANTITY"]; foreach ($resPropertiesProduct as $key => $propProduct) { if ($this->propertiesProduct[$id][$key] != "" || $this->propertiesProduct[$id][str_replace("_UNIT", "", $key)] != "") { $product['_PROP_' . $key] = $propProduct; } } $stringOffers .= $this->BuildOffer($product, $categories, $iblock, $allCategories); } } unset($products); if ($this->isLogged) { $this->WriteLog($this->pageSize * $arNavStatParams['iNumPage'] . " product(s) has been loaded from " . $id . " IB (memory usage: " . memory_get_usage() . ")"); } if ($stringOffers != "") { $this->WriteOffers($stringOffers); $stringOffers = ""; } $arNavStatParams['iNumPage'] = $dbResProductsIds->NavPageNomer + 1; } while ($dbResProductsIds->NavPageNomer < $dbResProductsIds->NavPageCount); } }
/** * @param integer $taskId * @param array $arFilesIds * @return bool */ public static function CheckFieldsMultiple($taskId, $arFilesIds) { /** * @global CMain $APPLICATION */ global $APPLICATION; $arMsg = array(); if (!($taskId > 0)) { $arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID"), "id" => "ERROR_TASKS_BAD_TASK_ID"); } else { /** @noinspection PhpDeprecationInspection */ $r = CTasks::GetByID($taskId, false); if (!$r->Fetch()) { $arMsg[] = array("text" => GetMessage("TASKS_BAD_TASK_ID_EX"), "id" => "ERROR_TASKS_BAD_TASK_ID_EX"); } } if (!is_array($arFilesIds)) { $arMsg[] = array("text" => GetMessage("TASKS_BAD_FILE_ID"), "id" => "ERROR_TASKS_BAD_FILE_ID"); } elseif (!empty($arFilesIds)) { $arFilesIds = array_unique($arFilesIds); $arNotFetchedFilesIds = $arFilesIds; /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $r = CFile::GetList(array(), array('@ID' => implode(',', $arFilesIds))); while ($ar = $r->Fetch()) { $fileId = (int) $ar['ID']; $key = array_search($fileId, $arFilesIds); if ($key !== false) { unset($arNotFetchedFilesIds[$key]); } } if (count($arNotFetchedFilesIds)) { $arMsg[] = array("text" => GetMessage("TASKS_BAD_FILE_ID_EX"), "id" => "ERROR_TASKS_BAD_FILE_ID_EX"); } } if (!empty($arMsg)) { $e = new CAdminException($arMsg); $APPLICATION->ThrowException($e); return false; } return true; }
public static function GetChanges($currentFields, $newFields) { $arChanges = array(); array_walk($currentFields, array("CTaskLog", "UnifyFields")); array_walk($newFields, array("CTaskLog", "UnifyFields")); $currentFields["STATUS"] = $currentFields["REAL_STATUS"]; foreach ($newFields as $key => $value) { if (array_key_exists($key, self::$arComparedFields) && $currentFields[$key] != $newFields[$key]) { if ($key == "FILES") { $arDeleted = array_diff($currentFields[$key], $newFields[$key]); if (sizeof($arDeleted) > 0) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $rsFiles = CFile::GetList(array(), array("@ID" => implode(",", $arDeleted))); $arFilesNames = array(); while ($arFile = $rsFiles->Fetch()) { $arFilesNames[] = $arFile["ORIGINAL_NAME"]; } if (sizeof($arFilesNames)) { $arChanges["DELETED_FILES"] = array("FROM_VALUE" => implode(", ", $arFilesNames), "TO_VALUE" => false); } } $arNew = array_diff($newFields[$key], $currentFields[$key]); if (sizeof($arNew) > 0) { /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $rsFiles = CFile::GetList(array(), array("@ID" => implode(",", $arNew))); $arFilesNames = array(); while ($arFile = $rsFiles->Fetch()) { $arFilesNames[] = $arFile["ORIGINAL_NAME"]; } if (sizeof($arFilesNames)) { $arChanges["NEW_FILES"] = array("FROM_VALUE" => false, "TO_VALUE" => implode(", ", $arFilesNames)); } } } else { if (self::$arComparedFields[$key] == "text") { $currentFields[$key] = false; $newFields[$key] = false; } elseif (self::$arComparedFields[$key] == "array") { $currentFields[$key] = implode(",", $currentFields[$key]); $newFields[$key] = implode(",", $newFields[$key]); } $arChanges[$key] = array("FROM_VALUE" => $currentFields[$key] || $key == "PRIORITY" ? $currentFields[$key] : false, "TO_VALUE" => $newFields[$key] || $key == "PRIORITY" ? $newFields[$key] : false); } } } return $arChanges; }
</div> <div class="webform-row task-description-row"> <?php $APPLICATION->IncludeComponent("bitrix:tasks.task.detail.parts", ".default", array('MODE' => 'CREATE TASK FORM', 'BLOCKS' => array("checklist"), 'IS_IFRAME' => $arResult['IS_IFRAME'], 'GROUP_ID' => $arParams['GROUP_ID'], 'PATH_TO_TASKS_TASK' => $arParams['PATH_TO_TASKS_TASK'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'ALLOWED_ACTIONS' => array('ACTION_CHECKLIST_ADD_ITEMS' => true), 'TASK_ID' => $arResult['DATA']['ID'], 'CHECKLIST_ITEMS' => $arResult['DATA']['CHECKLIST_ITEMS']), null, array('HIDE_ICONS' => 'Y')); ?> </div> <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 ($arData["FILES"]) { ?> <?php $resFiles = CFile::GetList(array(), array("@ID" => implode(",", $arData["FILES"]))); ?> <?php while ($file = $resFiles->GetNext()) { ?> <li class="saved"><a href="/bitrix/components/bitrix/tasks.task.detail/show_file.php?fid=<?php echo $file["ID"]; ?> &tid=<?php echo $arParams["TEMPLATE_ID"]; ?> " target="_blank" class="upload-file-name"><?php echo $file["FILE_NAME"]; ?> </a><i></i><a href="" class="delete-file"></a><input type="hidden" name="FILES[]" value="<?php echo $file["ID"];
unset($filterItem); $arUserDistinct = array(); $arUserInfo = array(); $arEventDescr = array(); while ($arEvent = $obRes->Fetch()) { $arEvent['PATH_TO_EVENT_DELETE'] = CHTTP::urlAddParams($arParams['PATH_TO_EVENT_LIST'], array('action_' . $arResult['GRID_ID'] => 'delete', 'ID' => $arEvent['ID'], 'sessid' => bitrix_sessid())); $arEvent['~FILES'] = $arEvent['FILES']; //$arEvent['~EVENT_NAME'] = $arEvent['EVENT_NAME']; $arUserDistinct[intval($arEvent['USER_ID'])] = true; $arEvent['DATE_CREATE'] = $arEvent['DATE_CREATE']; //$arEvent['EVENT_NAME'] = htmlspecialcharsbx($arEvent['~EVENT_NAME']); if (!empty($arEvent['FILES'])) { $i = 1; $arFiles = array(); $arFilter = array('@ID' => implode(',', $arEvent['FILES'])); $rsFile = CFile::GetList(array(), $arFilter); while ($arFile = $rsFile->Fetch()) { $arFiles[$i++] = array('NAME' => $arFile['ORIGINAL_NAME'], 'PATH' => CComponentEngine::MakePathFromTemplate('/bitrix/components/bitrix/crm.event.view/show_file.php?eventId=#event_id#&fileId=#file_id#', array('event_id' => $arEvent['ID'], 'file_id' => $arFile['ID'])), 'SIZE' => CFile::FormatSize($arFile['FILE_SIZE'], 1)); } $arEvent['FILES'] = $arFiles; } //$arEntityList[$arEvent['ENTITY_TYPE']][$arEvent['ENTITY_ID']] = $arEvent['ENTITY_ID']; $arEvent['~EVENT_NAME'] = $arResult['EVENT_TYPES'][$arEvent['TYPE']]; $arEvent['EVENT_NAME'] = htmlspecialcharsbx($arEvent['~EVENT_NAME']); $arEventDescr = $event->GetRecordDescription($arEvent['TYPE'], $arEvent['DATA']); if ($arEventDescr) { $arEvent['EVENT_INFO'] = strip_tags($arEventDescr['INFO'], '<br>'); if (strlen($arEvent['EVENT_INFO']) > 255) { $arEvent['EVENT_DESC'] = '<div id="event_desc_short_' . $arEvent['ID'] . '">' . substr($arEvent['EVENT_INFO'], 0, 252) . '... <a href="#more" onclick="crm_event_desc(' . $arEvent['ID'] . ')">' . GetMessage('CRM_EVENT_DESC_MORE') . '</a></div>'; $arEvent['EVENT_DESC'] .= '<div id="event_desc_full_' . $arEvent['ID'] . '" style="display: none">' . $arEvent['EVENT_INFO'] . '</div>'; } else {
function CheckFileByName($file, $fields = null) { $external_id = $file; $fileName = bx_basename($file); if (!empty($fields) && $fileName != "") { if (empty($this->arElementFiles)) { $this->arElementFiles = array(); $ID = array(); foreach ($this->arElementFilesId as $fileId) { foreach ($fileId as $value) { $ID[$value] = $value; } } $rsFile = CFile::GetList(array(), array("@ID" => implode(",", $ID))); while ($arFile = $rsFile->Fetch()) { $arFile["~ORIGINAL_NAME"] = preg_replace("/(\\.resize[0-9]+\\.)/", ".", $arFile["ORIGINAL_NAME"]); $this->arElementFiles[$arFile["ID"]] = $arFile; } } foreach ($fields as $fieldId) { if (isset($this->arElementFilesId[$fieldId])) { foreach ($this->arElementFilesId[$fieldId] as $fileId) { if (isset($this->arElementFiles[$fileId])) { if ($this->arElementFiles[$fileId]["EXTERNAL_ID"] === $external_id) { return $fileId; } if ($this->arElementFiles[$fileId]["~ORIGINAL_NAME"] === $fileName) { return $fileId; } } } } } } return false; }
$arTask['META::STATUS_FORMATTED_NAME'] .= ' ' . GetMessage('MB_TASKS_TASK_DETAIL_STATUS_DATE_PREPOSITION') . ' ' . CTasksTools::FormatDatetimeBeauty($arTask['STATUS_CHANGED_DATE'], array(), $arParams['DATE_TIME_FORMAT']); $arTask['META:DEADLINE_FORMATTED'] = ''; if (MakeTimeStamp($arTask['DEADLINE']) > 86400) { $arTask['META:DEADLINE_FORMATTED'] = CTasksTools::FormatDatetimeBeauty($arTask['DEADLINE'], array(), $arParams['DATE_TIME_FORMAT']); } // HTML-format must be supported in future, because old tasks' data not converted from HTML to BB if ($arTask['DESCRIPTION_IN_BBCODE'] === 'N') { // HTML detected, sanitize if need $arTask['DESCRIPTION'] = CTasksTools::SanitizeHtmlDescriptionIfNeed($arTask['DESCRIPTION']); } else { $parser = new CTextParser(); $arTask['DESCRIPTION'] = $parser->convertText($arTask['DESCRIPTION']); } // collect files data if ($arTask['FILES']) { $rsFiles = CFile::GetList(array(), array('@ID' => implode(',', $arTask['FILES']))); $arTask['FILES'] = array(); while ($arFile = $rsFiles->GetNext()) { $arFile['META::SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']); $arTask['FILES'][] = $arFile; } unset($rsFiles, $arFile); } // collect 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()) { $arFile['META::SIZE_FORMATTED'] = CFile::FormatSize($arFile['FILE_SIZE']); $arTask['FORUM_FILES'][] = $arFile; }
$arElements[$arElement["ID"]] = $arElement; $arElementsJS[$arElement["ID"]] = array("id" => intVal($arElement["ID"]), "active" => $arElement["ACTIVE"] == "Y" ? "Y" : "N", "title" => $arElement["NAME"], "album_id" => $arElement["IBLOCK_SECTION_ID"], "album_name" => $arSections[$arElement["IBLOCK_SECTION_ID"]]["NAME"], "gallery_id" => $arGallery["CODE"], "description" => $arElement["~PREVIEW_TEXT"], "shows" => $arElement["SHOW_COUNTER"], "index" => $index, "author_id" => $arElement['CREATED_BY'], "date" => FormatDate('x', MakeTimeStamp($arElement["DATE_CREATE"], CSite::GetDateFormat())), "author_name" => CUser::FormatName($arParams['NAME_TEMPLATE'], $arUsers[$arElement['CREATED_BY']], $arParams["SHOW_LOGIN"] != 'N'), "comments" => $arParams["SHOW_COMMENTS"] == "Y" ? intVal($arParams["COMMENTS_TYPE"] != "BLOG" ? $arElement["PROPERTIES"]["FORUM_MESSAGE_CNT"]["VALUE"] : $arElement["PROPERTIES"]["BLOG_COMMENTS_CNT"]["VALUE"]) : "", "detail_url" => $arElement["~URL"]); if ($arParams['DRAG_SORT'] == "Y") { $arElementsJS[$arElement["ID"]]['sort'] = $arElement["SORT"]; } if ($arParams["SHOW_TAGS"]) { $arElementsJS[$arElement["ID"]]['tags'] = $arElement["TAGS"]; if ($bParseTags) { $arElementsJS[$arElement["ID"]]['tags_array'] = $arElement["TAGS_LIST"]; } } $index++; } $strFileId = trim($strFileId, " ,"); if (strLen($strFileId) > 0) { $rsFile = CFile::GetList(array(), array("@ID" => $strFileId)); $upload = COption::GetOptionString("main", "upload_dir", "upload"); while ($obFile = $rsFile->Fetch()) { $fileId = $obFile['ID']; $obFile["SRC"] = CFile::GetFileSRC($obFile); if ($ind = $arThumbsIndex[$fileId]) { $arElements[$ind]["PREVIEW_PICTURE"] = array("SRC" => $obFile["SRC"], "WIDTH" => $obFile["WIDTH"], "HEIGHT" => $obFile["HEIGHT"]); $arElementsJS[$ind]["thumb_src"] = $obFile["SRC"]; $arElementsJS[$ind]["thumb_width"] = $obFile["WIDTH"]; $arElementsJS[$ind]["thumb_height"] = $obFile["HEIGHT"]; } elseif ($ind = $arPicturesIndex[$fileId]) { $arElements[$ind]["BIG_PICTURE"] = array("SRC" => $obFile["SRC"], "WIDTH" => $obFile["WIDTH"], "HEIGHT" => $obFile["HEIGHT"]); $arElementsJS[$ind]["src"] = $obFile["SRC"]; $arElementsJS[$ind]["width"] = $obFile["WIDTH"]; $arElementsJS[$ind]["height"] = $obFile["HEIGHT"]; }
public static function collectUFValues($rows, $columnInfo, $total) { // uf columns $fileColumns = array(); $diskFileColumns = array(); $employeeColumns = array(); $crmColumns = array(); $crmStatusColumns = array(); $iblockElementColumns = array(); $iblockSectionColumns = array(); if (is_array($columnInfo)) { foreach ($columnInfo as $k => $cInfo) { if ($cInfo['isUF'] && is_array($cInfo['ufInfo']) && isset($cInfo['ufInfo']['USER_TYPE_ID'])) { switch ($cInfo['ufInfo']['USER_TYPE_ID']) { case 'file': $fileColumns[$k] = true; break; case 'disk_file': $diskFileColumns[$k] = true; break; case 'employee': $employeeColumns[$k] = true; break; case 'crm': $crmColumns[$k] = true; break; case 'crm_status': $crmStatusColumns[$k] = true; break; case 'iblock_element': $iblockElementColumns[$k] = true; break; case 'iblock_section': $iblockSectionColumns[$k] = true; break; } } } } $arFileID = array(); $arDiskFileID = array(); $arEmployeeID = array(); $arCrmID = array(); $arCrmStatusID = array(); $arCrmStatusEntityType = array(); $arIblockElementID = array(); $arIblockSectionID = array(); if (count($fileColumns) > 0 || count($diskFileColumns) > 0 || count($employeeColumns) > 0 || count($crmColumns) > 0 || count($crmStatusColumns) > 0 || count($iblockElementColumns) > 0 || count($iblockSectionColumns) > 0) { foreach ($rows as $row) { foreach ($row as $k => $v) { // file if (isset($fileColumns[$k])) { if (is_array($v)) { foreach ($v as $subv) { $value = intval($subv); if ($value > 0) { $arFileID[] = $value; } } } else { $value = intval($v); if ($value > 0) { $arFileID[] = $value; } } } // disk file if (isset($diskFileColumns[$k])) { if (is_array($v)) { foreach ($v as $subv) { $value = intval($subv); if ($value > 0) { $arDiskFileID[] = $value; } } } else { $value = intval($v); if ($value > 0) { $arDiskFileID[] = $value; } } } // employee if (isset($employeeColumns[$k])) { if (is_array($v)) { foreach ($v as $subv) { $value = intval($subv); if ($value > 0) { $arEmployeeID[] = $value; } } } else { $value = intval($v); if ($value > 0) { $arEmployeeID[] = $value; } } } // crm if (isset($crmColumns[$k])) { $prefixByType = array('lead' => 'L', 'contact' => 'C', 'company' => 'CO', 'deal' => 'D', 'quote' => 'Q'); $maxPrefixLength = 2; // 'CO' $singleTypePrefix = ''; if (is_array($columnInfo[$k]['ufInfo']['SETTINGS'])) { $supportedTypes = array(); foreach ($columnInfo[$k]['ufInfo']['SETTINGS'] as $type => $supported) { if ($supported === 'Y') { $supportedTypes[$type] = true; } } $supportedTypes = array_keys($supportedTypes); if (count($supportedTypes) === 1) { if (isset($prefixByType[strtolower($supportedTypes[0])])) { $singleTypePrefix = $prefixByType[strtolower($supportedTypes[0])]; } } unset($supportedTypes, $type, $supported); } if (is_array($v)) { foreach ($v as $subv) { if (strlen($subv) > 0) { $prefix = ''; if (($pos = strpos(substr($subv, 0, $maxPrefixLength + 1), '_')) !== false && $pos > 0) { $prefix = substr($subv, 0, $pos); } if (empty($prefix)) { $subv = $singleTypePrefix . '_' . $subv; } unset($prefix, $pos); $value = explode('_', trim(strval($subv))); if (strlen($value[0]) > 0 && strlen($value[1]) > 0) { if (!is_array($arCrmID[$value[0]])) { $arCrmID[$value[0]] = array(); } $arCrmID[$value[0]][] = $value[1]; } } } } else { if (strlen($v) > 0) { $prefix = ''; if (($pos = strpos(substr($v, 0, $maxPrefixLength + 1), '_')) !== false && $pos > 0) { $prefix = substr($v, 0, $pos); } if (empty($prefix)) { $v = $singleTypePrefix . '_' . $v; } unset($prefix, $pos); $value = explode('_', trim(strval($v))); if (strlen($value[0]) > 0 && strlen($value[1]) > 0) { if (!is_array($arCrmID[$value[0]])) { $arCrmID[$value[0]] = array(); } $arCrmID[$value[0]][] = $value[1]; } } } unset($maxPrefixLength); } // crm_status if (isset($crmStatusColumns[$k])) { if (!isset($arCrmStatusEntityType[$k])) { if (isset($columnInfo[$k]['ufInfo']['SETTINGS']['ENTITY_TYPE'])) { $arCrmStatusEntityType[$k] = strval($columnInfo[$k]['ufInfo']['SETTINGS']['ENTITY_TYPE']); } } if (!empty($arCrmStatusEntityType[$k])) { if (is_array($v)) { foreach ($v as $subv) { if (strlen($subv) > 0) { if (!is_array($arCrmStatusID[$arCrmStatusEntityType[$k]])) { $arCrmStatusID[$arCrmStatusEntityType[$k]] = array(); } $arCrmStatusID[$arCrmStatusEntityType[$k]][] = $subv; } } } else { if (strlen($v) > 0) { if (!is_array($arCrmStatusID[$arCrmStatusEntityType[$k]])) { $arCrmStatusID[$arCrmStatusEntityType[$k]] = array(); } $arCrmStatusID[$arCrmStatusEntityType[$k]][] = $v; } } } } // iblock_element if (isset($iblockElementColumns[$k])) { if (is_array($v)) { foreach ($v as $subv) { $value = intval($subv); if ($value > 0) { $arIblockElementID[] = $value; } } } else { $value = intval($v); if ($value > 0) { $arIblockElementID[] = $value; } } } // iblock_section if (isset($iblockSectionColumns[$k])) { if (is_array($v)) { foreach ($v as $subv) { $value = intval($subv); if ($value > 0) { $arIblockSectionID[] = $value; } } } else { $value = intval($v); if ($value > 0) { $arIblockSectionID[] = $value; } } } } } } // collect files if (count($fileColumns) > 0) { if (count($arFileID) > 0) { $arFileID = array_unique($arFileID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arFileID); $arID = array(); $file = new CFile(); foreach ($arFileID as $fileID) { $arID[$cnt++] = $fileID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = $file->GetList(array(), array('@ID' => implode(',', $arID))); if (is_object($res)) { while ($arFile = $res->Fetch()) { if ($arFile) { if (array_key_exists("~src", $arFile)) { if ($arFile["~src"]) { $arFile["SRC"] = $arFile["~src"]; } else { $arFile["SRC"] = $file->GetFileSRC($arFile, false, false); } } else { $arFile["SRC"] = $file->GetFileSRC($arFile, false); } self::$ufFiles[intval($arFile['ID'])] = $arFile; } } } $cnt = 0; $arID = array(); } } } // collect disk files if (count($diskFileColumns) > 0) { if (count($arDiskFileID) > 0) { $arDiskFileID = array_unique($arDiskFileID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arDiskFileID); $arID = array(); foreach ($arDiskFileID as $diskFileID) { $arID[$cnt++] = $diskFileID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = \Bitrix\Disk\AttachedObject::getList(array('filter' => array('ID' => $arID), 'select' => array('ID', 'NAME' => 'OBJECT.NAME', 'SIZE' => 'OBJECT.SIZE'))); $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager(); if (is_object($res)) { while ($arDiskFile = $res->Fetch()) { if ($arDiskFile) { $arDiskFile['DOWNLOAD_URL'] = $urlManager->getUrlUfController('download', array('attachedId' => $arDiskFile['ID'])); self::$ufDiskFiles[intval($arDiskFile['ID'])] = $arDiskFile; } } } $cnt = 0; $arID = array(); } } } // collect employees if (count($employeeColumns) > 0) { if (count($arEmployeeID) > 0) { $arEmployeeID = array_unique($arEmployeeID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arEmployeeID); $arID = array(); foreach ($arEmployeeID as $employeeID) { $arID[$cnt++] = $employeeID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = \Bitrix\Main\UserTable::getList(array('filter' => array('ID' => $arID), 'select' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'TITLE'))); if (is_object($res)) { while ($arUser = $res->fetch()) { self::$ufEmployees[intval($arUser['ID'])] = $arUser; } } $cnt = 0; $arID = array(); } } } // collect crm elements if (count($crmColumns) > 0 && CModule::IncludeModule('crm')) { foreach ($arCrmID as $typeIndex => $arSubID) { if (count($arSubID) > 0) { $arCrmID[$typeIndex] = array_unique($arSubID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arSubID); $arID = array(); foreach ($arSubID as $crmID) { $arID[$cnt++] = $crmID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = null; switch ($typeIndex) { case 'L': $res = CCrmLead::GetList(array('ID' => 'DESC'), array('ID' => $arID), array('ID', 'TITLE', 'FULL_NAME', 'STATUS_ID')); break; case 'C': $res = CCrmContact::GetList(array('ID' => 'DESC'), array('ID' => $arID), array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'FULL_NAME', 'COMPANY_TITLE', 'PHOTO')); break; case 'CO': $res = CCrmCompany::GetList(array('ID' => 'DESC'), array('ID' => $arID), array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO')); break; case 'D': $res = CCrmDeal::GetList(array('ID' => 'DESC'), array('ID' => $arID), array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME')); break; } if (is_object($res)) { while ($arCrmElement = $res->Fetch()) { self::$ufCrmElements[$typeIndex . '_' . $arCrmElement['ID']] = $arCrmElement; } } $cnt = 0; $arID = array(); } } } } // collect crm statuses if (count($crmStatusColumns) > 0 && CModule::IncludeModule('crm')) { foreach ($arCrmStatusID as $entityType => $arSubID) { if (count($arSubID) > 0) { $arCrmID[$entityType] = array_unique($arSubID); } $res = null; $res = CCrmStatus::GetStatusList($entityType); if (is_array($res) && count($res) > 0) { foreach ($arSubID as $crmStatusID) { if (isset($res[$crmStatusID])) { if (!isset(self::$ufCrmStatuses[$entityType])) { self::$ufCrmStatuses[$entityType] = array(); } } self::$ufCrmStatuses[$entityType][$crmStatusID] = $res[$crmStatusID]; } } } } // collect iblock elements if (count($iblockElementColumns) > 0 && CModule::IncludeModule('iblock')) { if (count($arIblockElementID) > 0) { $arIblockElementID = array_unique($arIblockElementID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arIblockElementID); $arID = array(); foreach ($arIblockElementID as $iblockElementID) { $arID[$cnt++] = $iblockElementID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = CIBlockElement::GetList(array('SORT' => 'ASC'), array('=ID' => $arID)); if (is_object($res)) { while ($arIblockElement = $res->GetNext()) { self::$ufIblockElements[intval($arIblockElement['ID'])] = $arIblockElement; } } $cnt = 0; $arID = array(); } } } // collect iblock sections if (count($iblockSectionColumns) > 0 && CModule::IncludeModule('iblock')) { if (count($arIblockSectionID) > 0) { $arIblockSectionID = array_unique($arIblockSectionID); } $i = 0; $cnt = 0; $stepCnt = 500; $nIDs = count($arIblockSectionID); $arID = array(); foreach ($arIblockSectionID as $iblockSectionID) { $arID[$cnt++] = $iblockSectionID; $i++; if ($cnt === $stepCnt || $i === $nIDs) { $res = CIBlockSection::GetList(array('left_margin' => 'asc'), array('ID' => $arID), false, array('ID', 'NAME', 'SECTION_PAGE_URL')); if (is_object($res)) { while ($arIblockSection = $res->GetNext()) { self::$ufIblockSections[intval($arIblockSection['ID'])] = $arIblockSection; } } $cnt = 0; $arID = array(); } } } }