3 * Test Generated example demonstrating the Event.create API.
8 function event_create_example() {
10 'title' => 'Annual CiviCRM meet',
11 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
12 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
15 'start_date' => 20081021,
16 'end_date' => 20081023,
17 'is_online_registration' => 1,
18 'registration_start_date' => 20080601,
19 'registration_end_date' => '2008-10-15',
20 'max_participants' => 100,
21 'event_full_text' => 'Sorry! We are already full',
24 'is_show_location' => 0,
28 $result = civicrm_api3('Event', 'create', $params);
30 catch (CiviCRM_API3_Exception
$e) {
32 $errorMessage = $e->getMessage();
33 $errorCode = $e->getErrorCode();
34 $errorData = $e->getExtraParams();
36 'error' => $errorMessage,
37 'error_code' => $errorCode,
38 'error_data' => $errorData,
46 * Function returns array of result expected from previous function.
51 function event_create_expectedresult() {
53 $expectedResult = array(
61 'title' => 'Annual CiviCRM meet',
62 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
63 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
64 'event_type_id' => '1',
65 'participant_listing_id' => '',
67 'start_date' => '2013-07-29 00:00:00',
68 'end_date' => '2013-08-04 00:00:00',
69 'is_online_registration' => '1',
70 'registration_link_text' => '',
71 'registration_start_date' => '20080601000000',
72 'registration_end_date' => '20081015000000',
73 'max_participants' => '100',
74 'event_full_text' => 'Sorry! We are already full',
76 'financial_type_id' => '',
77 'payment_processor' => '',
81 'is_show_location' => 0,
83 'default_role_id' => '',
86 'confirm_title' => '',
88 'confirm_footer_text' => '',
89 'is_email_confirm' => '',
90 'confirm_email_text' => '',
91 'confirm_from_name' => '',
92 'confirm_from_email' => '',
95 'default_fee_id' => '',
96 'default_discount_fee_id' => '',
97 'thankyou_title' => '',
98 'thankyou_text' => '',
99 'thankyou_footer_text' => '',
100 'is_pay_later' => '',
101 'pay_later_text' => '',
102 'pay_later_receipt' => '',
103 'is_partial_payment' => '',
104 'initial_amount_label' => '',
105 'initial_amount_help_text' => '',
106 'min_initial_amount' => '',
107 'is_multiple_registrations' => '',
108 'allow_same_participant_emails' => '',
109 'has_waitlist' => '',
110 'requires_approval' => '',
111 'expiration_time' => '',
112 'waitlist_text' => '',
113 'approval_req_text' => '',
115 'template_title' => '',
117 'created_date' => '2013-07-28 08:49:19',
121 'is_confirm_enabled' => '',
122 'parent_event_id' => '',
123 'slot_label_id' => '',
124 'dedupe_rule_group_id' => '',
125 'is_billing_required' => '',
130 return $expectedResult;
134 * This example has been generated from the API test suite.
135 * The test that created it is called "testCreateEventSuccess"
136 * and can be found at:
137 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
139 * You can see the outcome of the API tests at
140 * https://test.civicrm.org/job/CiviCRM-master-git/
142 * To Learn about the API read
143 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
145 * Browse the api on your own site with the api explorer
146 * http://MYSITE.ORG/path/to/civicrm/api
148 * Read more about testing here
149 * http://wiki.civicrm.org/confluence/display/CRM/Testing
151 * API Standards documentation:
152 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards