Documentation

Activity.php

This api exposes CiviCRM Activity records.

Table of Contents

Functions

civicrm_api3_activity_create()  : array<string|int, mixed>
Creates or updates an Activity.
_civicrm_api3_activity_create_spec()  : mixed
Specify Meta data for create.
_civicrm_api3_activity_get_spec()  : mixed
Specify Metadata for get.
civicrm_api3_activity_get()  : array<string|int, mixed>
Gets a CiviCRM activity according to parameters.
_civicrm_activity_get_handleSourceContactNameOrderBy()  : mixed
Handle source_contact_name as a sort parameter.
_civicrm_api3_activity_get_extraFilters()  : mixed
Support filters beyond what basic_get can do.
_civicrm_api3_activity_get_formatResult()  : array<string|int, mixed>
Given a list of activities, append any extra data requested about the activities.
_civicrm_api3_activity_fill_activity_contact_names()  : mixed
Append activity contact details to activity results.
civicrm_api3_activity_delete()  : array<string|int, mixed>
Delete a specified Activity.
_civicrm_api3_activity_check_params()  : array<string|int, mixed>
Check for required params.
_civicrm_api3_activity_getlist_params()  : mixed
Get parameters for activity list.
_civicrm_api3_activity_getlist_output()  : array<string|int, mixed>
Get output for activity list.

Functions

civicrm_api3_activity_create()

Creates or updates an Activity.

civicrm_api3_activity_create(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Array per getfields documentation.

Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

API result array

_civicrm_api3_activity_create_spec()

Specify Meta data for create.

_civicrm_api3_activity_create_spec(array<string|int, mixed> &$params) : mixed

Note that this data is retrievable via the getfields function and is used for pre-filling defaults and ensuring mandatory requirements are met.

Parameters
$params : array<string|int, mixed>

Array of parameters determined by getfields.

_civicrm_api3_activity_get_spec()

Specify Metadata for get.

_civicrm_api3_activity_get_spec(array<string|int, mixed> &$params) : mixed
Parameters
$params : array<string|int, mixed>

civicrm_api3_activity_get()

Gets a CiviCRM activity according to parameters.

civicrm_api3_activity_get(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Array per getfields documentation.

Tags
throws
CRM_Core_Exception
throws
UnauthorizedException
Return values
array<string|int, mixed>

API result array

_civicrm_activity_get_handleSourceContactNameOrderBy()

Handle source_contact_name as a sort parameter.

_civicrm_activity_get_handleSourceContactNameOrderBy(array<string|int, mixed> &$params, array<string|int, mixed> &$options, CRM_Utils_SQL_Select $sql) : mixed

This is passed from the activity selector - e.g search results or contact tab.

It's a non-standard handling but this api already handles variations on handling source_contact as a filter & as a field so it's in keeping with that. Source contact has a one-one relationship with activity table.

Test coverage in CRM_Activity_BAO_ActivtiyTest::testGetActivitiesforContactSummaryWithSortOptions

Parameters
$params : array<string|int, mixed>
$options : array<string|int, mixed>
$sql : CRM_Utils_SQL_Select

_civicrm_api3_activity_get_formatResult()

Given a list of activities, append any extra data requested about the activities.

_civicrm_api3_activity_get_formatResult(array<string|int, mixed> $params, array<string|int, mixed> $activities, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

API request parameters.

$activities : array<string|int, mixed>
$options : array<string|int, mixed>

Options array (pre-processed to extract 'return' from params).

Tags
note

Called by civicrm-core and CiviHR

Return values
array<string|int, mixed>

new activities list

_civicrm_api3_activity_fill_activity_contact_names()

Append activity contact details to activity results.

_civicrm_api3_activity_fill_activity_contact_names(array<string|int, mixed> &$activities, array<string|int, mixed> $params, array<string|int, mixed> $returns) : mixed

Adds id & name of activity contacts to results array if check_permissions does not block access to them.

For historical reasons source_contact_id is always added & is not an array. The others are added depending on requested return params.

Parameters
$activities : array<string|int, mixed>
$params : array<string|int, mixed>
$returns : array<string|int, mixed>

civicrm_api3_activity_delete()

Delete a specified Activity.

civicrm_api3_activity_delete(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Array holding 'id' of activity to be deleted.

Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

API result array

_civicrm_api3_activity_check_params()

Check for required params.

_civicrm_api3_activity_check_params(array<string|int, mixed> &$params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Associated array of fields.

Tags
throws
CRM_Core_Exception
throws
Exception
Return values
array<string|int, mixed>

array with errors

_civicrm_api3_activity_getlist_params()

Get parameters for activity list.

_civicrm_api3_activity_getlist_params(array<string|int, mixed> &$request) : mixed
Parameters
$request : array<string|int, mixed>

API request.

Tags
see
_civicrm_api3_generic_getlist_params

_civicrm_api3_activity_getlist_output()

Get output for activity list.

_civicrm_api3_activity_getlist_output(array<string|int, mixed> $result, array<string|int, mixed> $request) : array<string|int, mixed>
Parameters
$result : array<string|int, mixed>
$request : array<string|int, mixed>
Tags
see
_civicrm_api3_generic_getlist_output
Return values
array<string|int, mixed>

        
On this page

Search results