本文整理汇总了PHP中CIBlockSection::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSection::Update方法的具体用法?PHP CIBlockSection::Update怎么用?PHP CIBlockSection::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSection
的用法示例。
在下文中一共展示了CIBlockSection::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applySnapshot
/**
* @param $data
* @param null $dbVersion
* @throws \Exception
* @return ApplyResult
*/
public function applySnapshot($data, $dbVersion = null)
{
$data = $this->handleNullValues($data);
$sec = new \CIBlockSection();
$res = new ApplyResult();
$extId = $data['ID'];
if ($dbVersion) {
$data['IBLOCK_ID'] = $this->getReferenceController()->getCurrentIdByOtherVersion($data['IBLOCK_ID'], ReferenceController::GROUP_IBLOCK, $dbVersion);
$data['IBLOCK_SECTION_ID'] && ($data['IBLOCK_SECTION_ID'] = $this->getCurrentVersionId($data['IBLOCK_SECTION_ID'], $dbVersion));
$id = $this->getCurrentVersionId($extId, $dbVersion);
} else {
$id = $extId;
}
if (!$dbVersion && !SectionTable::getList(array('filter' => array('=ID' => $id)))->fetch()) {
$addRes = SectionTable::add(array('ID' => $id, 'IBLOCK_ID' => $data['IBLOCK_ID'], 'TIMESTAMP_X' => new DateTime(), 'NAME' => $data['NAME'], 'DESCRIPTION_TYPE' => $data['DESCRIPTION_TYPE']));
if (!$addRes->isSuccess()) {
throw new \Exception('Не удалось возобновить секцию(раздел) текущей версии. ' . implode(', ', $addRes->getErrorMessages()) . "\n" . var_export($data, true));
}
}
unset($data['CREATED_BY'], $data['MODIFIED_BY']);
if ($id && ($currentData = SectionTable::getById($id)->fetch())) {
$data['PICTURE'] = $currentData['PICTURE'];
$data['DETAIL_PICTURE'] = $currentData['DETAIL_PICTURE'];
$res->setSuccess((bool) $sec->Update($id, $data));
} else {
unset($data['PICTURE'], $data['DETAIL_PICTURE']);
$res->setSuccess((bool) ($id = $sec->Add($data)));
$this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
}
$res->setId($id);
$res->setMessage($sec->LAST_ERROR);
return $res;
}
示例2: departmentUpdate
public static function departmentUpdate($params)
{
if (self::canEdit()) {
CModule::IncludeModule('iblock');
$params = array_change_key_case($params, CASE_UPPER);
$arDept = self::getDepartment($params['ID']);
if (is_array($arDept)) {
$arFields = array();
if (isset($params['NAME'])) {
$arFields['NAME'] = $params['NAME'];
}
if (isset($params['SORT'])) {
$arFields['SORT'] = $params['SORT'];
}
if (isset($params['PARENT'])) {
$arFields['IBLOCK_SECTION_ID'] = $params['PARENT'];
}
if (isset($params['UF_HEAD'])) {
$arFields['UF_HEAD'] = $params['UF_HEAD'];
}
if (count($arFields) > 0) {
$ob = new CIBlockSection();
if (!$ob->Update($arDept['ID'], $arFields)) {
throw new Exception($ob->LAST_ERROR);
}
}
return true;
} else {
throw new Exception('Department not found');
}
} else {
throw new Exception('Access denied!');
}
}
示例3: Update
public static function Update($ID, &$arFields)
{
if (!CModule::IncludeModule('iblock')) {
return false;
}
$section = new CIBlockSection();
$dbResult = $section->GetList(array(), array('ID' => $ID, 'GLOBAL_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), false, array('IBLOCK_ID'), false);
$currentFields = $dbResult ? $dbResult->Fetch() : null;
if (!(is_array($currentFields) && CCrmCatalog::Exists(intval($currentFields['IBLOCK_ID'])))) {
self::$LAST_ERROR_CODE = self::ERR_SECTION_NOT_FOUND;
self::$LAST_ERROR = GetMessage('CRM_PRODUCT_SECTION_ERR_SECTION_NOT_FOUND');
return false;
}
$sectionFields = CCrmProductSectionDbResult::MapKeys($arFields);
$sectionFields['CHECK_PERMISSIONS'] = 'N';
$result = $section->Update($ID, $sectionFields);
if ($result === false) {
self::$LAST_ERROR_CODE = self::ERR_IBLOCK_SECTION_UPDATE;
self::$LAST_ERROR = $section->LAST_ERROR;
}
return $result;
}
示例4: fill
/**
* @inheritdoc
*
* @throws FillDataException
*/
public function fill($propCodePublicId = null, $propCodeLang = null, $defaultLang = null, $force = false)
{
$sectionModel = new \CIBlockSection();
$rsSections = $sectionModel->GetList([], ['IBLOCK_ID' => $this->getIblockId()], false, ['ID', 'UF_' . $propCodePublicId, 'UF_' . $propCodeLang]);
while ($section = $rsSections->Fetch()) {
$updateResult = null;
if ($propCodePublicId) {
if ($force === false && !empty($section['UF_' . $propCodePublicId])) {
continue;
}
$updateResult = $sectionModel->Update($section['ID'], ['UF_' . $propCodePublicId => $section['ID']]);
}
if ($propCodeLang) {
if ($force === false && !empty($section['UF_' . $propCodeLang])) {
continue;
}
$updateResult = $sectionModel->Update($section['ID'], ['UF_' . $propCodeLang => $defaultLang]);
}
if ($updateResult === false) {
throw new FillDataException($section['ID'], $this->getIblockId(), $sectionModel->LAST_ERROR);
}
}
}
示例5: DeleteDepartment
function DeleteDepartment($arFields)
{
$dpt = intval($arFields['dpt_id']);
global $iblockID;
$dbRes = CIBlockSection::GetList(array(), array("ID" => $dpt, "IBLOCK_ID" => $iblockID, "CHECK_PERMISSIONS" => "Y"), false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID'));
if ($arSection = $dbRes->Fetch()) {
if ($arSection['IBLOCK_SECTION_ID'] > 0) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $iblockID, 'SECTION_ID' => $arSection['ID']), false, array('ID', 'IBLOCK_ID'));
$obIBlockSection = new CIBlockSection();
$GLOBALS['DB']->StartTransaction();
while ($arRes = $dbRes->Fetch()) {
$obIBlockSection->Update($arRes['ID'], array('IBLOCK_SECTION_ID' => $arSection['IBLOCK_SECTION_ID']));
}
if ($obIBlockSection->Delete($arSection['ID'])) {
$GLOBALS['DB']->Commit();
echo "{id: '" . $arSection['IBLOCK_SECTION_ID'] . "'}";
} else {
$GLOBALS['DB']->Rollback();
$res = array('error' => trim(str_replace('<br>', "\n", $ob->LAST_ERROR)));
echo "{errors: '" . $res["error"] . "'}";
}
}
}
}
示例6: SetDepartmentHead
public static function SetDepartmentHead($userId, $sectionId)
{
//echo "Setting ".$userId." as head of ".$sectionId;
$iblockId = COption::GetOptionInt("intranet", "iblock_structure", false, false);
if ($iblockId && $sectionId && $userId && CModule::IncludeModule('iblock')) {
/*$perm = CIBlock::GetPermission($iblockId);
if ($perm >= 'W')
{*/
$obS = new CIBlockSection();
if ($obS->Update($sectionId, array('UF_HEAD' => $userId), false, false)) {
return true;
} else {
// update error
return false;
}
/*}
else
{
// access denied
return false;
}*/
} else {
// bad data
return false;
}
}
示例7: isset
} else {
$arGroupsTmp[$i]["DETAIL_PICTURE"] = CFile::MakeFileArray($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $PATH2IMAGE_FILES . "/" . $arGroupsTmp[$i]["DETAIL_PICTURE"]));
if (!empty($arGroupsTmp[$i]["DETAIL_PICTURE"]) && is_array($arGroupsTmp[$i]["DETAIL_PICTURE"])) {
$arGroupsTmp[$i]["DETAIL_PICTURE"]['COPY_FILE'] = 'Y';
}
}
$bFilePres = !empty($arGroupsTmp[$i]["DETAIL_PICTURE"]) && isset($arGroupsTmp[$i]["DETAIL_PICTURE"]["tmp_name"]) && '' !== $arGroupsTmp[$i]["DETAIL_PICTURE"]["tmp_name"];
}
if (!$bFilePres) {
unset($arGroupsTmp[$i]["DETAIL_PICTURE"]);
}
}
$res = CIBlockSection::GetList(array(), $arFilter, false, array('ID'));
if ($arr = $res->Fetch()) {
$LAST_GROUP_CODE = $arr["ID"];
$res = $bs->Update($LAST_GROUP_CODE, $arGroupsTmp[$i], true, true, 'Y' === $IMAGE_RESIZE);
if (!$res) {
$strErrorR .= GetMessage("CATI_LINE_NO") . " " . $line_num . ". " . GetMessage("CATI_ERR_UPDATE_SECT") . " " . $bs->LAST_ERROR . "<br>";
}
} else {
$arGroupsTmp[$i]["IBLOCK_ID"] = $IBLOCK_ID;
$arGroupsTmp[$i]["ACTIVE"] = isset($arGroupsTmp[$i]["ACTIVE"]) && 'N' === $arGroupsTmp[$i]["ACTIVE"] ? 'N' : 'Y';
$LAST_GROUP_CODE = $bs->Add($arGroupsTmp[$i], true, true, 'Y' === $IMAGE_RESIZE);
if (!$LAST_GROUP_CODE) {
$strErrorR .= GetMessage("CATI_LINE_NO") . " " . $line_num . ". " . GetMessage("CATI_ERR_ADD_SECT") . " " . $bs->LAST_ERROR . "<br>";
}
}
if ('' === $strErrorR) {
$arSectionCache[$sectionIndex] = $LAST_GROUP_CODE;
}
} else {
示例8: GetMessage
$arParams['DO_NOT_REDIRECT'] = true;
include $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/components/bitrix/webdav.iblock.rights/action.php";
$_REQUEST["UF_USE_BP"] = $_REQUEST["UF_USE_BP"] == "Y" ? "Y" : "N";
$_REQUEST["UF_USE_EXT_SERVICES"] = CWebDavIblock::resolveDefaultUseExtServices($_REQUEST["UF_USE_EXT_SERVICES"]);
if ($_REQUEST["UF_USE_BP"] != $arLibrary["UF_USE_BP"] || $_REQUEST["UF_USE_EXT_SERVICES"] != $arLibrary['UF_USE_EXT_SERVICES']) {
if (!isset($arLibrary["~UF_USE_BP"])) {
__wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]);
}
if (!isset($arLibrary["~UF_USE_EXT_SERVICES"])) {
CWebDavIblock::checkUfUseExtServices((int) $arParams["IBLOCK_ID"]);
}
$arFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "UF_USE_BP" => $_REQUEST["UF_USE_BP"], "UF_USE_EXT_SERVICES" => $_REQUEST["UF_USE_EXT_SERVICES"]);
$GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
$bs = new CIBlockSection();
$res = $bs->Update($arLibrary["ID"], $arFields);
}
$popupWindow->Close($bReload = true, $_REQUEST["back_url"]);
die;
}
//HTML output
$popupWindow->ShowTitlebar(GetMessage("SN_TITLE"));
$popupWindow->StartDescription("bx-access-folder");
if (isset($strWarning) && $strWarning != "") {
$popupWindow->ShowValidationError($strWarning);
}
?>
<p><b><?php
echo GetMessage("SN_TITLE_TITLE");
?>
示例9: elseif
$_REQUEST["DROP_PASSWORD"] = "Y";
} elseif ($_REQUEST["USE_PASSWORD"] == "Y") {
$arFields["UF_PASSWORD"] = md5($_REQUEST["PASSWORD"]);
$GLOBALS["UF_PASSWORD"] = md5($_REQUEST["PASSWORD"]);
} else {
$arFields["UF_PASSWORD"] = $arResult["SECTION"]["~PASSWORD"]["VALUE"];
$GLOBALS["UF_PASSWORD"] = $arResult["SECTION"]["~PASSWORD"]["VALUE"];
}
foreach ($_REQUEST as $key => $val) {
if (substr($key, 0, 3) == "UF_") {
$GLOBALS[$key] = $val;
}
}
$bs = new CIBlockSection();
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
if ($bs->Update($arResult["SECTION"]["ID"], $arFields)) {
$rsSection = CIBlockSection::GetList(array(), array("ID" => $arResult["SECTION"]["ID"], "IBLOCK_ID" => $arParams["IBLOCK_ID"]), false, array("UF_DATE", "UF_PASSWORD"));
$arResultSection = $rsSection->GetNext();
$arResultFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "DATE" => PhotoDateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arResultSection["UF_DATE"], CSite::GetDateFormat())), "PASSWORD" => $arResultSection["UF_PASSWORD"], "NAME" => $arResultSection["NAME"], "DESCRIPTION" => $arResultSection["DESCRIPTION"], "ID" => $arResult["SECTION"]["ID"], "error" => "");
$arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~SECTION_URL"], array("USER_ALIAS" => $arParams["USER_ALIAS"], "SECTION_ID" => $arResult["SECTION"]["ID"]));
} elseif ($bs->LAST_ERROR) {
$strWarning .= $bs->LAST_ERROR;
$bVarsFromForm = true;
} else {
$err = $GLOBALS['APPLICATION']->GetException();
if ($err) {
$strWarning .= $err->GetString();
}
$bVarsFromForm = true;
}
} elseif ($arParams["ACTION"] == "NEW") {
示例10: CreateSharedFolder
public static function CreateSharedFolder($iblockID, $sectionID, $userID, $setRights = false)
{
$_sharedGroup = 'AU';
$_sharedTask = 'R';
$_shareName = GetMessage("WD_SHARED_FILES");
$_shareXMLID = 'SHARED_FOLDER';
$arTasks = CWebDavIblock::GetTasks();
$arFilter = array("IBLOCK_ID" => $iblockID, "SECTION_ID" => $sectionID, "CHECK_PERMISSIONS" => "N");
$_shareRights = array("n0" => array("GROUP_CODE" => $_sharedGroup, "TASK_ID" => $arTasks[$_sharedTask]));
$arShare = null;
$se = new CIBlockSection();
$arFilter['NAME'] = $_shareName;
$dbShare = CIBlockSection::GetList(array(), $arFilter, false, array('ID', 'CREATED_BY', 'MODIFIED_BY', 'XML_ID'));
if ($dbShare && ($arShare1 = $dbShare->Fetch())) {
$arShare =& $arShare1;
} else {
unset($arFilter['NAME']);
// search for renamed shared folder
$arFilter['XML_ID'] = $_shareXMLID;
$dbShare = CIBlockSection::GetList(array(), $arFilter, false, array('ID', 'CREATED_BY', 'XML_ID'));
if ($dbShare && ($arShare2 = $dbShare->Fetch())) {
$arShare =& $arShare2;
}
}
if ($arShare) {
if ($setRights) {
$sRight = new CIBlockSectionRights($iblockID, $arShare['ID']);
$arRights = $sRight->GetRights($arShare['ID']);
$validRights = false;
foreach ($arRights as $right) {
if ($right['GROUP_CODE'] == $_sharedGroup && $right['TASK_ID'] == $arTasks[$_sharedTask]) {
$validRights = true;
break;
}
}
if (!$validRights) {
$sRight->SetRights($_shareRights);
}
}
$recoverData = array();
if ($arShare['XML_ID'] != $_shareXMLID) {
$recoverData['XML_ID'] = $_shareXMLID;
}
if ($arShare['CREATED_BY'] != $userID) {
$recoverData['CREATED_BY'] = $userID;
}
if ($arShare['MODIFIED_BY'] != $userID) {
$recoverData['MODIFIED_BY'] = $userID;
}
if (!empty($recoverData)) {
$se->Update($arShare['ID'], $recoverData);
}
} else {
$arFilter['NAME'] = $_shareName;
$arFilter["RIGHTS"] = $_shareRights;
$arFilter['IBLOCK_SECTION_ID'] = $arFilter['SECTION_ID'];
$arFilter["CREATED_BY"] = $userID;
$arFilter["MODIFIED_BY"] = $userID;
$arFilter['XML_ID'] = $_shareXMLID;
$newSecID = $se->Add($arFilter);
$obSectionRights = new CIBlockSectionRights($iblockID, $newSecID);
$obSectionRights->SetRights($arFilter["RIGHTS"]);
}
}
示例11: OnUserDelete
function OnUserDelete($USER_ID)
{
$arIBlockList = array('iblock_absence', 'iblock_honour', 'iblock_state_history');
foreach ($arIBlockList as $var_name) {
$IBLOCK_ID = COption::GetOptionInt('intranet', $var_name);
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'PROPERTY_USER' => $USER_ID), false, false, array('ID', 'IBLOCK_ID'));
while ($arRes = $dbRes->Fetch()) {
CIBlockElement::Delete($arRes['ID']);
}
}
}
if (CModule::IncludeModule('socialnetwork')) {
$dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => SONET_INTRANET_NEW_USER_ENTITY, 'EVENT_ID' => SONET_INTRANET_NEW_USER_EVENT_ID, 'ENTITY_ID' => $USER_ID, 'SOURCE_ID' => $USER_ID), false, array('ID'));
$arRes = $dbRes->Fetch();
if ($arRes) {
CSocNetLog::Delete($arRes['ID']);
}
}
if (CModule::IncludeModule('iblock')) {
$IBLOCK_ID = COption::GetOptionInt('intranet', 'iblock_structure');
if ($IBLOCK_ID > 0) {
$dbRes = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'UF_HEAD' => $USER_ID), false, array('ID', 'IBLOCK_ID'));
$obSection = new CIBlockSection();
while ($arRes = $dbRes->Fetch()) {
$obSection->Update($arRes['ID'], array('UF_HEAD' => ''));
}
}
}
}
示例12: MapSections
function MapSections($arRes)
{
global $NUM_CATALOG_LEVELS, $arIBlockAvailGroupFields;
static $arSectionCache = array();
$bs = new CIBlockSection();
$result = array();
while (true) {
// this array is path to element
$arGroupsTmp = array();
for ($i = 0; $i < $NUM_CATALOG_LEVELS; $i++) {
$bOK = false;
//will be true when at least one important field met
$arGroupsTmp1 = array("TMP_ID" => $this->tmpid);
foreach ($arIBlockAvailGroupFields as $key => $value) {
$fkey = $value["field"];
if (array_key_exists($key . $i, $arRes) && !empty($arRes[$key . $i])) {
$arGroupsTmp1[$fkey] = array_shift($arRes[$key . $i]);
}
if ($value["important"] == "Y" && isset($arGroupsTmp1[$fkey]) && strlen($arGroupsTmp1[$fkey]) > 0) {
$bOK = true;
}
}
// drop empty target sections
if ($bOK) {
// When group does not have name "<Empty name>"
if (strlen($arGroupsTmp1["NAME"]) <= 0) {
$arGroupsTmp1["NAME"] = GetMessage("IBLOCK_ADM_IMP_NOMAME");
}
$arGroupsTmp[] = $arGroupsTmp1;
} else {
break;
}
}
//Finished with groups
if (empty($arGroupsTmp)) {
break;
}
// Create sections tree. Save section code for elemet insertions
$LAST_GROUP_CODE = 0;
foreach ($arGroupsTmp as $i => $arGroup) {
$arFilter = array("IBLOCK_ID" => $this->IBLOCK_ID, "CHECK_PERMISSIONS" => "N");
if (isset($arGroup["XML_ID"]) && strlen($arGroup["XML_ID"])) {
$arFilter["=XML_ID"] = $arGroup["XML_ID"];
} elseif (isset($arGroup["NAME"]) && strlen($arGroup["NAME"])) {
$arFilter["=NAME"] = $arGroup["NAME"];
}
if ($LAST_GROUP_CODE > 0) {
$arFilter["SECTION_ID"] = $LAST_GROUP_CODE;
$arGroupsTmp[$i]["IBLOCK_SECTION_ID"] = $LAST_GROUP_CODE;
} else {
$arFilter["SECTION_ID"] = 0;
$arGroupsTmp[$i]["IBLOCK_SECTION_ID"] = false;
}
$cache_id = md5(serialize($arFilter));
if (array_key_exists($cache_id, $arSectionCache)) {
$arr = $arSectionCache[$cache_id];
} else {
$res = CIBlockSection::GetList(array(), $arFilter);
if ($arr = $res->Fetch()) {
$arSectionCache[$cache_id] = $arr;
}
}
if ($arr) {
$arGroupsTmp[$i]["IBLOCK_ID"] = $arr["IBLOCK_ID"];
$LAST_GROUP_CODE = $arr["ID"];
$bUpdate = false;
foreach ($arGroupsTmp[$i] as $field_code => $field_value) {
if ($field_value . "" !== $arr[$field_code] . "") {
$bUpdate = true;
break;
}
}
if ($bUpdate) {
$res = $bs->Update($LAST_GROUP_CODE, $arGroupsTmp[$i]);
unset($arSectionCache[$cache_id]);
}
} else {
$arGroupsTmp[$i]["IBLOCK_ID"] = $this->IBLOCK_ID;
$arGroupsTmp[$i]["ACTIVE"] = "Y";
$LAST_GROUP_CODE = $bs->Add($arGroupsTmp[$i]);
}
}
if ($LAST_GROUP_CODE > 0) {
$result[$LAST_GROUP_CODE] = $LAST_GROUP_CODE;
}
}
return $result;
}
示例13: CIBlockSection
$bs = new CIBlockSection();
$bs->Update($arResult["GALLERY"]["ID"], $arFields);
BXClearCache(true, "/bitrix/photogallery/" . $arParams["IBLOCK_ID"] . "/user/data/" . $arResult["GALLERY"]["CREATED_BY"] . "/");
BXClearCache(true, "/bitrix/photogallery/" . $arParams["IBLOCK_ID"] . "/gallery/" . $arResult["GALLERY"]["~CODE"] . "/");
$url = $GLOBALS['APPLICATION']->GetCurPageParam("", array("action", "status"));
if ($bAjaxCall != "Y") {
LocalRedirect($url);
} elseif ($arParams["GALLERY_SIZE"] > 0) {
$GLOBALS['APPLICATION']->RestartBuffer();
$arFields = array("STATUS" => "DONE", "PERCENT" => intVal(doubleVal($arInfoRecalc["FILE_SIZE"]) / $arParams["GALLERY_SIZE"] * 100));
echo CUtil::PhpToJSObject($arFields);
die;
}
} else {
$arFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "UF_GALLERY_RECALC" => serialize($arInfoRecalc), "UF_GALLERY_SIZE" => doubleVal($arResult["GALLERY"]["UF_GALLERY_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);
$bs = new CIBlockSection();
$bs->Update($arResult["GALLERY"]["ID"], $arFields);
BXClearCache(true, "/bitrix/photogallery/" . $arParams["IBLOCK_ID"] . "/user/data/" . $arResult["GALLERY"]["CREATED_BY"] . "/");
BXClearCache(true, "/bitrix/photogallery/" . $arParams["IBLOCK_ID"] . "/gallery/" . $arResult["GALLERY"]["~CODE"] . "/");
$arResult["GALLERY"]["~UF_GALLERY_RECALC"] = $arFields["UF_GALLERY_RECALC"];
$arResult["GALLERY"]["UF_GALLERY_RECALC"] = htmlspecialcharsEx($arFields["UF_GALLERY_RECALC"]);
if ($bAjaxCall == "Y") {
$GLOBALS['APPLICATION']->RestartBuffer();
$arFields = array("STATUS" => "CONTINUE", "PERCENT" => intVal(intVal($arInfoRecalc["FILE_COUNT"]) / $arResult["GALLERY"]["ELEMENTS_CNT"] * 100));
echo CUtil::PhpToJSObject($arFields);
die;
}
}
示例14: array
$db_res = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => 0, "!LEFT_MARGIN" => $res["LEFT_MARGIN"], "!RIGHT_MARGIN" => $res["RIGHT_MARGIN"], "!ID" => $res["ID"]), false, array("ID", "UF_GALLERY_SIZE"));
if ($db_res && ($res_g = $db_res->Fetch())) {
$res["GALLERY"] = $res_g;
$arSections[$res["ID"]] = $res;
}
}
}
if (!empty($res["GALLERY"]) && $iFileSize > 0) {
$gallery = $res["GALLERY"];
$gallery["UF_GALLERY_SIZE"] = doubleval($gallery["UF_GALLERY_SIZE"]) - $iFileSize;
$gallery["UF_GALLERY_SIZE"] = $gallery["UF_GALLERY_SIZE"] <= 0 ? 0 : $gallery["UF_GALLERY_SIZE"];
$arFields = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "UF_GALLERY_SIZE" => $gallery["UF_GALLERY_SIZE"]);
$GLOBALS["UF_GALLERY_SIZE"] = $arFields["UF_GALLERY_SIZE"];
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
$bs = new CIBlockSection();
$bs->Update($gallery["ID"], $arFields, false, false);
}
PClearComponentCacheEx($arParams["IBLOCK_ID"], array($res["ID"], $res["IBLOCK_SECTION_ID"]));
}
}
LocalRedirect($_REQUEST["from_detail_list"]);
}
}
$file = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/lang/" . LANGUAGE_ID . "/result_modifier.php"));
__IncludeLang($file);
$arParams["SHOW_BEST_ELEMENT"] = $arParams["SHOW_BEST_ELEMENT"] == "N" ? "N" : "Y";
$arResult["MENU_VARIABLES"] = array();
if ($this->__page !== "menu") {
$sTempatePage = $this->__page;
$sTempateFile = $this->__file;
$this->__component->IncludeComponentTemplate("menu");
示例15: intval
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
if (check_bitrix_sessid()) {
$IBLOCK_ID = COption::getOptionInt('intranet', 'iblock_structure', 0);
$SECTION_ID = intval($_REQUEST['SECTION_ID']);
$USER_ID = intval($_REQUEST['USER_ID']);
if ($IBLOCK_ID && $SECTION_ID && $USER_ID && CModule::IncludeModule('iblock')) {
$perm = CIBlock::GetPermission($IBLOCK_ID);
if ($perm >= 'W') {
$obS = new CIBlockSection();
if ($obS->Update($SECTION_ID, array('UF_HEAD' => $USER_ID))) {
echo '<script>BX.reload(true);</script>';
} elseif ($obS->LAST_ERROR) {
echo '<script>alert(\'' . CUtil::JSEscape($obS->LAST_ERROR) . '\');</script>';
}
} else {
echo '<script>alert(\'Access denied!\');</script>';
}
} else {
echo '<script>alert(\'Params error!\');</script>';
}
} else {
echo '<script>alert(\'Session expired!\');</script>';
}