/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Creates or updates an Dashlet.
*
- * @param array $params Associative array of property name/value
- * pairs for the Dashlet.
- *
- * @return array Array containing 'is_error' to denote success or failure and details of the created activity
+ * @param array $params
*
+ * @return array
+ * Array containing 'is_error' to denote success or failure and details of the created activity
*/
function civicrm_api3_dashboard_create($params) {
- if (empty($params['id'])) {
- civicrm_api3_verify_one_mandatory($params,
- NULL,
- array(
- 'name',
- 'label',
- 'url',
- 'fullscreen_url',
- )
- );
- }
- // create dashboard element
- $dashboardBAO = CRM_Core_BAO_Dashboard::addDashlet($params);
- if (isset($dashboardBAO->id)) {
- _civicrm_api3_object_to_array($dashboardBAO, $dashboardArray[$dashboardBAO->id]);
- return civicrm_api3_create_success($dashboardArray, $params, 'dashboard', 'create', $dashboardBAO);
- }
+ civicrm_api3_verify_one_mandatory($params, NULL, array(
+ 'name',
+ 'label',
+ 'url',
+ 'fullscreen_url',
+ )
+ );
+ return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Dashboard');
}
/**
* Specify Meta data for create. Note that this data is retrievable via the getfields function
* and is used for pre-filling defaults and ensuring mandatory requirements are met.
- * @param array $params (reference) array of parameters determined by getfields
+ * @param array $params
+ * (reference) array of parameters determined by getfields.
*/
function _civicrm_api3_dashboard_create_spec(&$params) {
unset($params['version']);
/**
* Gets a CiviCRM Dashlets according to parameters
*
- * @param array $params Associative array of property name/value
- * pairs for the activity.
+ * @param array $params
*
* @return array
- *
*/
function civicrm_api3_dashboard_get($params) {
$bao = new CRM_Core_BAO_Dashboard();
/**
* Delete a specified Dashlet.
*
- * @param array $params array holding 'id' OR 'name' of dashlet to be deleted
- *
- * @return void|CRM_Core_Error An error if 'name or ID' is invalid,
+ * @param array $params
+ * Array holding 'id' of dashlet to be deleted.
*
+ * @return array
*/
function civicrm_api3_dashboard_delete($params) {
if (CRM_Core_BAO_Dashboard::deleteDashlet($params['id'])) {