4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.3 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
30 * Definition of the ActivityType part of the CRM API.
31 * More detailed documentation can be found
32 * {@link http://objectledge.org/confluence/display/CRM/CRM+v1.0+Public+APIs
35 * @package CiviCRM_APIv3
36 * @subpackage API_Activity
38 * @copyright CiviCRM LLC (c) 2004-2013
39 * $Id: ActivityType.php 30171 2010-10-14 09:11:27Z mover $
44 * Function to retrieve activity types
46 * @return array $activityTypes activity types keyed by id
49 * @example ActivityTypeGet.php
50 * @deprecated - use constant_get
52 function civicrm_api3_activity_type_get($params) {
55 $activityTypes = CRM_Core_OptionGroup
::values('activity_type');
56 return civicrm_api3_create_success($activityTypes, $params, 'activity_type', 'get');
60 * Function to create activity type (
62 * @param array $params associated array of fields
63 * $params['option_value_id'] is required for updation of activity type
65 * @return array $activityType created / updated activity type
69 *{@schema Activity/ActivityType.xml}
71 * {@example ActivityTypeCreate.php 0}
72 * @deprecated - we will introduce OptionValue Create - plse consider helping with this if not done
74 function civicrm_api3_activity_type_create($params) {
78 $groupParams = array('name' => 'activity_type');
80 if ($optionValueID = CRM_Utils_Array
::value('option_value_id', $params)) {
84 $activityObject = CRM_Core_OptionValue
::addOptionValue($params, $groupParams, $action, $optionValueID);
85 $activityType = array();
86 _civicrm_api3_object_to_array($activityObject, $activityType[$activityObject->id
]);
87 return civicrm_api3_create_success($activityType, $params, 'activity_type', 'create');
91 * Adjust Metadata for Create action
93 * The metadata is used for setting defaults, documentation & validation
94 * @param array $params array or parameters determined by getfields
96 function _civicrm_api3_activity_type_create_spec(&$params) {
97 $params['label']['api.required'] = 1;
98 $params['weight']['api.required'] = 1;
102 * Function to delete activity type
104 * @param activityTypeId int activity type id to delete
110 * @deprecated - we will introduce OptionValue Delete- plse consider helping with this if not done
111 * {@example ActivityTypeDelete.php 0}
113 function civicrm_api3_activity_type_delete($params) {
115 civicrm_api3_verify_mandatory($params, NULL, array('activity_type_id'));
117 $activityTypeId = $params['activity_type_id'];
119 return CRM_Core_BAO_OptionValue
::del($activityTypeId);