/** * Delete a specified Dashlet. * * @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'])) { return civicrm_api3_create_success(1, $params, 'Dashboard', 'delete'); } else { return civicrm_api3_create_error('Could not delete dashlet'); } }
/** * Function used for CiviCRM dashboard operations. */ public static function dashboard() { switch ($_REQUEST['op']) { case 'save_columns': CRM_Core_BAO_Dashboard::saveDashletChanges($_REQUEST['columns']); break; case 'delete_dashlet': $dashletID = CRM_Utils_Type::escape($_REQUEST['dashlet_id'], 'Positive'); CRM_Core_BAO_Dashboard::deleteDashlet($dashletID); } CRM_Utils_System::civiExit(); }
/** * Function used for CiviCRM dashboard operations. */ public static function dashboard() { $operation = CRM_Utils_Type::escape($_REQUEST['op'], 'String'); switch ($operation) { case 'get_widgets_by_column': // This would normally be coming from either the database (this user's settings) or a default/initial dashboard configuration. // get contact id of logged in user $dashlets = CRM_Core_BAO_Dashboard::getContactDashlets(); break; case 'get_widget': $dashletID = CRM_Utils_Type::escape($_GET['id'], 'Positive'); $dashlets = CRM_Core_BAO_Dashboard::getDashletInfo($dashletID); break; case 'save_columns': CRM_Core_BAO_Dashboard::saveDashletChanges($_REQUEST['columns']); CRM_Utils_System::civiExit(); case 'delete_dashlet': $dashletID = CRM_Utils_Type::escape($_REQUEST['dashlet_id'], 'Positive'); CRM_Core_BAO_Dashboard::deleteDashlet($dashletID); CRM_Utils_System::civiExit(); } CRM_Utils_JSON::output($dashlets); }
/** * Function used for CiviCRM dashboard operations */ static function dashboard() { $operation = CRM_Utils_Type::escape($_REQUEST['op'], 'String'); switch ($operation) { case 'get_widgets_by_column': // This would normally be coming from either the database (this user's settings) or a default/initial dashboard configuration. // get contact id of logged in user require_once 'CRM/Core/BAO/Dashboard.php'; $dashlets = CRM_Core_BAO_Dashboard::getContactDashlets(); break; case 'get_widget': $dashletID = CRM_Utils_Type::escape($_GET['id'], 'Positive'); require_once 'CRM/Core/BAO/Dashboard.php'; $dashlets = CRM_Core_BAO_Dashboard::getDashletInfo($dashletID); break; case 'save_columns': require_once 'CRM/Core/BAO/Dashboard.php'; CRM_Core_BAO_Dashboard::saveDashletChanges($_POST['columns']); exit; case 'delete_dashlet': $dashletID = CRM_Utils_Type::escape($_POST['dashlet_id'], 'Positive'); require_once 'CRM/Core/BAO/Dashboard.php'; CRM_Core_BAO_Dashboard::deleteDashlet($dashletID); exit; } echo json_encode($dashlets); exit; }