del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting Note'); } /** * Retrieve a specific note, given a set of input params * * @param array $params * Input parameters. * * @return array * array of properties, * if error an array with an error id and error message * {@getfields note_get} */ function civicrm_api3_note_get($params) { return _civicrm_api3_basic_get('CRM_Core_BAO_Note', $params); } /** * Adjust Metadata for Get action * * The metadata is used for setting defaults, documentation & validation * @param array $params * Array or parameters determined by getfields. */ function _civicrm_api3_note_get_spec(&$params) { $params['entity_table']['api.default'] = "civicrm_contact"; } /** * Get all descendents of given note * * @param array $params * Associative array; only required 'id' parameter is used. * * @return array * Nested associative array beginning with direct children of given note. */ function &civicrm_api3_note_tree_get($params) { civicrm_api3_verify_mandatory($params, NULL, array('id')); if (!is_numeric($params['id'])) { return civicrm_api3_create_error(ts("Invalid note ID")); } if (!isset($params['max_depth'])) { $params['max_depth'] = 0; } if (!isset($params['snippet'])) { $params['snippet'] = FALSE; } $noteTree = CRM_Core_BAO_Note::getNoteTree($params['id'], $params['max_depth'], $params['snippet']); return civicrm_api3_create_success($noteTree, $params); }