Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
731a0992 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
a14e9d08 | 29 | * @deprecated |
6a488035 TO |
30 | * |
31 | * @package CiviCRM_APIv3 | |
32 | * @subpackage API_Activity | |
33 | * | |
731a0992 | 34 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 | 35 | * $Id: ActivityType.php 30171 2010-10-14 09:11:27Z mover $ |
6a488035 TO |
36 | */ |
37 | ||
a14e9d08 | 38 | /** |
9d32e6f7 EM |
39 | * Notification of deprecated function. |
40 | * | |
a14e9d08 | 41 | * @deprecated api notice |
a6c01b45 | 42 | * @return string |
72b3a70c | 43 | * to indicate this entire api entity is deprecated |
a14e9d08 CW |
44 | */ |
45 | function _civicrm_api3_activity_type_deprecation() { | |
46 | return 'The activity_type api is deprecated. Please use the option_value api instead.'; | |
47 | } | |
48 | ||
6a488035 | 49 | /** |
9d32e6f7 | 50 | * Retrieve activity types. |
6a488035 | 51 | * |
c490a46a | 52 | * @param array $params |
77b97be7 | 53 | * |
a6c01b45 | 54 | * @return array |
72b3a70c | 55 | * activity types keyed by id |
4e420887 | 56 | * @deprecated - use getoptions |
6a488035 TO |
57 | */ |
58 | function civicrm_api3_activity_type_get($params) { | |
59 | ||
6a488035 TO |
60 | $activityTypes = CRM_Core_OptionGroup::values('activity_type'); |
61 | return civicrm_api3_create_success($activityTypes, $params, 'activity_type', 'get'); | |
62 | } | |
63 | ||
64 | /** | |
9d32e6f7 | 65 | * Create activity type. |
6a488035 | 66 | * |
cf470720 | 67 | * @param array $params |
6a488035 | 68 | * |
a6c01b45 | 69 | * @return array |
72b3a70c | 70 | * created / updated activity type |
6a488035 | 71 | * |
a14e9d08 | 72 | * @deprecated - use option_value create |
6a488035 TO |
73 | */ |
74 | function civicrm_api3_activity_type_create($params) { | |
75 | ||
6a488035 TO |
76 | $action = 1; |
77 | $groupParams = array('name' => 'activity_type'); | |
78 | ||
79 | if ($optionValueID = CRM_Utils_Array::value('option_value_id', $params)) { | |
80 | $action = 2; | |
81 | } | |
82 | ||
6a488035 TO |
83 | $activityObject = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $action, $optionValueID); |
84 | $activityType = array(); | |
85 | _civicrm_api3_object_to_array($activityObject, $activityType[$activityObject->id]); | |
86 | return civicrm_api3_create_success($activityType, $params, 'activity_type', 'create'); | |
87 | } | |
11e09c59 TO |
88 | |
89 | /** | |
0aa0303c EM |
90 | * Adjust Metadata for Create action. |
91 | * | |
92 | * The metadata is used for setting defaults, documentation & validation. | |
1c88e578 | 93 | * |
cf470720 TO |
94 | * @param array $params |
95 | * Array or parameters determined by getfields. | |
6a488035 TO |
96 | */ |
97 | function _civicrm_api3_activity_type_create_spec(&$params) { | |
98 | $params['label']['api.required'] = 1; | |
1fdb479f | 99 | $params['label']['title'] = 'Label'; |
6a488035 | 100 | $params['weight']['api.required'] = 1; |
1fdb479f | 101 | $params['weight']['title'] = 'Weight'; |
6a488035 TO |
102 | } |
103 | ||
104 | /** | |
9d32e6f7 | 105 | * Delete activity type. |
6a488035 | 106 | * |
cf470720 TO |
107 | * @param array $params |
108 | * Array including id of activity_type to delete. | |
22242c87 | 109 | * |
a6c01b45 | 110 | * @return array |
72b3a70c | 111 | * API result array |
6a488035 | 112 | * |
6a488035 | 113 | * @deprecated - we will introduce OptionValue Delete- plse consider helping with this if not done |
6a488035 TO |
114 | */ |
115 | function civicrm_api3_activity_type_delete($params) { | |
4e420887 | 116 | return civicrm_api3_create_success(CRM_Core_BAO_OptionValue::del($params['id']), $params); |
6a488035 | 117 | } |