Commit | Line | Data |
---|---|---|
0b25329b | 1 | <?php |
c28e1768 CW |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
c28e1768 | 5 | | | |
a30c801b TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
c28e1768 CW |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * This api exposes CiviCRM report instances. | |
14 | * | |
b081365f | 15 | * @package CiviCRM_APIv3 |
c28e1768 | 16 | */ |
0b25329b DS |
17 | |
18 | /** | |
9d32e6f7 | 19 | * Retrieve a report instance. |
0b25329b | 20 | * |
cf470720 TO |
21 | * @param array $params |
22 | * Input parameters. | |
0b25329b | 23 | * |
a6c01b45 | 24 | * @return array |
00f8641b | 25 | * API result array |
0b25329b DS |
26 | */ |
27 | function civicrm_api3_report_instance_get($params) { | |
28 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
29 | } | |
30 | ||
31 | /** | |
9d32e6f7 | 32 | * Add or update a report instance. |
77b97be7 | 33 | * |
c490a46a | 34 | * @param array $params |
0b25329b | 35 | * |
a6c01b45 | 36 | * @return array |
00f8641b | 37 | * API result array |
0b25329b DS |
38 | */ |
39 | function civicrm_api3_report_instance_create($params) { | |
a25b46e9 | 40 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ReportInstance'); |
0b25329b DS |
41 | } |
42 | ||
43 | /** | |
0aa0303c EM |
44 | * Adjust Metadata for Create action. |
45 | * | |
46 | * The metadata is used for setting defaults, documentation & validation. | |
0b25329b | 47 | * |
cf470720 | 48 | * @param array $params |
b081365f | 49 | * Array of parameters determined by getfields. |
0b25329b DS |
50 | */ |
51 | function _civicrm_api3_report_instance_create_spec(&$params) { | |
52 | $params['report_id']['api.required'] = 1; | |
53 | $params['title']['api.required'] = 1; | |
57e76da7 | 54 | $params['domain_id']['api.default'] = CRM_Core_Config::domainID(); |
e6e7e540 | 55 | $params['view_mode']['api.default'] = 'view'; |
56 | $params['view_mode']['title'] = ts('View Mode for Navigation URL'); | |
57 | $params['view_mode']['type'] = CRM_Utils_Type::T_STRING; | |
cf8f0fff | 58 | $params['view_mode']['options'] = [ |
e6e7e540 | 59 | 'view' => ts('View'), |
60 | 'criteria' => ts('Show Criteria'), | |
cf8f0fff | 61 | ]; |
0b25329b DS |
62 | } |
63 | ||
64 | /** | |
dc64d047 | 65 | * Deletes an existing ReportInstance. |
0b25329b | 66 | * |
cf470720 | 67 | * @param array $params |
0b25329b | 68 | * |
a6c01b45 | 69 | * @return array |
00f8641b | 70 | * API result array |
0b25329b DS |
71 | */ |
72 | function civicrm_api3_report_instance_delete($params) { | |
73 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
74 | } |