Merge pull request #972 from deepak-srivastava/hr
[civicrm-core.git] / api / v3 / examples / Contact / GroupFilterUsingContactAPI.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 Get all from group and display contacts
5 */
6function contact_get_example(){
7$params = array(
8 'filter.group_id' => array(
9 '0' => 1,
10 '1' => 26,
11 ),
12 'version' => 3,
13 'contact_type' => 'Individual',
14);
15
16 $result = civicrm_api( 'contact','get',$params );
17
18 return $result;
19}
20
21/*
22 * Function returns array of result expected from previous function
23 */
24function contact_get_expectedresult(){
25
26 $expectedResult = array(
27 'is_error' => 0,
28 'version' => 3,
29 'count' => 1,
30 'id' => 1,
31 'values' => array(
32 '1' => array(
33 'contact_id' => '1',
34 'contact_type' => 'Individual',
35 'contact_sub_type' => '',
36 'sort_name' => 'man2@yahoo.com',
37 'display_name' => 'man2@yahoo.com',
38 'do_not_email' => 0,
39 'do_not_phone' => 0,
40 'do_not_mail' => 0,
41 'do_not_sms' => 0,
42 'do_not_trade' => 0,
43 'is_opt_out' => 0,
44 'legal_identifier' => '',
45 'external_identifier' => '',
46 'nick_name' => '',
47 'legal_name' => '',
48 'image_URL' => '',
49 'preferred_mail_format' => 'Both',
50 'first_name' => '',
51 'middle_name' => '',
52 'last_name' => '',
53 'job_title' => '',
54 'birth_date' => '',
55 'is_deceased' => 0,
56 'deceased_date' => '',
57 'household_name' => '',
58 'organization_name' => '',
59 'sic_code' => '',
60 'contact_is_deleted' => 0,
61 'gender_id' => '',
62 'gender' => '',
63 'prefix_id' => '',
64 'prefix' => '',
65 'suffix_id' => '',
66 'suffix' => '',
67 'current_employer' => '',
68 'address_id' => '',
69 'street_address' => '',
70 'supplemental_address_1' => '',
71 'supplemental_address_2' => '',
72 'city' => '',
73 'postal_code_suffix' => '',
74 'postal_code' => '',
75 'geo_code_1' => '',
76 'geo_code_2' => '',
77 'state_province_id' => '',
78 'state_province_name' => '',
79 'state_province' => '',
80 'country_id' => '',
81 'country' => '',
82 'phone_id' => '',
83 'phone_type_id' => '',
84 'phone' => '',
85 'email_id' => '1',
86 'email' => 'man2@yahoo.com',
87 'on_hold' => 0,
88 'im_id' => '',
89 'provider_id' => '',
90 'im' => '',
91 'worldregion_id' => '',
92 'world_region' => '',
93 'id' => '1',
94 ),
95 ),
96);
97
98 return $expectedResult ;
99}
100
101
102/*
103* This example has been generated from the API test suite. The test that created it is called
104*
105* testGetGroupIDFromContact and can be found in
106* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ContactTest.php
107*
108* You can see the outcome of the API tests at
109* http://tests.dev.civicrm.org/trunk/results-api_v3
110*
111* To Learn about the API read
112* http://book.civicrm.org/developer/current/techniques/api/
113*
114* and review the wiki at
115* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
116*
117* Read more about testing here
118* http://wiki.civicrm.org/confluence/display/CRM/Testing
119*
120* API Standards documentation:
121* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
122*/