本文整理汇总了PHP中CRM_Utils_System::synchronizeUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::synchronizeUsers方法的具体用法?PHP CRM_Utils_System::synchronizeUsers怎么用?PHP CRM_Utils_System::synchronizeUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::synchronizeUsers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
CRM_Core_Config::singleton(1, 1);
CRM_Utils_System::loadBootStrap(array('name' => $GLOBALS['_CV']['ADMIN_USER'], 'pass' => $GLOBALS['_CV']['ADMIN_PASS']));
CRM_Utils_System::synchronizeUsers();
parent::setUpBeforeClass();
}
示例2: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
$result = CRM_Utils_System::synchronizeUsers();
$status = ts('Checked one user record.', array('count' => $result['contactCount'], 'plural' => 'Checked %count user records.'));
if ($result['contactMatching']) {
$status .= '<br />' . ts('Found one matching contact record.', array('count' => $result['contactMatching'], 'plural' => 'Found %count matching contact records.'));
}
$status .= '<br />' . ts('Created one new contact record.', array('count' => $result['contactCreated'], 'plural' => 'Created %count new contact records.'));
CRM_Core_Session::setStatus($status, ts('Synchronize Complete'), 'success');
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
}
示例3: civicrm_initialize
<?php
civicrm_initialize();
// -----------------------------
// Get a list of users to update
if (!getenv('INSTALL_DASHBOARD_USERS')) {
throw new RuntimeException('Missing environment variable: INSTALL_DASHBOARD_USERS');
}
$users = explode(';', getenv('INSTALL_DASHBOARD_USERS'));
CRM_Utils_System::synchronizeUsers();
// v4.7+
// ------------------------------
// Get list of available dashlets
$dashletTypeResult = civicrm_api3('Dashboard', 'get', array('domain_id' => CRM_Core_Config::domainID()));
$dashletTypes = CRM_Utils_Array::index(array('name'), $dashletTypeResult['values']);
// ---------------------------------------
// Build list of specific dashlets to add
$dashlets = array(array('dashboard_id' => $dashletTypes['report/25']['id'], 'column_no' => 0, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 1), array('dashboard_id' => $dashletTypes['report/13']['id'], 'column_no' => 0, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 3), array('dashboard_id' => $dashletTypes['report/6']['id'], 'column_no' => 0, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 4), array('dashboard_id' => $dashletTypes['activity']['id'], 'column_no' => 1, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 10), array('dashboard_id' => $dashletTypes['myCases']['id'], 'column_no' => 1, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 11), array('dashboard_id' => $dashletTypes['report/20']['id'], 'column_no' => 1, 'is_minimized' => 0, 'is_fullscreen' => 1, 'weight' => 12));
// -------------------
// Insert the dashlets
$tx = new CRM_Core_Transaction();
try {
foreach ($users as $user) {
foreach ($dashlets as $dashlet) {
$dashlet['contact_id'] = "@user:{$user}";
$dashlet['is_active'] = 1;
$dashlet['debug'] = 1;
civicrm_api3('dashboard_contact', 'create', $dashlet);
}
}
} catch (CiviCRM_API3_Exception $e) {