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


PHP CustomFields::add方法代碼示例

本文整理匯總了PHP中CustomFields::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP CustomFields::add方法的具體用法?PHP CustomFields::add怎麽用?PHP CustomFields::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CustomFields的用法示例。


在下文中一共展示了CustomFields::add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dpGetParam

 *	do_custom_field_aed.php
 *
 */
require_once $AppUI->getSystemClass('CustomFields');
$edit_field_id = dpGetParam($_POST, "field_id", NULL);
if ($edit_field_id != NULL) {
    $edit_module = dpGetParam($_POST, "module", NULL);
    $field_name = dpGetParam($_POST, "field_name", NULL);
    $field_description = db_escape(dpGetParam($_POST, "field_description", NULL));
    $field_htmltype = dpGetParam($_POST, "field_htmltype", NULL);
    $field_datatype = dpGetParam($_POST, "field_datatype", "alpha");
    $field_extratags = db_escape(dpGetParam($_POST, "field_extratags", NULL));
    $list_select_items = dpGetParam($_POST, "select_items", NULL);
    $custom_fields = new CustomFields(strtolower($edit_module), 'addedit', null, null);
    if ($edit_field_id == 0) {
        $fid = $custom_fields->add($field_name, $field_description, $field_htmltype, $field_datatype, $field_extratags, $msg);
    } else {
        $fid = $custom_fields->update($edit_field_id, $field_name, $field_description, $field_htmltype, $field_datatype, $field_extratags, $msg);
    }
    // Add or Update a Custom Field
    if ($msg) {
        $AppUI->setMsg($AppUI->_('Error adding custom field:') . $msg, UI_MSG_ALERT, true);
    } else {
        if ($field_htmltype == "select") {
            $opts = new CustomOptionList($fid);
            $opts->setOptions($list_select_items);
            if ($edit_field_id == 0) {
                $o_msg = $opts->store();
            } else {
                // To update each list would be a lot more complex than rewriting it
                // So it is, but it is needed in order for it to work properly. (Pedro A. Bug 1163)
開發者ID:klr2003,項目名稱:sourceread,代碼行數:31,代碼來源:do_custom_field_aed.php


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