6 function activity_getfields_example(){
12 $result = civicrm_api( 'activity','getfields',$params );
18 * Function returns array of result expected from previous function
20 function activity_getfields_expectedresult(){
22 $expectedResult = array(
27 'source_contact_id' => array(
28 'name' => 'source_contact_id',
30 'title' => 'Source Contact',
32 'where' => 'civicrm_activity.source_contact_id',
33 'headerPattern' => '/(activity.)?source(.contact(.id)?)?/i',
35 'FKClassName' => 'CRM_Contact_DAO_Contact',
36 'api.default' => 'user_contact_id',
38 'source_record_id' => array(
39 'name' => 'source_record_id',
41 'title' => 'Source Record',
43 'activity_type_id' => array(
44 'name' => 'activity_type_id',
46 'title' => 'Activity Type ID',
49 'where' => 'civicrm_activity.activity_type_id',
50 'headerPattern' => '/(activity.)?type(.id$)/i',
52 'activity_date_time' => array(
53 'name' => 'activity_date_time',
55 'title' => 'Activity Date',
57 'where' => 'civicrm_activity.activity_date_time',
58 'headerPattern' => '/(activity.)?date(.time$)?/i',
64 'title' => 'Phone (called) ID',
65 'FKClassName' => 'CRM_Core_DAO_Phone',
67 'phone_number' => array(
68 'name' => 'phone_number',
70 'title' => 'Phone (called) Number',
74 'priority_id' => array(
75 'name' => 'priority_id',
77 'title' => 'Priority',
78 'pseudoconstant' => array(
80 'optionGroupName' => 'priority',
82 'api.aliases' => array(
92 'name' => 'parent_id',
94 'title' => 'Parent Activity Id',
95 'FKClassName' => 'CRM_Activity_DAO_Activity',
102 'relationship_id' => array(
103 'name' => 'relationship_id',
105 'title' => 'Relationship Id',
107 'FKClassName' => 'CRM_Contact_DAO_Relationship',
109 'is_current_revision' => array(
110 'name' => 'is_current_revision',
112 'title' => 'Is this activity a current revision in versioning chain?',
114 'where' => 'civicrm_activity.is_current_revision',
115 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i',
118 'original_id' => array(
119 'name' => 'original_id',
121 'title' => 'Original Activity ID ',
122 'FKClassName' => 'CRM_Activity_DAO_Activity',
132 'title' => 'Activity ID',
135 'where' => 'civicrm_activity.id',
137 'uniqueName' => 'activity_id',
142 'title' => 'Subject',
146 'where' => 'civicrm_activity.subject',
147 'headerPattern' => '/(activity.)?subject/i',
149 'uniqueName' => 'activity_subject',
152 'name' => 'duration',
154 'title' => 'Duration',
156 'where' => 'civicrm_activity.duration',
157 'headerPattern' => '/(activity.)?duration(s)?$/i',
159 'uniqueName' => 'activity_duration',
162 'name' => 'location',
164 'title' => 'Location',
168 'where' => 'civicrm_activity.location',
169 'headerPattern' => '/(activity.)?location$/i',
171 'uniqueName' => 'activity_location',
176 'title' => 'Details',
180 'where' => 'civicrm_activity.details',
181 'headerPattern' => '/(activity.)?detail(s)?$/i',
183 'uniqueName' => 'activity_details',
185 'status_id' => array(
186 'name' => 'status_id',
188 'title' => 'Activity Status Id',
190 'where' => 'civicrm_activity.status_id',
191 'headerPattern' => '/(activity.)?status(.label$)?/i',
192 'uniqueName' => 'activity_status_id',
199 'where' => 'civicrm_activity.is_test',
200 'headerPattern' => '/(is.)?test(.activity)?/i',
202 'uniqueName' => 'activity_is_test',
204 'medium_id' => array(
205 'name' => 'medium_id',
207 'title' => 'Activity Medium',
209 'uniqueName' => 'activity_medium_id',
217 'uniqueName' => 'activity_result',
219 'is_deleted' => array(
220 'name' => 'is_deleted',
222 'title' => 'Activity is in the Trash',
224 'where' => 'civicrm_activity.is_deleted',
225 'headerPattern' => '/(activity.)?(trash|deleted)/i',
227 'uniqueName' => 'activity_is_deleted',
229 'campaign_id' => array(
230 'name' => 'campaign_id',
232 'title' => 'Campaign ID',
234 'where' => 'civicrm_activity.campaign_id',
236 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
237 'uniqueName' => 'activity_campaign_id',
239 'engagement_level' => array(
240 'name' => 'engagement_level',
242 'title' => 'Engagement Index',
244 'where' => 'civicrm_activity.engagement_level',
246 'uniqueName' => 'activity_engagement_level',
248 'assignee_contact_id' => array(
249 'name' => 'assignee_id',
250 'title' => 'assigned to',
252 'FKClassName' => 'CRM_Activity_DAO_ActivityAssignment',
254 'target_contact_id' => array(
255 'name' => 'target_id',
256 'title' => 'Activity Target',
258 'FKClassName' => 'CRM_Activity_DAO_ActivityTarget',
260 'activity_status_id' => array(
261 'name' => 'status_id',
262 'title' => 'Status Id',
268 return $expectedResult ;
273 * This example has been generated from the API test suite. The test that created it is called
275 * testGetFields and can be found in
276 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ActivityTest.php
278 * You can see the outcome of the API tests at
279 * http://tests.dev.civicrm.org/trunk/results-api_v3
281 * To Learn about the API read
282 * http://book.civicrm.org/developer/current/techniques/api/
284 * and review the wiki at
285 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
287 * Read more about testing here
288 * http://wiki.civicrm.org/confluence/display/CRM/Testing
290 * API Standards documentation:
291 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards