本文整理汇总了PHP中CRM_Core_Error::debug_var方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error::debug_var方法的具体用法?PHP CRM_Core_Error::debug_var怎么用?PHP CRM_Core_Error::debug_var使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Error
的用法示例。
在下文中一共展示了CRM_Core_Error::debug_var方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hrvisa_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrvisa_civicrm_install()
{
if (!CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name')) {
// create activity_type 'Visa Expiration'
$params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0);
$result = civicrm_api3('activity_type', 'create', $params);
if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Error::debug_var("Failed to create activity type 'Visa Expiration'", $result);
throw new CRM_Core_Exception('Failed to create activity type \'Visa Expiration\'');
}
$activityTypeId = $result['values'][$result['id']]['value'];
} else {
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
}
// set weekly reminder for Visa Expiration activities (not active)
// will be active when extension is enabled
if (!empty($activityTypeId)) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
// schedule reminder for Visa Expiration Creation
$result = civicrm_api3('action_schedule', 'get', array('name' => 'Visa Expiration Reminder'));
if (empty($result['id'])) {
$params = array('name' => 'Visa Expiration Reminder', 'title' => 'Visa Expiration Reminder', 'recipient' => $targetID, 'limit_to' => 1, 'entity_value' => $activityTypeId, 'entity_status' => CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'), 'start_action_offset' => 1, 'start_action_unit' => 'week', 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 0, 'is_active' => 0, 'body_html' => '<p>Your latest visa expiries on {activity.activity_date_time}</p>', 'subject' => 'Reminder for Visa Expiration', 'record_activity' => 1, 'mapping_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value'));
$result = civicrm_api3('action_schedule', 'create', $params);
}
}
return _hrvisa_civix_civicrm_install();
}
示例2: main
function main($component = 'contribute')
{
require_once 'CRM/Utils/Request.php';
//we only get invoice num as a key player from payment gateway response.
//for ARB we get x_subscription_id and x_subscription_paynum
$x_subscription_id = self::retrieve('x_subscription_id', 'String');
if ($x_subscription_id) {
//Approved
CRM_Core_Error::debug_var('$_POST', $_POST);
$ids = $objects = array();
$input['component'] = $component;
// load post vars in $input
$this->getInput($input, $ids);
// load post ids in $ids
$this->getIDs($ids, $input);
CRM_Core_Error::debug_var('$ids', $ids);
CRM_Core_Error::debug_var('$input', $input);
if (!$this->validateData($input, $ids, $objects)) {
return false;
}
if ($component == 'contribute' && $ids['contributionRecur']) {
// check if first contribution is completed, else complete first contribution
$first = true;
if ($objects['contribution']->contribution_status_id == 1) {
$first = false;
}
return $this->recur($input, $ids, $objects, $first);
}
}
}
示例3: isConditionValid
public function isConditionValid(CRM_Civirules_EventData_EventData $eventData)
{
$contactId = $eventData->getContactId();
$entityData = $eventData->getEntityData('ContributionSoft');
$contacts = array();
$query = $this->conditionParams['smart_group_query'];
if (!empty($query)) {
$subQueries = explode(';', $query);
// To run only first and select statement in query string
if (!empty($subQueries) && !preg_match('/^(insert|update|delete|create|drop|replace)/i', $subQueries[0])) {
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Query', $subQueries[0]);
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Param Contribution', $entityData['contribution_id']);
$dao = CRM_Core_DAO::executeQuery('SELECT ' . $subQueries[0], array(1 => array($entityData['contribution_id'], 'Int')));
while ($dao->fetch()) {
$contacts[] = $dao->contact_id;
}
}
}
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Contacts', $contacts);
if (!empty($contacts)) {
$eventData->setConditionOutputData('ContributionSoft', $contacts);
return TRUE;
} else {
return FALSE;
}
}
示例4: run
function run()
{
if (CRM_Utils_System::authenticateKey()) {
$request_type = CRM_Utils_Request::retrieve('type', 'String');
$request_data = CRM_Utils_Request::retrieve('data', 'String');
$config = CRM_Core_Config::singleton();
if ($config->debug) {
$request_data_log = print_r($request_data, TRUE);
CRM_Core_Error::debug_log_message("Mailchimp Webhook Request [{$request_type}]: \n{$request_data_log}");
}
$function_name = 'self::mailchimpWebhook' . ucwords($request_type);
if (is_callable($function_name)) {
// Set a canary to prevent CiviMailchimp hooks from firing, which
// would trigger updates back to Mailchimp, resulting in an endless
// loop.
civimailchimp_static('mailchimp_do_not_run_hooks', TRUE);
try {
call_user_func($function_name, $request_data);
} catch (Exception $e) {
$error = array('code' => get_class($e), 'message' => $e->getMessage(), 'exception' => $e);
$message = "Mailchimp Webhook Request [{$request_type}]: {$error['code']}: {$error['message']}";
CRM_CiviMailchimp_BAO_SyncLog::saveMessage('error', 'mailchimp_to_civicrm', $message, $request_data);
CRM_Core_Error::debug_var('Fatal Error Details', $error);
CRM_Core_Error::backtrace('backTrace', TRUE);
throw $e;
}
}
}
parent::run();
}
示例5: run
function run()
{
CRM_Core_Error::debug_var('Page_Post', 'CONFIRM', false, true);
$this->setValues();
$group_id = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
$this->setGroupStatus($this->contact_id, $group_id);
$this->setActivityStatus($this->activity_id, 'Completed');
$country = $this->getCountry($this->campaign_id);
$url = "{$country}/post_confirm";
CRM_Utils_System::redirect($url);
}
示例6: smarty_function_crmScript
/**
* Add a Javascript file to a specific part of the page
*
* @param array $params
* Array with keys:
* - ext: string, extension name. see CRM_Core_Resources::addScriptFile
* - file: string, relative file path. see CRM_Core_Resources::addScriptFile
* - url: string. see CRM_Core_Resources::addScriptURL
* - weight: int; default: CRM_Core_Resources::DEFAULT_WEIGHT (0)
* - region: string; default: CRM_Core_Resources::DEFAULT_REGION ('html-header')
* @param CRM_Core_Smarty $smarty
*
* @throws Exception
*/
function smarty_function_crmScript($params, &$smarty)
{
$params += array('weight' => CRM_Core_Resources::DEFAULT_WEIGHT, 'region' => CRM_Core_Resources::DEFAULT_REGION, 'ext' => 'civicrm');
if (array_key_exists('file', $params)) {
Civi::resources()->addScriptFile($params['ext'], $params['file'], $params['weight'], $params['region']);
} elseif (array_key_exists('url', $params)) {
Civi::resources()->addScriptUrl($params['url'], $params['weight'], $params['region']);
} else {
CRM_Core_Error::debug_var('crmScript_params', $params);
throw new Exception("crmScript requires url or ext+file");
}
}
示例7: mailchimpsync_civicrm_navigationMenu
function mailchimpsync_civicrm_navigationMenu(&$params)
{
// get the id of Administer Menu
$administerMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'Administer', 'id', 'name');
CRM_Core_Error::debug_var('$administerMenuId', $administerMenuId);
// skip adding menu if there is no administer menu
if ($administerMenuId) {
// get the maximum key under adminster menu
$maxKey = max(array_keys($params[$administerMenuId]['child']));
$params[$administerMenuId]['child'][$maxKey + 1] = array('attributes' => array('label' => 'MailChimp Settings', 'name' => 'MailChimp Settings', 'url' => 'civicrm/mailchimp/apikeyregister', 'permission' => 'administer CiviCRM', 'operator' => NULL, 'separator' => TRUE, 'parentID' => $administerMenuId, 'navID' => $maxKey + 1, 'active' => 1));
CRM_Core_BAO_Navigation::add($params);
}
}
示例8: run
function run()
{
CRM_Core_Error::debug_var('Page_Post', 'OPTOUT', false, true);
$this->setValues();
$params_contact = array('sequential' => 1, 'id' => $this->contact_id, 'is_opt_out' => 1);
$result = civicrm_api3('Contact', 'create', $params_contact);
$group_id = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id');
$this->setGroupStatus($this->contact_id, $group_id);
$this->setActivityStatus($this->activity_id, 'optout');
$country = $this->getCountry($this->campaign_id);
// $url = "{$country}/post_optout"; // temporary fixed unless I resolve redirect to language versions to this page
$url = "/post_optout";
CRM_Utils_System::redirect($url);
}
示例9: stealItem
/**
* Get the next item, even if there's an active lease
*
* @param $lease_time seconds
*
* @return object with key 'data' that matches the inputted data
*/
function stealItem($lease_time = 3600)
{
$sql = "\n SELECT id, queue_name, submit_time, release_time, data\n FROM civicrm_queue_item\n WHERE queue_name = %1\n ORDER BY weight ASC, release_time ASC, id ASC\n LIMIT 1\n ";
$params = array(1 => array($this->getName(), 'String'));
$dao = CRM_Core_DAO::executeQuery($sql, $params, TRUE, 'CRM_Queue_DAO_QueueItem');
if ($dao->fetch()) {
$nowEpoch = CRM_Utils_Time::getTimeRaw();
CRM_Core_DAO::executeQuery("UPDATE civicrm_queue_item SET release_time = %1 WHERE id = %2", array('1' => array(date('YmdHis', $nowEpoch + $lease_time), 'String'), '2' => array($dao->id, 'Integer')));
$dao->data = unserialize($dao->data);
return $dao;
} else {
CRM_Core_Error::debug_var('no items found');
return FALSE;
}
}
示例10: postProcess
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$donationParams = array('domain_id' => CRM_Core_Config::domainID(), 'simple_donation_page' => $params['simpleDonation']);
$result = civicrm_api3('setting', 'create', $donationParams);
if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Error::debug_var('setting-create result for angular_donation', $result);
throw new CRM_Core_Exception('Failed to create settings for angular_donation');
}
$zipParams = array('domain_id' => CRM_Core_Config::domainID(), 'ziptastic_enable' => CRM_Utils_Array::value('ziptastic', $params) ? 1 : 0);
$result = civicrm_api3('setting', 'create', $zipParams);
if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
CRM_Core_Error::debug_var('setting-create result for angular_donation', $result);
throw new CRM_Core_Exception('Failed to create settings for angular_donation');
}
}
示例11: ukdirectdebitadditional_civicrm_handleSmartDebitMembershipRenewal
function ukdirectdebitadditional_civicrm_handleSmartDebitMembershipRenewal(&$params)
{
$ts1 = time();
$ts2 = strtotime($params['end_date']);
$year1 = date('Y', $ts1);
$year2 = date('Y', $ts2);
$month1 = date('m', $ts1);
$month2 = date('m', $ts2);
$diff = ($year2 - $year1) * 12 + ($month2 - $month1);
CRM_Core_Error::debug_var("diff", $diff);
CRM_Core_Error::debug_var("params", $params);
if ($diff > 18) {
unset($params['end_date']);
}
// Set the membership as current
$params['status_id'] = 2;
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.module.ukdirectdebitadditional,代码行数:17,代码来源:ukdirectdebitadditional.php
示例12: smarty_function_crmStyle
/**
* Add a stylesheet <LINK> to a specific part of the page
*
* @param $params array with keys:
* - ext: string, extension name. see CRM_Core_Resources::addStyleFile
* - file: string, relative file path. see CRM_Core_Resources::addStyleFile
* - url: string. see CRM_Core_Resources::addStyleURL
* - weight: int; default: CRM_Core_Resources::DEFAULT_WEIGHT (0)
* - region: string; default: CRM_Core_Resources::DEFAULT_REGION ('html-header')
*/
function smarty_function_crmStyle($params, &$smarty)
{
$res = CRM_Core_Resources::singleton();
if (empty($params['weight'])) {
$params['weight'] = CRM_Core_Resources::DEFAULT_WEIGHT;
}
if (empty($params['region'])) {
$params['region'] = CRM_Core_Resources::DEFAULT_REGION;
}
if (array_key_exists('file', $params)) {
$res->addStyleFile($params['ext'], $params['file'], $params['weight'], $params['region']);
} elseif (array_key_exists('url', $params)) {
$res->addStyleUrl($params['url'], $params['weight'], $params['region']);
} else {
CRM_Core_Error::debug_var('crmStyle_params', $params);
throw new Exception("crmStyle requires url or ext+file");
}
}
示例13: clear
static function clear()
{
$message_id = CRM_Utils_Request::retrieve('id', 'Integer');
$civicrm_queue_item_id = CRM_Utils_Request::retrieve('qid', 'Integer');
try {
CRM_CiviMailchimp_BAO_SyncLog::clearQueueItem($civicrm_queue_item_id);
CRM_CiviMailchimp_BAO_SyncLog::clearMessage($message_id);
} catch (Exception $e) {
$error = array('status' => 'error', 'code' => get_class($e), 'message' => $e->getMessage(), 'exception' => $e);
// CRM-11831 @see http://www.malsup.com/jquery/form/#file-upload
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
header('Content-Type: application/json');
}
echo json_encode($error);
CRM_Core_Error::debug_var('Fatal Error Details', $error);
CRM_Core_Error::backtrace('backTrace', TRUE);
CRM_Utils_System::civiExit();
}
}
示例14: civicrm_api3_civi_mailchimp_sync
function civicrm_api3_civi_mailchimp_sync($params)
{
CRM_CiviMailchimp_BAO_SyncLog::deleteOldMessages();
$records_to_process = $params['records_to_process_per_run'];
$queue = CRM_Queue_Service::singleton()->create(array('type' => 'Sql', 'name' => 'mailchimp-sync', 'reset' => FALSE));
if ($queue->numberOfItems() > 0) {
$runner = new CRM_Queue_Runner(array('title' => ts('Sync Contacts to Mailchimp'), 'queue' => $queue));
$continue_to_next_item = TRUE;
$records_processed = 0;
while ($continue_to_next_item && $records_processed < $records_to_process) {
$record = $runner->runNext();
if ($record['is_error']) {
// Get the current Queue Item being worked on to allow for better error
// reporting and logging.
$query = "\n SELECT\n id,\n data\n FROM\n civicrm_queue_item\n WHERE\n queue_name = 'mailchimp-sync'\n ORDER BY\n weight ASC,\n id ASC\n LIMIT 1\n ";
$item = CRM_Core_DAO::executeQuery($query);
while ($item->fetch()) {
$item_data = unserialize($item->data);
$message = "[{$item_data->arguments[0]}] There was an error syncing contacts to Mailchimp.";
$exception_name = '';
if (!empty($record['exception'])) {
$exception_name = get_class($record['exception']);
$message = "[{$item_data->arguments[0]}] {$exception_name}: {$record['exception']->getMessage()}.";
}
$message .= " Mailchimp List ID: {$item_data->arguments[1]}. {$records_processed} records were successfully synced before this error.";
$error = array('code' => $exception_name, 'message' => $message, 'exception' => $record['exception']);
CRM_Core_Error::debug_var('Fatal Error Details', $error);
CRM_Core_Error::backtrace('backTrace', TRUE);
CRM_CiviMailchimp_BAO_SyncLog::saveMessage('error', 'civicrm_to_mailchimp', $message, $item_data, $item->id);
return civicrm_api3_create_error($message);
}
}
$continue_to_next_item = $record['is_continue'];
$records_processed++;
}
$message = ts('%1 records were successfully synced to Mailchimp.', array(1 => $records_processed));
CRM_CiviMailchimp_BAO_SyncLog::saveMessage('success', 'civicrm_to_mailchimp', $message);
return civicrm_api3_create_success($records_processed);
}
}
示例15: xMemory
/**
* Gather and print (and possibly log) amount of used memory.
*
* @param string $title
* @param bool $log
* (optional) Whether to log the memory usage information.
*/
public static function xMemory($title = NULL, $log = FALSE)
{
$mem = (double) xdebug_memory_usage() / (double) 1024;
$mem = number_format($mem, 5) . ", " . time();
if ($log) {
echo "<p>{$title}: {$mem}<p>";
flush();
CRM_Core_Error::debug_var($title, $mem);
} else {
echo "<p>{$title}: {$mem}<p>";
flush();
}
}