當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CList::AddField方法代碼示例

本文整理匯總了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"]);
開發者ID:vim84,項目名稱:b-markt,代碼行數:31,代碼來源:component.php

示例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);
         }
     }
 }
開發者ID:andy-profi,項目名稱:bxApiDocs,代碼行數:21,代碼來源:lists.php

示例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;
開發者ID:Satariall,項目名稱:izurit,代碼行數:31,代碼來源:component.php


注:本文中的CList::AddField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。