Merge branch 'rcsheets-docstring-cleanup'
[civicrm-core.git] / api / v3 / examples / Event / IsCurrentOption.php
1 <?php
2 /**
3 * Test Generated example of using event get API
4 * demonstrates use of is.Current option *
5 */
6 function event_get_example(){
7 $params = array(
8 'isCurrent' => 1,
9 );
10
11 try{
12 $result = civicrm_api3('event', 'get', $params);
13 }
14 catch (CiviCRM_API3_Exception $e) {
15 // handle error here
16 $errorMessage = $e->getMessage();
17 $errorCode = $e->getErrorCode();
18 $errorData = $e->getExtraParams();
19 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
20 }
21
22 return $result;
23 }
24
25 /**
26 * Function returns array of result expected from previous function
27 */
28 function event_get_expectedresult(){
29
30 $expectedResult = array(
31 'is_error' => 0,
32 'version' => 3,
33 'count' => 1,
34 'id' => 3,
35 'values' => array(
36 '3' => array(
37 'id' => '3',
38 'title' => 'Annual CiviCRM meet 2',
39 'event_title' => 'Annual CiviCRM meet 2',
40 'summary' => 'If you have any CiviCRM realted issues or want to track where CiviCRM is heading, Sign up now',
41 'description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
42 'event_description' => 'This event is intended to give brief idea about progess of CiviCRM and giving solutions to common user issues',
43 'event_type_id' => '1',
44 'participant_listing_id' => 0,
45 'is_public' => '1',
46 'start_date' => '2013-07-29 00:00:00',
47 'event_start_date' => '2013-07-29 00:00:00',
48 'end_date' => '2013-08-04 00:00:00',
49 'event_end_date' => '2013-08-04 00:00:00',
50 'is_online_registration' => '1',
51 'registration_start_date' => '2010-06-01 00:00:00',
52 'registration_end_date' => '2010-10-15 00:00:00',
53 'max_participants' => '100',
54 'event_full_text' => 'Sorry! We are already full',
55 'is_monetary' => 0,
56 'is_map' => 0,
57 'is_active' => '1',
58 'is_show_location' => 0,
59 'default_role_id' => '1',
60 'is_email_confirm' => 0,
61 'is_pay_later' => 0,
62 'is_partial_payment' => 0,
63 'is_multiple_registrations' => 0,
64 'allow_same_participant_emails' => 0,
65 'is_template' => 0,
66 'created_date' => '2013-07-28 08:49:19',
67 'is_share' => '1',
68 ),
69 ),
70 );
71
72 return $expectedResult;
73 }
74
75
76 /*
77 * This example has been generated from the API test suite. The test that created it is called
78 *
79 * testGetIsCurrent and can be found in
80 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php
81 *
82 * You can see the outcome of the API tests at
83 * https://test.civicrm.org/job/CiviCRM-master-git/
84 *
85 * To Learn about the API read
86 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
87 *
88 * Browse the api on your own site with the api explorer
89 * http://MYSITE.ORG/path/to/civicrm/api/explorer
90 *
91 * Read more about testing here
92 * http://wiki.civicrm.org/confluence/display/CRM/Testing
93 *
94 * API Standards documentation:
95 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
96 */