<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
*/
/**
- * File for the CiviCRM APIv3 group nesting functions
- *
- * @package CiviCRM_APIv3
- * @subpackage API_Group
+ * This api exposes CiviCRM GroupNesting.
*
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: GroupNesting.php 21624 2009-08-07 22:02:55Z wmorgan $
+ * This defines parent/child relationships between nested groups.
*
+ * @package CiviCRM_APIv3
*/
/**
*
* @param array $params
* An array containing at least child_group_id or parent_group_id.
- * {@getfields GroupNesting_get}
*
* @return array
- * list of group nesting records
+ * list of group nesting records
*/
function civicrm_api3_group_nesting_get($params) {
-
return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupNesting', $params);
}
/**
* Creates group nesting record for given parent and child id.
+ *
* Parent and child groups need to exist.
*
* @param array $params
* Parameters array - allowed array keys include:.
*
* @return array
- * TBD
- * {@getfields GroupNesting_create
+ * TBD
* @todo Work out the return value.
*/
function civicrm_api3_group_nesting_create($params) {
-
CRM_Contact_BAO_GroupNesting::add($params['parent_group_id'], $params['child_group_id']);
// FIXME: CRM_Contact_BAO_GroupNesting requires some work
$result = array('is_error' => 0);
- return civicrm_api3_create_success($result, $params);
+ return civicrm_api3_create_success($result, $params, 'GroupNesting');
}
/**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
- * Array or parameters determined by getfields.
+ * Array of parameters determined by getfields.
*/
function _civicrm_api3_group_nesting_create_spec(&$params) {
$params['child_group_id']['api.required'] = 1;
* Removes specific nesting records.
*
* @param array $params
- * Parameters array - allowed array keys include:.
- * {@getfields GroupNesting_delete}
*
* @return array
- * API Success or fail array
+ * API Success or fail array
*
* @todo Work out the return value.
*/
function civicrm_api3_group_nesting_delete($params) {
-
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}