当前位置: 首页>>代码示例>>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;未经允许,请勿转载。