本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::deleteGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::deleteGroup方法的具体用法?PHP CRM_Core_BAO_CustomGroup::deleteGroup怎么用?PHP CRM_Core_BAO_CustomGroup::deleteGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::deleteGroup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
$group = new CRM_Core_DAO_CustomGroup();
$group->id = $this->_id;
$group->find(TRUE);
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_CustomGroup', $this->_id);
CRM_Core_BAO_CustomGroup::deleteGroup($group);
CRM_Core_Session::setStatus(ts("The Group '%1' has been deleted.", array(1 => $group->title)), '', 'success');
}
示例2: civicrm_api3_custom_group_delete
/**
* Use this API to delete an existing group.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_custom_group_delete($params)
{
$values = new CRM_Core_DAO_CustomGroup();
$values->id = $params['id'];
$values->find(TRUE);
$result = CRM_Core_BAO_CustomGroup::deleteGroup($values, TRUE);
return $result ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting custom group');
}
示例3: testDeleteGroup
/**
* Function to test deleteGroup()
*/
function testDeleteGroup()
{
$customGrouptitle = 'My Custom Group';
$groupParams = array('title' => $customGrouptitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'is_active' => 1);
$customGroup = Custom::createGroup($groupParams);
$customGroupId = $customGroup->id;
//get the custom group title
$dbCustomGroupTitle = $this->assertDBNotNull('CRM_Core_DAO_CustomGroup', $customGroupId, 'title', 'id', 'Database check for custom group record.');
//check for group title
$this->assertEquals($customGrouptitle, $dbCustomGroupTitle);
require_once 'CRM/Core/BAO/CustomGroup.php';
//delete the group
$isDelete = CRM_Core_BAO_CustomGroup::deleteGroup($customGroup);
//check for delete
$this->assertEquals(true, $isDelete);
//check the DB
$this->assertDBNull('CRM_Core_DAO_CustomGroup', $customGroupId, 'title', 'id', 'Database check for custom group record.');
}
示例4: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
function postProcess()
{
$group =& new CRM_Core_DAO_CustomGroup();
$group->id = $this->_id;
$group->find();
$group->fetch();
if (CRM_Core_BAO_CustomGroup::deleteGroup($this->_id)) {
CRM_Core_Session::setStatus(ts('The Group "%1" has been deleted.', array(1 => $group->title)));
} else {
CRM_Core_Session::setStatus(ts('The Group "%1" has not been deleted! You must Delete all custom fields in this group prior to deleting the group', array(1 => $group->title)));
}
}
示例5: deleteGroup
/**
* Helper function to delete custom group
* @deprecated use function on parent class
* @param object Custom Group to delete
* @return boolean true if Group deleted, false otherwise
*/
static function deleteGroup($params)
{
require_once 'CRM/Core/BAO/CustomGroup.php';
$deleteCustomGroup = CRM_Core_BAO_CustomGroup::deleteGroup($params, TRUE);
return $deleteCustomGroup;
}
示例6: testDeleteGroup
/**
* Test deleteGroup.
*/
public function testDeleteGroup()
{
$customGroupTitle = 'My Custom Group';
$groupParams = array('title' => $customGroupTitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'is_active' => 1);
$customGroup = $this->customGroupCreate($groupParams);
$groupObject = new CRM_Core_BAO_CustomGroup();
$groupObject->id = $customGroup['id'];
$groupObject->find(TRUE);
$isDelete = CRM_Core_BAO_CustomGroup::deleteGroup($groupObject);
// Check it worked!
$this->assertEquals(TRUE, $isDelete);
$this->assertDBNull('CRM_Core_DAO_CustomGroup', $customGroup['id'], 'title', 'id', 'Database check for custom group record.');
}
示例7: civicrm_custom_group_delete
/**
* Use this API to delete an existing group.
*
* @param array id of the group to be deleted
*
* @return Null if success
* @access public
**/
function civicrm_custom_group_delete($params)
{
_civicrm_initialize();
if (!is_array($params)) {
return civicrm_create_error('Params is not an array');
}
if (!CRM_Utils_Array::value('id', $params)) {
return civicrm_create_error('Invalid or no value for Custom group ID');
}
// convert params array into Object
require_once 'CRM/Core/DAO/CustomGroup.php';
$values = new CRM_Core_DAO_CustomGroup();
$values->id = $params['id'];
$values->find(true);
require_once 'CRM/Core/BAO/CustomGroup.php';
$result = CRM_Core_BAO_CustomGroup::deleteGroup($values);
return $result ? civicrm_create_success() : civicrm_error('Error while deleting custom group');
}
示例8: deleteGroup
/**
* Helper function to delete custom group.
*
* @deprecated use function on parent class
*
* @param $params
*
* @return bool
* true if Group deleted, false otherwise
*/
public static function deleteGroup($params)
{
$deleteCustomGroup = CRM_Core_BAO_CustomGroup::deleteGroup($params, TRUE);
return $deleteCustomGroup;
}