3 * Test Generated example of using event create API
6 function event_create_example(){
8 'title' => 'Annual CiviCRM meet',
9 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
10 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
13 'start_date' => 20081021,
14 'end_date' => 20081023,
15 'is_online_registration' => 1,
16 'registration_start_date' => 20080601,
17 'registration_end_date' => '2008-10-15',
18 'max_participants' => 100,
19 'event_full_text' => 'Sorry! We are already full',
22 'is_show_location' => 0,
26 $result = civicrm_api3('event', 'create', $params);
28 catch (CiviCRM_API3_Exception
$e) {
30 $errorMessage = $e->getMessage();
31 $errorCode = $e->getErrorCode();
32 $errorData = $e->getExtraParams();
33 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
40 * Function returns array of result expected from previous function
42 function event_create_expectedresult(){
44 $expectedResult = array(
52 'title' => 'Annual CiviCRM meet',
53 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
54 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
55 'event_type_id' => '1',
56 'participant_listing_id' => '',
58 'start_date' => '20081021000000',
59 'end_date' => '20081023000000',
60 'is_online_registration' => '1',
61 'registration_link_text' => '',
62 'registration_start_date' => '20080601000000',
63 'registration_end_date' => '20081015000000',
64 'max_participants' => '100',
65 'event_full_text' => 'Sorry! We are already full',
67 'financial_type_id' => '',
68 'payment_processor' => '',
72 'is_show_location' => 0,
74 'default_role_id' => '',
77 'confirm_title' => '',
79 'confirm_footer_text' => '',
80 'is_email_confirm' => '',
81 'confirm_email_text' => '',
82 'confirm_from_name' => '',
83 'confirm_from_email' => '',
86 'default_fee_id' => '',
87 'default_discount_fee_id' => '',
88 'thankyou_title' => '',
89 'thankyou_text' => '',
90 'thankyou_footer_text' => '',
92 'pay_later_text' => '',
93 'pay_later_receipt' => '',
94 'is_partial_payment' => '',
95 'initial_amount_label' => '',
96 'initial_amount_help_text' => '',
97 'min_initial_amount' => '',
98 'is_multiple_registrations' => '',
99 'allow_same_participant_emails' => '',
100 'has_waitlist' => '',
101 'requires_approval' => '',
102 'expiration_time' => '',
103 'waitlist_text' => '',
104 'approval_req_text' => '',
106 'template_title' => '',
108 'created_date' => '2013-07-28 08:49:19',
112 'parent_event_id' => '',
113 'slot_label_id' => '',
118 return $expectedResult;
123 * This example has been generated from the API test suite. The test that created it is called
125 * testCreateEventSuccess and can be found in
126 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EventTest.php
128 * You can see the outcome of the API tests at
129 * http://tests.dev.civicrm.org/trunk/results-api_v3
131 * To Learn about the API read
132 * http://book.civicrm.org/developer/current/techniques/api/
134 * and review the wiki at
135 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
137 * Read more about testing here
138 * http://wiki.civicrm.org/confluence/display/CRM/Testing
140 * API Standards documentation:
141 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards