本文整理汇总了PHP中CIBlockSection::UpdateSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::UpdateSearch方法的具体用法?PHP CIBlockSection::UpdateSearch怎么用?PHP CIBlockSection::UpdateSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::UpdateSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
function Update($ID, $arFields, $bResort = true, $bUpdateSearch = true, $bResizePictures = false)
{
global $USER, $DB, $APPLICATION;
$ID = intval($ID);
$db_record = CIBlockSection::GetList(array(), array("ID" => $ID, "CHECK_PERMISSIONS" => "N"));
if (!($db_record = $db_record->Fetch())) {
return false;
}
if (is_set($arFields, "EXTERNAL_ID")) {
$arFields["XML_ID"] = $arFields["EXTERNAL_ID"];
}
unset($arFields["GLOBAL_ACTIVE"]);
unset($arFields["DEPTH_LEVEL"]);
unset($arFields["LEFT_MARGIN"]);
unset($arFields["RIGHT_MARGIN"]);
unset($arFields["IBLOCK_ID"]);
unset($arFields["DATE_CREATE"]);
unset($arFields["CREATED_BY"]);
$arIBlock = CIBlock::GetArrayByID($db_record["IBLOCK_ID"]);
if ($bResizePictures) {
$arDef = $arIBlock["FIELDS"]["SECTION_PICTURE"]["DEFAULT_VALUE"];
if ($arDef["DELETE_WITH_DETAIL"] === "Y" && $arFields["DETAIL_PICTURE"]["del"] === "Y") {
$arFields["PICTURE"]["del"] = "Y";
}
if ($arDef["FROM_DETAIL"] === "Y" && ($arFields["PICTURE"]["size"] <= 0 || $arDef["UPDATE_WITH_DETAIL"] === "Y") && is_array($arFields["DETAIL_PICTURE"]) && $arFields["DETAIL_PICTURE"]["size"] > 0) {
if ($arFields["PICTURE"]["del"] !== "Y" && $arDef["UPDATE_WITH_DETAIL"] !== "Y") {
$arOldSection = $db_record;
} else {
$arOldSection = false;
}
if (!$arOldSection || !$arOldSection["PICTURE"]) {
$arNewPreview = $arFields["DETAIL_PICTURE"];
$arNewPreview["COPY_FILE"] = "Y";
$arNewPreview["description"] = $arFields["PICTURE"]["description"];
$arFields["PICTURE"] = $arNewPreview;
}
}
if (array_key_exists("PICTURE", $arFields) && is_array($arFields["PICTURE"]) && $arFields["PICTURE"]["size"] > 0 && $arDef["SCALE"] === "Y") {
$arNewPicture = CIBlock::ResizePicture($arFields["PICTURE"], $arDef);
if (is_array($arNewPicture)) {
$arNewPicture["description"] = $arFields["PICTURE"]["description"];
$arFields["PICTURE"] = $arNewPicture;
} elseif ($arDef["IGNORE_ERRORS"] !== "Y") {
unset($arFields["PICTURE"]);
$strWarning .= GetMessage("IBLOCK_FIELD_PREVIEW_PICTURE") . ": " . $arNewPicture . "<br>";
}
}
if (array_key_exists("PICTURE", $arFields) && is_array($arFields["PICTURE"]) && $arDef["USE_WATERMARK_FILE"] === "Y") {
if (strlen($arFields["PICTURE"]["tmp_name"]) > 0 && $arFields["PICTURE"]["tmp_name"] === $arFields["DETAIL_PICTURE"]["tmp_name"]) {
$arFields["PICTURE"]["tmp_name"] = CTempFile::GetFileName(basename($arFields["PICTURE"]["tmp_name"]));
CheckDirPath($arFields["PICTURE"]["tmp_name"]);
copy($arFields["DETAIL_PICTURE"]["tmp_name"], $arFields["PICTURE"]["tmp_name"]);
}
CIBLock::FilterPicture($arFields["PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_FILE_POSITION"], "type" => "file", "size" => "real", "alpha_level" => 100 - min(max($arDef["WATERMARK_FILE_ALPHA"], 0), 100), "file" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_FILE"])));
}
if (array_key_exists("PICTURE", $arFields) && is_array($arFields["PICTURE"]) && $arDef["USE_WATERMARK_TEXT"] === "Y") {
if (strlen($arFields["PICTURE"]["tmp_name"]) > 0 && $arFields["PICTURE"]["tmp_name"] === $arFields["DETAIL_PICTURE"]["tmp_name"]) {
$arFields["PICTURE"]["tmp_name"] = CTempFile::GetFileName(basename($arFields["PICTURE"]["tmp_name"]));
CheckDirPath($arFields["PICTURE"]["tmp_name"]);
copy($arFields["DETAIL_PICTURE"]["tmp_name"], $arFields["PICTURE"]["tmp_name"]);
}
CIBLock::FilterPicture($arFields["PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_TEXT_POSITION"], "type" => "text", "coefficient" => $arDef["WATERMARK_TEXT_SIZE"], "text" => $arDef["WATERMARK_TEXT"], "font" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_TEXT_FONT"]), "color" => $arDef["WATERMARK_TEXT_COLOR"]));
}
$arDef = $arIBlock["FIELDS"]["SECTION_DETAIL_PICTURE"]["DEFAULT_VALUE"];
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["SCALE"] === "Y") {
$arNewPicture = CIBlock::ResizePicture($arFields["DETAIL_PICTURE"], $arDef);
if (is_array($arNewPicture)) {
$arNewPicture["description"] = $arFields["DETAIL_PICTURE"]["description"];
$arFields["DETAIL_PICTURE"] = $arNewPicture;
} elseif ($arDef["IGNORE_ERRORS"] !== "Y") {
unset($arFields["DETAIL_PICTURE"]);
$strWarning .= GetMessage("IBLOCK_FIELD_DETAIL_PICTURE") . ": " . $arNewPicture . "<br>";
}
}
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["USE_WATERMARK_FILE"] === "Y") {
if (strlen($arFields["DETAIL_PICTURE"]["tmp_name"]) > 0 && $arFields["DETAIL_PICTURE"]["tmp_name"] === $arFields["PICTURE"]["tmp_name"]) {
$arFields["DETAIL_PICTURE"]["tmp_name"] = CTempFile::GetFileName(basename($arFields["DETAIL_PICTURE"]["tmp_name"]));
CheckDirPath($arFields["DETAIL_PICTURE"]["tmp_name"]);
copy($arFields["PICTURE"]["tmp_name"], $arFields["DETAIL_PICTURE"]["tmp_name"]);
}
CIBLock::FilterPicture($arFields["DETAIL_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_FILE_POSITION"], "type" => "file", "size" => "real", "alpha_level" => 100 - min(max($arDef["WATERMARK_FILE_ALPHA"], 0), 100), "file" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_FILE"]), "fill" => "resize"));
}
if (array_key_exists("DETAIL_PICTURE", $arFields) && is_array($arFields["DETAIL_PICTURE"]) && $arDef["USE_WATERMARK_TEXT"] === "Y") {
if (strlen($arFields["DETAIL_PICTURE"]["tmp_name"]) > 0 && $arFields["DETAIL_PICTURE"]["tmp_name"] === $arFields["PICTURE"]["tmp_name"]) {
$arFields["DETAIL_PICTURE"]["tmp_name"] = CTempFile::GetFileName(basename($arFields["DETAIL_PICTURE"]["tmp_name"]));
CheckDirPath($arFields["DETAIL_PICTURE"]["tmp_name"]);
copy($arFields["PICTURE"]["tmp_name"], $arFields["DETAIL_PICTURE"]["tmp_name"]);
}
CIBLock::FilterPicture($arFields["DETAIL_PICTURE"]["tmp_name"], array("name" => "watermark", "position" => $arDef["WATERMARK_TEXT_POSITION"], "type" => "text", "coefficient" => $arDef["WATERMARK_TEXT_SIZE"], "text" => $arDef["WATERMARK_TEXT"], "font" => $_SERVER["DOCUMENT_ROOT"] . Rel2Abs("/", $arDef["WATERMARK_TEXT_FONT"]), "color" => $arDef["WATERMARK_TEXT_COLOR"]));
}
}
if (is_set($arFields, "PICTURE")) {
if (strlen($arFields["PICTURE"]["name"]) <= 0 && strlen($arFields["PICTURE"]["del"]) <= 0) {
unset($arFields["PICTURE"]);
} else {
$arFields["PICTURE"]["old_file"] = $db_record["PICTURE"];
$arFields["PICTURE"]["MODULE_ID"] = "iblock";
}
}
if (is_set($arFields, "DETAIL_PICTURE")) {
//.........这里部分代码省略.........