本文整理汇总了PHP中CList::AddField方法的典型用法代码示例。如果您正苦于以下问题:PHP CList::AddField方法的具体用法?PHP CList::AddField怎么用?PHP CList::AddField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::AddField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CIBlock
}
//For existing iblock add rights to rule
$arFields["RIGHTS_MODE"] = "E";
$arFields["RIGHTS"] = CListPermissions::MergeRights($arParams["~IBLOCK_TYPE_ID"], $arDBRights, $arPOSTRights);
//Update existing or add new
$ob = new CIBlock();
if ($arIBlock) {
$res = $ob->Update($arIBlock["ID"], $arFields);
if ($res) {
$res = $arIBlock["ID"];
}
} else {
$res = $ob->Add($arFields);
if ($res) {
$obList = new CList($res);
$obList->AddField(array("SORT" => 10, "NAME" => GetMessage("CC_BLLE_NAME_FIELD"), "IS_REQUIRED" => "Y", "MULTIPLE" => "N", "TYPE" => "NAME", "DEFAULT_VALUE" => ""));
$obList->Save();
}
}
if ($res) {
if (strlen($arFields["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork')) {
CSocNetGroup::SetLastActivity($arFields["SOCNET_GROUP_ID"]);
}
//Clear components cache
$CACHE_MANAGER->ClearByTag("lists_list_" . $res);
$CACHE_MANAGER->ClearByTag("lists_list_any");
$CACHE_MANAGER->CleanDir("menu");
$tab_name = $arResult["FORM_ID"] . "_active_tab";
//And go to proper page
if (isset($_POST["save"])) {
LocalRedirect($arResult["LISTS_URL"]);
示例2: OnSharepointCreateProperty
public static function OnSharepointCreateProperty($arInputFields)
{
global $DB;
$iblock_id = intval($arInputFields["IBLOCK_ID"]);
if ($iblock_id > 0) {
//Check if there is at list one field defined for given iblock
$rsFields = $DB->Query("\n\t\t\t\tSELECT * FROM b_lists_field\n\t\t\t\tWHERE IBLOCK_ID = " . $iblock_id . "\n\t\t\t\tORDER BY SORT ASC\n\t\t\t", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($rsFields->Fetch()) {
$arNewFields = array("SORT" => 500, "NAME" => $arInputFields["SP_FIELD"]);
if (substr($arInputFields["FIELD_ID"], 0, 9) == "PROPERTY_") {
$arNewFields["ID"] = substr($arInputFields["FIELD_ID"], 9);
$arNewFields["TYPE"] = "S";
} else {
$arNewFields["TYPE"] = $arInputFields["FIELD_ID"];
}
//Publish property on the list
$obList = new CList($iblock_id);
$obList->AddField($arNewFields);
}
}
}
示例3: foreach
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 {
ShowError($strError);
$bVarsFromForm = true;