本文整理汇总了PHP中CRM_Core_DAO_UFGroup::copyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFGroup::copyValues方法的具体用法?PHP CRM_Core_DAO_UFGroup::copyValues怎么用?PHP CRM_Core_DAO_UFGroup::copyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_DAO_UFGroup::copyValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Add the UF Group.
*
* @param array $params
* Reference array contains the values submitted by the form.
* @param array $ids
* Reference array contains the id.
*
*
* @return object
*/
public static function add(&$params, $ids = array())
{
$fields = array('is_active', 'add_captcha', 'is_map', 'is_update_dupe', 'is_edit_link', 'is_uf_link', 'is_cms_user');
foreach ($fields as $field) {
$params[$field] = CRM_Utils_Array::value($field, $params, FALSE);
}
$params['limit_listings_group_id'] = CRM_Utils_Array::value('group', $params);
$params['add_to_group_id'] = CRM_Utils_Array::value('add_contact_to_group', $params);
//CRM-15427
if (!empty($params['group_type']) && is_array($params['group_type'])) {
$params['group_type'] = implode(',', $params['group_type']);
}
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->copyValues($params);
$ufGroupID = CRM_Utils_Array::value('ufgroup', $ids, CRM_Utils_Array::value('id', $params));
if (!$ufGroupID) {
$ufGroup->name = CRM_Utils_String::munge($ufGroup->title, '_', 56);
}
$ufGroup->id = $ufGroupID;
$ufGroup->save();
if (!$ufGroupID) {
$ufGroup->name = $ufGroup->name . "_{$ufGroup->id}";
$ufGroup->save();
}
return $ufGroup;
}
示例2: add
/**
* function to add the UF Group
*
* @param array $params reference array contains the values submitted by the form
* @param array $ids reference array contains the id
*
* @access public
* @static
* @return object
*/
static function add(&$params, &$ids)
{
require_once 'CRM/Utils/Array.php';
$fields = array('is_active', 'add_captcha', 'is_map', 'is_update_dupe', 'is_edit_link', 'is_uf_link', 'is_cms_user');
foreach ($fields as $field) {
$params[$field] = CRM_Utils_Array::value($field, $params, false);
}
$params['limit_listings_group_id'] = CRM_Utils_Array::value('group', $params);
$params['add_to_group_id'] = CRM_Utils_Array::value('add_contact_to_group', $params);
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->copyValues($params);
$ufGroupID = CRM_Utils_Array::value('ufgroup', $ids);
if (!$ufGroupID) {
$ufGroup->name = CRM_Utils_String::munge($ufGroup->title, '_', 64);
}
$ufGroup->id = $ufGroupID;
$ufGroup->save();
return $ufGroup;
}