本文整理汇总了PHP中CList::UpdateField方法的典型用法代码示例。如果您正苦于以下问题:PHP CList::UpdateField方法的具体用法?PHP CList::UpdateField怎么用?PHP CList::UpdateField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::UpdateField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
if (isset($_POST["LIST_DEF"]) && is_array($_POST["LIST_DEF"])) {
foreach ($arField["LIST"] as $i => $arEnum) {
$arField["LIST"][$i]["DEF"] = "N";
}
foreach ($_POST["LIST_DEF"] as $def) {
$def = intval($def);
if ($def > 0 && isset($arField["LIST"][$def])) {
$arField["LIST"][$def]["DEF"] = "Y";
}
}
}
if (!$strError) {
if ($arResult["FIELD_ID"]) {
unset($arField["TYPE"]);
$arResult["FIELD_ID"] = $obList->UpdateField($arResult["FIELD_ID"], $arField);
} else {
$arResult["FIELD_ID"] = $obList->AddField($arField);
}
//Clear components cache
$CACHE_MANAGER->ClearByTag("lists_list_" . $arIBlock["ID"]);
$tab_name = $arResult["FORM_ID"] . "_active_tab";
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["~LIST_FIELDS_URL"]);
} elseif ($arResult["FIELD_ID"]) {
LocalRedirect(CHTTP::urlAddParams(str_replace(array("#list_id#", "#field_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $arResult["FIELD_ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_FIELD_EDIT_URL"]), array($tab_name => $_POST[$tab_name]), array("skip_empty" => true, "encode" => true)));
} else {
LocalRedirect($arResult["~LIST_FIELDS_URL"]);
}
} else {
示例2: array
$arResult["~LIST_FIELD_EDIT_URL"] = str_replace(array("#list_id#", "#field_id#", "#group_id#"), array($arResult["IBLOCK_ID"], "0", $arParams["SOCNET_GROUP_ID"]), $arParams["~LIST_FIELD_EDIT_URL"]);
$arResult["LIST_FIELD_EDIT_URL"] = htmlspecialcharsbx($arResult["~LIST_FIELD_EDIT_URL"]);
//Form submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid() && isset($_POST["action_button_" . $arResult["GRID_ID"]])) {
$obList = new CList($arIBlock["ID"]);
if ($_POST["action_button_" . $arResult["GRID_ID"]] == "delete" && isset($_POST["ID"]) && is_array($_POST["ID"])) {
foreach ($_POST["ID"] as $ID) {
$obList->DeleteField($ID);
}
//Clear components cache
$CACHE_MANAGER->ClearByTag("lists_list_" . $arResult["IBLOCK_ID"]);
}
if ($_POST["action_button_" . $arResult["GRID_ID"]] == "edit" && isset($_POST["FIELDS"]) && is_array($_POST["FIELDS"])) {
foreach ($_POST["FIELDS"] as $ID => $tmp) {
$arField = array("SORT" => $_POST["FIELDS"][$ID]["SORT"], "NAME" => $_POST["FIELDS"][$ID]["NAME"], "IS_REQUIRED" => $_POST["FIELDS"][$ID]["IS_REQUIRED"], "MULTIPLE" => $_POST["FIELDS"][$ID]["MULTIPLE"]);
$obList->UpdateField($ID, $arField);
}
//Clear components cache
$CACHE_MANAGER->ClearByTag("lists_list_" . $arResult["IBLOCK_ID"]);
}
if (!isset($_POST["AJAX_CALL"])) {
LocalRedirect($arResult["LIST_FIELDS_URL"]);
}
}
global $CACHE_MANAGER;
if ($this->StartResultCache(false)) {
$CACHE_MANAGER->StartTagCache($this->GetCachePath());
$CACHE_MANAGER->RegisterTag("lists_list_" . $arIBlock["ID"]);
$obList = new CList($arIBlock["ID"]);
$arResult["TYPES"] = $obList->GetAllTypes();
$arFields = $obList->GetFields();
示例3: createIBlock
private static function createIBlock($iblockType, $iblock, $pictureType, $picture, $siteId = null)
{
if (is_null($siteId)) {
$siteId = \CSite::GetDefSite();
}
$db = \CIBlock::GetList(array(), array("IBLOCK_TYPE_ID" => $iblockType, "CODE" => $iblock["CODE"], "CHECK_PERMISSIONS" => "N", "SITE_ID" => $siteId));
if ($res = $db->Fetch()) {
return $res["ID"];
}
$fields = array("NAME" => $iblock["NAME"], "DESCRIPTION" => $iblock["DESCRIPTION"], "IBLOCK_TYPE_ID" => $iblockType, "SORT" => $iblock["SORT"], "CODE" => $iblock["CODE"], "WORKFLOW" => "N", "ELEMENTS_NAME" => $iblock["ELEMENTS_NAME"], "ELEMENT_NAME" => $iblock["ELEMENT_NAME"], "ELEMENT_ADD" => $iblock["ELEMENT_ADD"], "ELEMENT_EDIT" => $iblock["ELEMENT_EDIT"], "ELEMENT_DELETE" => $iblock["ELEMENT_DELETE"], "SECTIONS_NAME" => $iblock["SECTIONS_NAME"], "SECTION_NAME" => $iblock["SECTION_NAME"], "SECTION_ADD" => $iblock["SECTION_ADD"], "SECTION_EDIT" => $iblock["SECTION_EDIT"], "SECTION_DELETE" => $iblock["SECTION_DELETE"], "BIZPROC" => "Y", "SITE_ID" => array($siteId), "RIGHTS_MODE" => "E");
if ($iblock["SOCNET_GROUP_ID"]) {
$fields["SOCNET_GROUP_ID"] = $iblock["SOCNET_GROUP_ID"];
}
static $exts = array("image/jpeg" => "jpg", "image/png" => "png", "image/gif" => "gif");
if (!empty($picture) && isset($exts[$pictureType])) {
$fn = \CTempFile::GetFileName();
Main\IO\Directory::createDirectory($fn);
$fn .= md5(mt_rand()) . "." . $exts[$pictureType];
$f = fopen($fn, "wb");
fwrite($f, $picture);
fclose($f);
$fields["PICTURE"] = \CFile::MakeFileArray($fn);
}
$ob = new \CIBlock();
$res = $ob->Add($fields);
if ($res) {
self::createIBlockRights($res);
$list = new \CList($res);
if (isset($iblock["~NAME_FIELD"])) {
$list->UpdateField("NAME", $iblock["~NAME_FIELD"]);
}
$list->Save();
\CLists::setLiveFeed(1, $res);
return $res;
}
return 0;
}