本文整理汇总了PHP中civicrm_api函数的典型用法代码示例。如果您正苦于以下问题:PHP civicrm_api函数的具体用法?PHP civicrm_api怎么用?PHP civicrm_api使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了civicrm_api函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
static function postProcess(&$form)
{
$values = $form->exportValues();
$teamId = $values['pcp_team_contact'];
$teampcpId = CRM_Pcpteams_Utils::getPcpIdByContactAndEvent($form->get('component_page_id'), $teamId);
$userId = CRM_Pcpteams_Utils::getloggedInUserId();
// Create Team Member of relation to this Team
$cfpcpab = CRM_Pcpteams_Utils::getPcpABCustomFieldId();
$cfpcpba = CRM_Pcpteams_Utils::getPcpBACustomFieldId();
$customParams = array("custom_{$cfpcpab}" => $form->get('page_id'), "custom_{$cfpcpba}" => $teampcpId);
CRM_Pcpteams_Utils::createTeamRelationship($userId, $teamId, $customParams);
$form->_teamName = CRM_Contact_BAO_Contact::displayName($teamId);
$form->set('teamName', $form->_teamName);
$form->set('teamContactID', $teamId);
$form->set('teamPcpId', $teampcpId);
$teamAdminId = CRM_Pcpteams_Utils::getTeamAdmin($teampcpId);
// Team Join: create activity
$actParams = array('target_contact_id' => $teamId, 'assignee_contact_id' => $teamAdminId);
CRM_Pcpteams_Utils::createPcpActivity($actParams, CRM_Pcpteams_Constant::C_AT_REQ_MADE);
CRM_Core_Session::setStatus(ts('A notification has been sent to the team. Once approved, team should be visible on your page.'), ts('Team Request Sent'));
//send email once the team request has done.
list($teamAdminName, $teamAdminEmail) = CRM_Contact_BAO_Contact::getContactDetails($teamAdminId);
$contactDetails = civicrm_api('Contact', 'get', array('version' => 3, 'sequential' => 1, 'id' => $userId));
$emailParams = array('tplParams' => array('teamAdminName' => $teamAdminName, 'userFirstName' => $contactDetails['values'][0]['first_name'], 'userlastName' => $contactDetails['values'][0]['last_name'], 'teamName' => $form->_teamName, 'pageURL' => CRM_Utils_System::url('civicrm/pcp/manage', "reset=1&id={$teampcpId}", TRUE, NULL, FALSE, TRUE)), 'email' => array($teamAdminName => array('first_name' => $teamAdminName, 'last_name' => $teamAdminName, 'email-Primary' => $teamAdminEmail, 'display_name' => $teamAdminName)), 'valueName' => CRM_Pcpteams_Constant::C_MSG_TPL_JOIN_REQUEST);
$sendEmail = CRM_Pcpteams_Utils::sendMail($userId, $emailParams);
}
示例2: survey_get_example
function survey_get_example()
{
$params = array('version' => 3, 'title' => 'survey title', 'activity_type_id' => '30', 'max_number_of_contacts' => 12, 'instructions' => 'Call people, ask for money');
require_once 'api/api.php';
$result = civicrm_api('survey', 'get', $params);
return $result;
}
示例3: survey_get_example
function survey_get_example()
{
$params = array('version' => 3, 'title' => 'survey title', 'api.survey.delete' => 1);
require_once 'api/api.php';
$result = civicrm_api('survey', 'get', $params);
return $result;
}
示例4: uf_group_get_example
function uf_group_get_example()
{
$params = array('add_captcha' => 1, 'add_contact_to_group' => 2, 'cancel_URL' => 'http://example.org/cancel', 'created_date' => '2009-06-27 00:00:00', 'created_id' => 69, 'group' => 2, 'group_type' => 'Individual,Contact', 'help_post' => 'help post', 'help_pre' => 'help pre', 'is_active' => 0, 'is_cms_user' => 1, 'is_edit_link' => 1, 'is_map' => 1, 'is_reserved' => 1, 'is_uf_link' => 1, 'is_update_dupe' => 1, 'name' => 'Test_Group', 'notify' => 'admin@example.org', 'post_URL' => 'http://example.org/post', 'title' => 'Test Group', 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('uf_group', 'get', $params);
return $result;
}
示例5: participant_get_example
function participant_get_example()
{
$params = array('id' => 14, 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('participant', 'get', $params);
return $result;
}
示例6: route
/**
* @param array $cxn
* @param string $entity
* @param string $action
* @param array $params
* @return mixed
*/
public static function route($cxn, $entity, $action, $params)
{
$SUPER_PERM = array('administer CiviCRM');
require_once 'api/v3/utils.php';
// FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && !CRM_Utils_System::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https') {
return civicrm_api3_create_error('System policy requires HTTPS.');
}
// Note: $cxn and cxnId are authenticated before router is called.
$dao = new CRM_Cxn_DAO_Cxn();
$dao->cxn_id = $cxn['cxnId'];
if (empty($cxn['cxnId']) || !$dao->find(TRUE) || !$dao->cxn_id) {
return civicrm_api3_create_error('Failed to lookup connection authorizations.');
}
if (!$dao->is_active) {
return civicrm_api3_create_error('Connection is inactive.');
}
if (!is_string($entity) || !is_string($action) || !is_array($params)) {
return civicrm_api3_create_error('API parameters are malformed.');
}
if (empty($cxn['perm']['api']) || !is_array($cxn['perm']['api']) || empty($cxn['perm']['grant']) || !(is_array($cxn['perm']['grant']) || is_string($cxn['perm']['grant']))) {
return civicrm_api3_create_error('Connection has no permissions.');
}
$whitelist = \Civi\API\WhitelistRule::createAll($cxn['perm']['api']);
\Civi::service('dispatcher')->addSubscriber(new \Civi\API\Subscriber\WhitelistSubscriber($whitelist));
CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
if ($cxn['perm']['grant'] === '*') {
CRM_Core_Config::singleton()->userPermissionTemp->grant($SUPER_PERM);
} else {
CRM_Core_Config::singleton()->userPermissionTemp->grant($cxn['perm']['grant']);
}
$params['check_permissions'] = 'whitelist';
return civicrm_api($entity, $action, $params);
}
示例7: group_contact_get_example
function group_contact_get_example()
{
$params = array('group_id' => 1, 'version' => 3, 'api.contact.get' => 1);
require_once 'api/api.php';
$result = civicrm_api('group_contact', 'get', $params);
return $result;
}
示例8: line_item_get_example
function line_item_get_example()
{
$params = array('version' => 3, 'entity_table' => 'civicrm_contribution');
require_once 'api/api.php';
$result = civicrm_api('line_item', 'get', $params);
return $result;
}
示例9: activity_type_delete_example
function activity_type_delete_example()
{
$params = array('activity_type_id' => 682, 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('activity_type', 'delete', $params);
return $result;
}
示例10: getContactList
/**
* Custom getContactList AJAX from CRM_Contact_Page_AJAX
*
*/
static function getContactList()
{
$params = array('version' => 3, 'check_permissions' => TRUE);
// String params
// FIXME: param keys don't match input keys, using this array to translate
$whitelist = array('s' => 'name', 'fieldName' => 'field_name', 'tableName' => 'table_name', 'context' => 'context', 'rel' => 'rel');
foreach ($whitelist as $key => $param) {
if (!empty($_GET[$key])) {
$params[$param] = $_GET[$key];
}
}
//CRM-10687: Allow quicksearch by multiple fields
if (!empty($params['field_name'])) {
if ($params['field_name'] == 'phone_numeric') {
$params['name'] = preg_replace('/[^\\d]/', '', $params['name']);
}
if (!$params['name']) {
CRM_Utils_System::civiExit();
}
}
// Numeric params
$whitelist = array('limit', 'org', 'employee_id', 'cid', 'id', 'cmsuser');
foreach ($whitelist as $key) {
if (!empty($_GET[$key]) && is_numeric($_GET[$key])) {
$params[$key] = $_GET[$key];
}
}
$result = civicrm_api('Contact', 'getquick', $params);
if (empty($result['is_error']) && !empty($result['values'])) {
foreach ($result['values'] as $key => $val) {
echo "{$val['id']}::{$val['data']}|{$val['id']}\n";
}
}
CRM_Utils_System::civiExit();
}
示例11: entity_tag_create_example
function entity_tag_create_example()
{
$params = array('contact_id' => 1, 'tag_id' => 1, 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('entity_tag', 'create', $params);
return $result;
}
示例12: banking_civicrm_install_options
function banking_civicrm_install_options($data)
{
foreach ($data as $groupName => $group) {
// check group existence
$result = civicrm_api('option_group', 'getsingle', array('version' => 3, 'name' => $groupName));
if (isset($result['is_error']) && $result['is_error']) {
$params = array('version' => 3, 'sequential' => 1, 'name' => $groupName, 'is_reserved' => 1, 'is_active' => 1, 'title' => $group['title'], 'description' => $group['description']);
$result = civicrm_api('option_group', 'create', $params);
$group_id = $result['values'][0]['id'];
} else {
$group_id = $result['id'];
}
if (is_array($group['values'])) {
$groupValues = $group['values'];
$weight = 1;
//print_r(array_keys($groupValues));
foreach ($groupValues as $valueName => $value) {
$result = civicrm_api('option_value', 'getsingle', array('version' => 3, 'name' => $valueName));
if (isset($result['is_error']) && $result['is_error']) {
$params = array('version' => 3, 'sequential' => 1, 'option_group_id' => $group_id, 'name' => $valueName, 'label' => $value['label'], 'value' => $value['value'], 'weight' => $weight, 'is_default' => $value['is_default'], 'is_active' => 1);
$result = civicrm_api('option_value', 'create', $params);
} else {
$weight = $result['weight'] + 1;
}
}
}
}
}
示例13: uf_match_get_example
function uf_match_get_example()
{
$params = array('contact_id' => 69, 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('uf_match', 'get', $params);
return $result;
}
示例14: activity_create_example
function activity_create_example()
{
$params = array('source_contact_id' => 17, 'activity_type_id' => 40, 'subject' => 'test activity type id', 'activity_date_time' => '2011-06-02 14:36:13', 'status_id' => 2, 'priority_id' => 1, 'duration' => 120, 'location' => 'Pensulvania', 'details' => 'a test activity', 'version' => 3, 'custom_2' => '17');
require_once 'api/api.php';
$result = civicrm_api('activity', 'create', $params);
return $result;
}
示例15: contribution_get_example
function contribution_get_example()
{
$params = array('contribution_id' => 1, 'version' => 3);
require_once 'api/api.php';
$result = civicrm_api('contribution', 'get', $params);
return $result;
}