Ejemplo n.º 1
0
 /**
  * Removes a child group from it's parent.
  *
  * Does not delete child group, just the association between the two
  *
  * @param int $parentID
  *   The id of the group to remove the child from.
  * @param int $childID
  *   The id of the child group being removed.
  */
 public static function remove($parentID, $childID)
 {
     $dao = new CRM_Contact_DAO_GroupNesting();
     $dao->child_group_id = $childID;
     $dao->parent_group_id = $parentID;
     if ($dao->find(TRUE)) {
         $dao->delete();
     }
 }
Ejemplo n.º 2
0
/**
 * Removes specific nesting records.
 * 
 * @param array &$params parameters array - allowed array keys include:
 * {@schema Contact/GroupNesting.xml}
 * 
 * @return array TBD
 * 
 * @todo Work out the return value.
 */
function civicrm_group_nesting_remove(&$params)
{
    if (!is_array($params)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    if (!array_key_exists('child_group_id', $params) || !array_key_exists('parent_group_id', $params)) {
        return civicrm_create_error(ts('You need to define parent_group_id and child_group_id in params.'));
    }
    require_once 'CRM/Contact/DAO/GroupNesting.php';
    $dao = new CRM_Contact_DAO_GroupNesting();
    $dao->copyValues($params);
    if ($dao->delete()) {
        $result = array('is_error' => 0);
    }
    return $result;
}