本文整理汇总了PHP中CRM_Utils_System::href方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_System::href方法的具体用法?PHP CRM_Utils_System::href怎么用?PHP CRM_Utils_System::href使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_System
的用法示例。
在下文中一共展示了CRM_Utils_System::href方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Basic page run function.
*/
public function run()
{
// Get link options for managing events.
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
$tabs = CRM_Event_Page_ManageEvent::tabs($enableCart);
foreach ($tabs as $tab => $tabInfo) {
$tabs[$tab]['name'] = $tabInfo['title'];
$tabs[$tab]['qs'] = $tab == 'reminder' ? 'reset=1&action=browse&setTab=1&id=%%id%%' : 'reset=1&action=update&id=%%id%%';
}
// Get link options for participant listings.
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$statusTypesPending = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 0');
$participantLinks = array();
if (1 || !empty($statusTypes)) {
$participantLinks[2] = array('name' => implode(', ', array_values($statusTypes)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=true&event=%%id%%', 'title' => ts('Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
if (!empty($statusTypesPending)) {
$participantLinks[3] = array('name' => implode(', ', array_values($statusTypesPending)), 'url' => 'civicrm/event/search', 'qs' => 'reset=1&force=1&status=false&event=%%id%%', 'title' => ts('Not Counted', array('domain' => 'com.aghstrategies.eventpermissions')));
}
$participantLinks[4] = array('name' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/participant', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Public Participant Listing', array('domain' => 'com.aghstrategies.eventpermissions')));
// Get link options for event links.
$eventLinks = array(array('name' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/participant/add', 'qs' => 'reset=1&action=add&context=standalone&eid=%%id%%', 'title' => ts('Register Participant', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/info', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Event Info', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&action=preview&id=%%id%%', 'title' => ts('Online Registration (Test-drive)', array('domain' => 'com.aghstrategies.eventpermissions'))), array('name' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions')), 'url' => 'civicrm/event/register', 'qs' => 'reset=1&id=%%id%%', 'title' => ts('Online Registration (Live)', array('domain' => 'com.aghstrategies.eventpermissions'))));
$utils = new CRM_Eventpermissions_Utils();
$events = array();
foreach ($utils->myUpcomingEvents() as $id => $event) {
$events[] = array('title' => CRM_Utils_System::href($event['title'], 'civicrm/event/info', "id={$id}&reset=1"), 'links' => CRM_Core_Action::formLink($tabs, NULL, array('id' => $id), ts('Configure', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.configure', 'Event', $id), 'participantLinks' => CRM_Core_Action::formLink($participantLinks, $event['participant_listing_id'] ? 6 : 3, array('id' => $id), ts('Participants', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.participants', 'Event', $id), 'eventLinks' => CRM_Core_Action::formLink($eventLinks, NULL, array('id' => $id), ts('Event Links', array('domain' => 'com.aghstrategies.eventpermissions')), TRUE, 'eventpermissions.myevents.links', 'Event', $id));
}
$this->assign('events', $events);
parent::run();
}
示例2: formatMessage
static function formatMessage($mailchimp_sync_log)
{
$message = $mailchimp_sync_log->message;
$message .= ts('<br /><br />Additional details can be found at the %1.', array(1 => CRM_Utils_System::href('CiviMailchimp Sync Log', 'civicrm/admin/mailchimp/log')));
$url = CRM_Utils_System::url('civicrm/admin/mailchimp/log/clear-message', array('id' => $mailchimp_sync_log->id));
$message .= ts('<br /><br /><a class="clear-link" href="%1">Do not show this message again.</a>', array(1 => $url));
return $message;
}
示例3: getDedupes
//.........这里部分代码省略.........
$whereClause = implode(' AND ', $where);
}
}
$whereClause .= $whereClause ? ' AND de.id IS NULL' : ' de.id IS NULL';
if ($selected) {
$whereClause .= ' AND pn.is_selected = 1';
}
$join .= CRM_Dedupe_Merger::getJoinOnDedupeTable();
$select = array('cc1.contact_type' => 'dst_contact_type', 'cc1.display_name' => 'dst_display_name', 'cc1.contact_sub_type' => 'dst_contact_sub_type', 'cc2.contact_type' => 'src_contact_type', 'cc2.display_name' => 'src_display_name', 'cc2.contact_sub_type' => 'src_contact_sub_type', 'ce1.email' => 'dst_email', 'ce2.email' => 'src_email', 'ca1.postal_code' => 'dst_postcode', 'ca2.postal_code' => 'src_postcode', 'ca1.street_address' => 'dst_street', 'ca2.street_address' => 'src_street');
if ($select) {
$join .= " INNER JOIN civicrm_contact cc1 ON cc1.id = pn.entity_id1";
$join .= " INNER JOIN civicrm_contact cc2 ON cc2.id = pn.entity_id2";
$join .= " LEFT JOIN civicrm_email ce1 ON (ce1.contact_id = pn.entity_id1 AND ce1.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_email ce2 ON (ce2.contact_id = pn.entity_id2 AND ce2.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_address ca1 ON (ca1.contact_id = pn.entity_id1 AND ca1.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_address ca2 ON (ca2.contact_id = pn.entity_id2 AND ca2.is_primary = 1 )";
}
$iTotal = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, $join, $whereClause, '=', $queryParams);
if (!empty($_REQUEST['order'])) {
foreach ($_REQUEST['order'] as $orderInfo) {
if (!empty($orderInfo['column'])) {
$orderColumnNumber = $orderInfo['column'];
$dir = $orderInfo['dir'];
}
}
$columnDetails = CRM_Utils_Array::value($orderColumnNumber, $_REQUEST['columns']);
}
if (!empty($columnDetails)) {
switch ($columnDetails['data']) {
case 'src':
$orderByClause = " ORDER BY cc2.display_name {$dir}";
break;
case 'src_email':
$orderByClause = " ORDER BY ce2.email {$dir}";
break;
case 'src_street':
$orderByClause = " ORDER BY ca2.street_address {$dir}";
break;
case 'src_postcode':
$orderByClause = " ORDER BY ca2.postal_code {$dir}";
break;
case 'dst':
$orderByClause = " ORDER BY cc1.display_name {$dir}";
break;
case 'dst_email':
$orderByClause = " ORDER BY ce1.email {$dir}";
break;
case 'dst_street':
$orderByClause = " ORDER BY ca1.street_address {$dir}";
break;
case 'dst_postcode':
$orderByClause = " ORDER BY ca1.postal_code {$dir}";
break;
default:
$orderByClause = " ORDER BY cc1.display_name ASC";
break;
}
}
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $whereClause, $offset, $rowCount, $select, $orderByClause, TRUE, $queryParams);
$iFilteredTotal = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");
$count = 0;
foreach ($dupePairs as $key => $pairInfo) {
$pair = $pairInfo['data'];
$srcContactSubType = CRM_Utils_Array::value('src_contact_sub_type', $pairInfo);
$dstContactSubType = CRM_Utils_Array::value('dst_contact_sub_type', $pairInfo);
$srcTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($srcContactSubType ? $srcContactSubType : $pairInfo['src_contact_type'], FALSE, $pairInfo['entity_id2']);
$dstTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($dstContactSubType ? $dstContactSubType : $pairInfo['dst_contact_type'], FALSE, $pairInfo['entity_id1']);
$searchRows[$count]['is_selected'] = $pairInfo['is_selected'];
$searchRows[$count]['is_selected_input'] = "<input type='checkbox' class='crm-dedupe-select' name='pnid_{$pairInfo['prevnext_id']}' value='{$pairInfo['is_selected']}' onclick='toggleDedupeSelect(this)'>";
$searchRows[$count]['src_image'] = $srcTypeImage;
$searchRows[$count]['src'] = CRM_Utils_System::href($pair['srcName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id2']}");
$searchRows[$count]['src_email'] = CRM_Utils_Array::value('src_email', $pairInfo);
$searchRows[$count]['src_street'] = CRM_Utils_Array::value('src_street', $pairInfo);
$searchRows[$count]['src_postcode'] = CRM_Utils_Array::value('src_postcode', $pairInfo);
$searchRows[$count]['dst_image'] = $dstTypeImage;
$searchRows[$count]['dst'] = CRM_Utils_System::href($pair['dstName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id1']}");
$searchRows[$count]['dst_email'] = CRM_Utils_Array::value('dst_email', $pairInfo);
$searchRows[$count]['dst_street'] = CRM_Utils_Array::value('dst_street', $pairInfo);
$searchRows[$count]['dst_postcode'] = CRM_Utils_Array::value('dst_postcode', $pairInfo);
$searchRows[$count]['conflicts'] = str_replace("',", "',<br/>", CRM_Utils_Array::value('conflicts', $pair));
$searchRows[$count]['weight'] = CRM_Utils_Array::value('weight', $pair);
if (!empty($pairInfo['data']['canMerge'])) {
$mergeParams = "reset=1&cid={$pairInfo['entity_id1']}&oid={$pairInfo['entity_id2']}&action=update&rgid={$rgid}&limit=" . CRM_Utils_Request::retrieve('limit', 'Integer');
if ($gid) {
$mergeParams .= "&gid={$gid}";
}
$searchRows[$count]['actions'] = "<a class='crm-dedupe-flip' href='#' data-pnid={$pairInfo['prevnext_id']}>" . ts('flip') . "</a> | ";
$searchRows[$count]['actions'] .= CRM_Utils_System::href(ts('merge'), 'civicrm/contact/merge', $mergeParams);
$searchRows[$count]['actions'] .= " | <a id='notDuplicate' href='#' onClick=\"processDupes( {$pairInfo['entity_id1']}, {$pairInfo['entity_id2']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
} else {
$searchRows[$count]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
}
$count++;
}
$dupePairs = array('data' => $searchRows, 'recordsTotal' => $iTotal, 'recordsFiltered' => $iFilteredTotal);
if (!empty($_REQUEST['is_unit_test'])) {
return $dupePairs;
}
CRM_Utils_JSON::output($dupePairs);
}
示例4: getDedupes
public static function getDedupes()
{
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = 'sort_name';
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
$rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
$contactType = '';
if ($rgid) {
$contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
}
$cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
$searchRows = array();
$selectorElements = array('src', 'dst', 'weight', 'actions');
$join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND\n pn.entity_id2 = de.contact_id2 )";
$where = "de.id IS NULL";
$iFilteredTotal = $iTotal = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, $join, $where);
$mainContacts = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, $offset, $rowCount);
foreach ($mainContacts as $mainId => $main) {
$searchRows[$mainId]['src'] = CRM_Utils_System::href($main['srcName'], 'civicrm/contact/view', "reset=1&cid={$main['srcID']}");
$searchRows[$mainId]['dst'] = CRM_Utils_System::href($main['dstName'], 'civicrm/contact/view', "reset=1&cid={$main['dstID']}");
$searchRows[$mainId]['weight'] = CRM_Utils_Array::value('weight', $main);
if (!empty($main['canMerge'])) {
$mergeParams = "reset=1&cid={$main['srcID']}&oid={$main['dstID']}&action=update&rgid={$rgid}";
if ($gid) {
$mergeParams .= "&gid={$gid}";
}
$searchRows[$mainId]['actions'] = '<a class="action-item crm-hover-button" href="' . CRM_Utils_System::url('civicrm/contact/merge', $mergeParams) . '">' . ts('merge') . '</a>';
$searchRows[$mainId]['actions'] .= "<a class='action-item crm-hover-button crm-notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
} else {
$searchRows[$mainId]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
}
}
CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例5: getContactActivitySelector
/**
* Wrapper for ajax activity selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
* Associated array of contact activities
*/
public static function getContactActivitySelector(&$params)
{
// Format the params.
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
$context = CRM_Utils_Array::value('context', $params);
// Get contact activities.
$activities = CRM_Activity_BAO_Activity::getActivities($params);
// Add total.
$params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params);
// Format params and add links.
$contactActivities = array();
if (!empty($activities)) {
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
// Check logged in user for permission.
$page = new CRM_Core_Page();
CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
$permissions = array($page->_permission);
if (CRM_Core_Permission::check('delete activities')) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
foreach ($activities as $activityId => $values) {
$activity = array();
$activity['DT_RowId'] = $activityId;
// Add class to this row if overdue.
$activity['DT_RowClass'] = 'crm-entity';
if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1) {
$activity['DT_RowClass'] .= ' status-overdue';
} else {
$activity['DT_RowClass'] .= ' status-ontime';
}
$activity['DT_RowAttr'] = array();
$activity['DT_RowAttr']['data-entity'] = 'activity';
$activity['DT_RowAttr']['data-id'] = $activityId;
$activity['activity_type'] = $values['activity_type'];
$activity['subject'] = $values['subject'];
$activity['source_contact_name'] = '';
if ($params['contact_id'] == $values['source_contact_id']) {
$activity['source_contact_name'] = $values['source_contact_name'];
} elseif ($values['source_contact_id']) {
$activity['source_contact_name'] = CRM_Utils_System::href($values['source_contact_name'], 'civicrm/contact/view', "reset=1&cid={$values['source_contact_id']}");
} else {
$activity['source_contact_name'] = '<em>n/a</em>';
}
$activity['target_contact_name'] = '';
if (isset($values['mailingId']) && !empty($values['mailingId'])) {
$activity['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
} elseif (!empty($values['recipients'])) {
$activity['target_contact_name'] = $values['recipients'];
} elseif (isset($values['target_contact_counter']) && $values['target_contact_counter']) {
$activity['target_contact_name'] = '';
foreach ($values['target_contact_name'] as $tcID => $tcName) {
$activity['target_contact_name'] .= CRM_Utils_System::href($tcName, 'civicrm/contact/view', "reset=1&cid={$tcID}");
}
if ($extraCount = $values['target_contact_counter'] - 1) {
$activity['target_contact_name'] .= ";<br />" . "(" . ts('%1 more', array(1 => $extraCount)) . ")";
}
} elseif (!$values['target_contact_name']) {
$activity['target_contact_name'] = '<em>n/a</em>';
}
$activity['assignee_contact_name'] = '';
if (empty($values['assignee_contact_name'])) {
$activity['assignee_contact_name'] = '<em>n/a</em>';
} elseif (!empty($values['assignee_contact_name'])) {
$count = 0;
$activity['assignee_contact_name'] = '';
foreach ($values['assignee_contact_name'] as $acID => $acName) {
if ($acID && $count < 5) {
$activity['assignee_contact_name'] .= CRM_Utils_System::href($acName, 'civicrm/contact/view', "reset=1&cid={$acID}");
$count++;
if ($count) {
$activity['assignee_contact_name'] .= "; ";
}
if ($count == 4) {
$activity['assignee_contact_name'] .= "(" . ts('more') . ")";
break;
}
}
}
}
$activity['activity_date_time'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
$activity['status_id'] = $activityStatus[$values['status_id']];
// build links
$activity['links'] = '';
$accessMailingReport = FALSE;
if (!empty($values['mailingId'])) {
$accessMailingReport = TRUE;
}
//.........这里部分代码省略.........
示例6: getContactActivitySelector
/**
* This function is a wrapper for ajax activity selector
*
* @param array $params associated array for params record id.
*
* @return array $contactActivities associated array of contact activities
* @access public
*/
public static function getContactActivitySelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
$context = CRM_Utils_Array::value('context', $params);
// get contact activities
$activities = CRM_Activity_BAO_Activity::getActivities($params);
// add total
$params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params);
// format params and add links
$contactActivities = array();
if (!empty($activities)) {
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
// check logged in user for permission
$page = new CRM_Core_Page();
CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
$permissions = array($page->_permission);
if (CRM_Core_Permission::check('delete activities')) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
foreach ($activities as $activityId => $values) {
$contactActivities[$activityId]['activity_type'] = $values['activity_type'];
$contactActivities[$activityId]['subject'] = $values['subject'];
if ($params['contact_id'] == $values['source_contact_id']) {
$contactActivities[$activityId]['source_contact'] = $values['source_contact_name'];
} elseif ($values['source_contact_id']) {
$contactActivities[$activityId]['source_contact'] = CRM_Utils_System::href($values['source_contact_name'], 'civicrm/contact/view', "reset=1&cid={$values['source_contact_id']}");
} else {
$contactActivities[$activityId]['source_contact'] = '<em>n/a</em>';
}
if (isset($values['mailingId']) && !empty($values['mailingId'])) {
$contactActivities[$activityId]['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
} elseif (CRM_Utils_Array::value('recipients', $values)) {
$contactActivities[$activityId]['target_contact'] = $values['recipients'];
} elseif (!$values['target_contact_name']) {
$contactActivities[$activityId]['target_contact'] = '<em>n/a</em>';
} elseif (!empty($values['target_contact_name'])) {
$count = 0;
$contactActivities[$activityId]['target_contact'] = '';
foreach ($values['target_contact_name'] as $tcID => $tcName) {
if ($tcID && $count < 5) {
$contactActivities[$activityId]['target_contact'] .= CRM_Utils_System::href($tcName, 'civicrm/contact/view', "reset=1&cid={$tcID}");
$count++;
if ($count) {
$contactActivities[$activityId]['target_contact'] .= "; ";
}
if ($count == 4) {
$contactActivities[$activityId]['target_contact'] .= "(" . ts('more') . ")";
break;
}
}
}
}
if (empty($values['assignee_contact_name'])) {
$contactActivities[$activityId]['assignee_contact'] = '<em>n/a</em>';
} elseif (!empty($values['assignee_contact_name'])) {
$count = 0;
$contactActivities[$activityId]['assignee_contact'] = '';
foreach ($values['assignee_contact_name'] as $acID => $acName) {
if ($acID && $count < 5) {
$contactActivities[$activityId]['assignee_contact'] .= CRM_Utils_System::href($acName, 'civicrm/contact/view', "reset=1&cid={$acID}");
$count++;
if ($count) {
$contactActivities[$activityId]['assignee_contact'] .= "; ";
}
if ($count == 4) {
$contactActivities[$activityId]['assignee_contact'] .= "(" . ts('more') . ")";
break;
}
}
}
}
$contactActivities[$activityId]['activity_date'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
$contactActivities[$activityId]['status'] = $activityStatus[$values['status_id']];
// add class to this row if overdue
$contactActivities[$activityId]['class'] = '';
if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1) {
$contactActivities[$activityId]['class'] = 'status-overdue';
} else {
$contactActivities[$activityId]['class'] = 'status-ontime';
}
// build links
$contactActivities[$activityId]['links'] = '';
$accessMailingReport = FALSE;
if (CRM_Utils_Array::value('mailingId', $values)) {
$accessMailingReport = TRUE;
}
$actionLinks = CRM_Activity_Selector_Activity::actionLinks(CRM_Utils_Array::value('activity_type_id', $values), CRM_Utils_Array::value('source_record_id', $values), $accessMailingReport, CRM_Utils_Array::value('activity_id', $values));
//.........这里部分代码省略.........
示例7: getContactRelationshipSelector
/**
* Wrapper for contact relationship selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
* associated array of contact relationships
*/
public static function getContactRelationshipSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
if ($params['context'] == 'past') {
$relationshipStatus = CRM_Contact_BAO_Relationship::INACTIVE;
} elseif ($params['context'] == 'all') {
$relationshipStatus = CRM_Contact_BAO_Relationship::ALL;
} else {
$relationshipStatus = CRM_Contact_BAO_Relationship::CURRENT;
}
// check logged in user for permission
$page = new CRM_Core_Page();
CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
$permissions = array($page->_permission);
if ($page->_permission == CRM_Core_Permission::EDIT) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
$permissionedContacts = TRUE;
if ($params['context'] != 'user') {
$links = CRM_Contact_Page_View_Relationship::links();
} else {
$links = CRM_Contact_Page_View_UserDashBoard::links();
$mask = NULL;
}
// get contact relationships
$relationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], $relationshipStatus, $params['rp'], 0, 0, $links, $mask, $permissionedContacts, $params);
$contactRelationships = array();
$params['total'] = 0;
if (!empty($relationships)) {
// FIXME: we cannot directly determine total permissioned relationship, hence re-fire query
$permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], $relationshipStatus, 0, 0, 0, NULL, NULL, $permissionedContacts);
$params['total'] = count($permissionedRelationships);
// format params
foreach ($relationships as $relationshipId => $values) {
$relationship = array();
$relationship['DT_RowId'] = $values['id'];
$relationship['DT_RowClass'] = 'crm-entity';
if ($values['is_active'] == 0) {
$relationship['DT_RowClass'] .= ' disabled';
}
$relationship['DT_RowAttr'] = array();
$relationship['DT_RowAttr']['data-entity'] = 'relationship';
$relationship['DT_RowAttr']['data-id'] = $values['id'];
//Add image icon for related contacts: CRM-14919
$icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type'], FALSE, $values['cid']);
$relationship['sort_name'] = $icon . ' ' . CRM_Utils_System::href($values['name'], 'civicrm/contact/view', "reset=1&cid={$values['cid']}");
$relationship['relation'] = CRM_Utils_System::href($values['relation'], 'civicrm/contact/view/rel', "action=view&reset=1&cid={$values['cid']}&id={$values['id']}&rtype={$values['rtype']}");
if ($params['context'] == 'current') {
if ($params['contact_id'] == $values['contact_id_a'] and $values['is_permission_a_b'] == 1 or $params['contact_id'] == $values['contact_id_b'] and $values['is_permission_b_a'] == 1) {
$relationship['sort_name'] .= '<span id="permission-a-b" class="crm-marker permission-relationship"> *</span>';
}
if ($values['cid'] == $values['contact_id_a'] and $values['is_permission_a_b'] == 1 or $values['cid'] == $values['contact_id_b'] and $values['is_permission_b_a'] == 1) {
$relationship['relation'] .= '<span id="permission-b-a" class="crm-marker permission-relationship"> *</span>';
}
}
if (!empty($values['description'])) {
$relationship['relation'] .= "<p class='description'>{$values['description']}</p>";
}
$relationship['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
$relationship['end_date'] = CRM_Utils_Date::customFormat($values['end_date']);
$relationship['city'] = $values['city'];
$relationship['state'] = $values['state'];
$relationship['email'] = $values['email'];
$relationship['phone'] = $values['phone'];
$relationship['links'] = $values['action'];
array_push($contactRelationships, $relationship);
}
}
$relationshipsDT = array();
$relationshipsDT['data'] = $contactRelationships;
$relationshipsDT['recordsTotal'] = $params['total'];
$relationshipsDT['recordsFiltered'] = $params['total'];
return $relationshipsDT;
}
示例8: formRule
static function formRule($fields, $files, $self)
{
$errors = array();
$link = CRM_Utils_System::href(ts('Flip between the original and duplicate contacts.'), 'civicrm/contact/merge', 'reset=1&action=update&cid=' . $self->_oid . '&oid=' . $self->_cid . '&rgid=' . $self->_rgid . '&flip=1');
if (CRM_Contact_BAO_Contact::checkDomainContact($self->_oid)) {
$errors['_qf_default'] = ts("The Default Organization contact cannot be merged into another contact record. It is associated with the CiviCRM installation for this domain and contains information used for system functions. If you want to merge these records, you can: %1", array(1 => $link));
}
return $errors;
}
示例9: getContactMailingSelector
/**
* wrapper for ajax activity selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
* associated array of contact activities
*/
public static function getContactMailingSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
// get contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailings($params);
// add total
$params['total'] = CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
//CRM-12814
if (!empty($mailings)) {
$openCounts = CRM_Mailing_Event_BAO_Opened::getMailingContactCount(array_keys($mailings), $params['contact_id']);
$clickCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getMailingContactCount(array_keys($mailings), $params['contact_id']);
}
// format params and add links
$contactMailings = array();
foreach ($mailings as $mailingId => $values) {
$mailing = array();
$mailing['subject'] = $values['subject'];
$mailing['creator_name'] = CRM_Utils_System::href($values['creator_name'], 'civicrm/contact/view', "reset=1&cid={$values['creator_id']}");
$mailing['recipients'] = CRM_Utils_System::href(ts('(recipients)'), 'civicrm/mailing/report/event', "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&event=queue&context=mailing");
$mailing['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
//CRM-12814
$mailing['openstats'] = "Opens: " . CRM_Utils_Array::value($values['mailing_id'], $openCounts, 0) . "<br />Clicks: " . CRM_Utils_Array::value($values['mailing_id'], $clickCounts, 0);
$actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/mailing/view', 'qs' => "reset=1&id=%%mkey%%", 'title' => ts('View Mailing'), 'class' => 'crm-popup'), CRM_Core_Action::BROWSE => array('name' => ts('Mailing Report'), 'url' => 'civicrm/mailing/report', 'qs' => "mid=%%mid%%&reset=1&cid=%%cid%%&context=mailing", 'title' => ts('View Mailing Report')));
$mailingKey = $values['mailing_id'];
if ($hash = CRM_Mailing_BAO_Mailing::getMailingHash($mailingKey)) {
$mailingKey = $hash;
}
$mailing['links'] = CRM_Core_Action::formLink($actionLinks, NULL, array('mid' => $values['mailing_id'], 'cid' => $params['contact_id'], 'mkey' => $mailingKey), ts('more'), FALSE, 'mailing.contact.action', 'Mailing', $values['mailing_id']);
array_push($contactMailings, $mailing);
}
$contactMailingsDT = array();
$contactMailingsDT['data'] = $contactMailings;
$contactMailingsDT['recordsTotal'] = $params['total'];
$contactMailingsDT['recordsFiltered'] = $params['total'];
return $contactMailingsDT;
}
示例10: getDedupes
//.........这里部分代码省略.........
$where[] = " (ca2.is_primary = 1 AND ca2.street_address LIKE '%{$dst_street}%')";
}
if (!empty($searchData['value'])) {
$whereClause = ' ( ' . implode(' OR ', $where) . ' ) ';
} else {
if (!empty($where)) {
$whereClause = implode(' AND ', $where);
}
}
$whereClause .= $whereClause ? ' AND de.id IS NULL' : ' de.id IS NULL';
if ($selected) {
$whereClause .= ' AND pn.is_selected = 1';
}
$join .= " LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND pn.entity_id2 = de.contact_id2 )";
$select = array('cc1.contact_type' => 'src_contact_type', 'cc1.display_name' => 'src_display_name', 'cc1.contact_sub_type' => 'src_contact_sub_type', 'cc2.contact_type' => 'dst_contact_type', 'cc2.display_name' => 'dst_display_name', 'cc2.contact_sub_type' => 'dst_contact_sub_type', 'ce1.email' => 'src_email', 'ce2.email' => 'dst_email', 'ca1.postal_code' => 'src_postcode', 'ca2.postal_code' => 'dst_postcode', 'ca1.street_address' => 'src_street', 'ca2.street_address' => 'dst_street');
if ($select) {
$join .= " INNER JOIN civicrm_contact cc1 ON cc1.id = pn.entity_id1";
$join .= " INNER JOIN civicrm_contact cc2 ON cc2.id = pn.entity_id2";
$join .= " LEFT JOIN civicrm_email ce1 ON (ce1.contact_id = pn.entity_id1 AND ce1.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_email ce2 ON (ce2.contact_id = pn.entity_id2 AND ce2.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_address ca1 ON (ca1.contact_id = pn.entity_id1 AND ca1.is_primary = 1 )";
$join .= " LEFT JOIN civicrm_address ca2 ON (ca2.contact_id = pn.entity_id2 AND ca2.is_primary = 1 )";
}
$iTotal = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, $join, $whereClause);
foreach ($_REQUEST['order'] as $orderInfo) {
if (!empty($orderInfo['column'])) {
$orderColumnNumber = $orderInfo['column'];
$dir = $orderInfo['dir'];
}
}
$columnDetails = CRM_Utils_Array::value($orderColumnNumber, $_REQUEST['columns']);
if (!empty($columnDetails)) {
switch ($columnDetails['data']) {
case 'src':
$whereClause .= " ORDER BY cc1.display_name {$dir}";
break;
case 'src_email':
$whereClause .= " ORDER BY ce1.email {$dir}";
break;
case 'src_street':
$whereClause .= " ORDER BY ca1.street_address {$dir}";
break;
case 'src_postcode':
$whereClause .= " ORDER BY ca1.postal_code {$dir}";
break;
case 'dst':
$whereClause .= " ORDER BY cc2.display_name {$dir}";
break;
case 'dst_email':
$whereClause .= " ORDER BY ce2.email {$dir}";
break;
case 'dst_street':
$whereClause .= " ORDER BY ca2.street_address {$dir}";
break;
case 'dst_postcode':
$whereClause .= " ORDER BY ca2.postal_code {$dir}";
break;
default:
break;
}
}
$dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $whereClause, $offset, $rowCount, $select);
$iFilteredTotal = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");
$count = 0;
foreach ($dupePairs as $key => $pairInfo) {
$pair =& $pairInfo['data'];
$srcContactSubType = CRM_Utils_Array::value('src_contact_sub_type', $pairInfo);
$dstContactSubType = CRM_Utils_Array::value('dst_contact_sub_type', $pairInfo);
$srcTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($srcContactSubType ? $srcContactSubType : $pairInfo['src_contact_type'], FALSE, $pairInfo['entity_id1']);
$dstTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($dstContactSubType ? $dstContactSubType : $pairInfo['dst_contact_type'], FALSE, $pairInfo['entity_id2']);
$searchRows[$count]['is_selected'] = $pairInfo['is_selected'];
$searchRows[$count]['is_selected_input'] = "<input type='checkbox' class='crm-dedupe-select' name='pnid_{$pairInfo['prevnext_id']}' value='{$pairInfo['is_selected']}' onclick='toggleDedupeSelect(this)'>";
$searchRows[$count]['src_image'] = $srcTypeImage;
$searchRows[$count]['src'] = CRM_Utils_System::href($pair['srcName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id1']}");
$searchRows[$count]['src_email'] = CRM_Utils_Array::value('src_email', $pairInfo);
$searchRows[$count]['src_street'] = CRM_Utils_Array::value('src_street', $pairInfo);
$searchRows[$count]['src_postcode'] = CRM_Utils_Array::value('src_postcode', $pairInfo);
$searchRows[$count]['dst_image'] = $dstTypeImage;
$searchRows[$count]['dst'] = CRM_Utils_System::href($pair['dstName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id2']}");
$searchRows[$count]['dst_email'] = CRM_Utils_Array::value('dst_email', $pairInfo);
$searchRows[$count]['dst_street'] = CRM_Utils_Array::value('dst_street', $pairInfo);
$searchRows[$count]['dst_postcode'] = CRM_Utils_Array::value('dst_postcode', $pairInfo);
$searchRows[$count]['conflicts'] = str_replace("',", "',<br/>", CRM_Utils_Array::value('conflicts', $pair));
$searchRows[$count]['weight'] = CRM_Utils_Array::value('weight', $pair);
if (!empty($pairInfo['data']['canMerge'])) {
$mergeParams = "reset=1&cid={$pairInfo['entity_id1']}&oid={$pairInfo['entity_id2']}&action=update&rgid={$rgid}";
if ($gid) {
$mergeParams .= "&gid={$gid}";
}
$searchRows[$count]['actions'] = "<a class='crm-dedupe-flip' href='#' data-pnid={$pairInfo['prevnext_id']}>" . ts('flip') . "</a> | ";
$searchRows[$count]['actions'] .= CRM_Utils_System::href(ts('merge'), 'civicrm/contact/merge', $mergeParams);
$searchRows[$count]['actions'] .= " | <a id='notDuplicate' href='#' onClick=\"processDupes( {$pairInfo['entity_id1']}, {$pairInfo['entity_id2']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
} else {
$searchRows[$count]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
}
$count++;
}
$dupePairs = array('data' => $searchRows, 'recordsTotal' => $iTotal, 'recordsFiltered' => $iFilteredTotal);
CRM_Utils_JSON::output($dupePairs);
}
示例11: getContactMailingSelector
/**
* This function is a wrapper for ajax activity selector
*
* @param array $params associated array for params record id.
*
* @return array $contactActivities associated array of contact activities
* @access public
*/
public static function getContactMailingSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
// get contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailings($params);
// add total
$params['total'] = CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
//CRM-12814
if (!empty($mailings)) {
$openCounts = CRM_Mailing_Event_BAO_Opened::getMailingTotalCount(array_keys($mailings));
$clickCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getMailingTotalCount(array_keys($mailings));
}
// format params and add links
$contactMailings = array();
foreach ($mailings as $mailingId => $values) {
$contactMailings[$mailingId]['subject'] = $values['subject'];
$contactMailings[$mailingId]['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
$contactMailings[$mailingId]['recipients'] = CRM_Utils_System::href(ts('(recipients)'), 'civicrm/mailing/report/event', "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&event=queue&context=mailing");
$contactMailings[$mailingId]['mailing_creator'] = CRM_Utils_System::href($values['creator_name'], 'civicrm/contact/view', "reset=1&cid={$values['creator_id']}");
//CRM-12814
$contactMailings[$mailingId]['openstats'] = ts('Opens') . ': ' . $openCounts[$values['mailing_id']] . '<br />' . ts('Clicks') . ': ' . $clickCounts[$values['mailing_id']];
$actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/mailing/view', 'qs' => "reset=1&id={$values['mailing_id']}", 'title' => ts('View Mailing'), 'class' => 'crm-mailing-view'), CRM_Core_Action::BROWSE => array('name' => ts('Mailing Report'), 'url' => 'civicrm/mailing/report', 'qs' => "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&context=mailing", 'title' => ts('View Mailing Report')));
$contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink($actionLinks, NULL, array());
}
return $contactMailings;
}
示例12: getSoftContributionList
/**
* Function to retrieve the list of soft contributions for given contact.
*
* @param int $contact_id
* Contact id.
* @param string $filter
* @param int $isTest
* Additional filter criteria, later used in where clause.
* @param array $dTParams
*
* @return array
*/
public static function getSoftContributionList($contact_id, $filter = NULL, $isTest = 0, &$dTParams = NULL)
{
$config = CRM_Core_Config::singleton();
$links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view/contribution', 'qs' => 'reset=1&id=%%contributionid%%&cid=%%contactId%%&action=view&context=contribution&selectedChild=contribute', 'title' => ts('View related contribution')));
$orderBy = 'cc.receive_date DESC';
if (!empty($dTParams['sort'])) {
$orderBy = $dTParams['sort'];
}
$limit = '';
if (!empty($dTParams['rowCount']) && $dTParams['rowCount'] > 0) {
$limit = " LIMIT {$dTParams['offset']}, {$dTParams['rowCount']} ";
}
$softOgId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'soft_credit_type', 'id', 'name');
$statusOgId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'contribution_status', 'id', 'name');
$query = '
SELECT SQL_CALC_FOUND_ROWS ccs.id, ccs.amount as amount,
ccs.contribution_id,
ccs.pcp_id,
ccs.pcp_display_in_roll,
ccs.pcp_roll_nickname,
ccs.pcp_personal_note,
ccs.soft_credit_type_id,
sov.label as sct_label,
cc.receive_date,
cc.contact_id as contributor_id,
cc.contribution_status_id as contribution_status_id,
cov.label as contribution_status,
cp.title as pcp_title,
cc.currency,
contact.display_name as contributor_name,
cct.name as financial_type
FROM civicrm_contribution_soft ccs
LEFT JOIN civicrm_contribution cc
ON ccs.contribution_id = cc.id
LEFT JOIN civicrm_pcp cp
ON ccs.pcp_id = cp.id
LEFT JOIN civicrm_contact contact ON
ccs.contribution_id = cc.id AND cc.contact_id = contact.id
LEFT JOIN civicrm_financial_type cct ON cc.financial_type_id = cct.id
LEFT JOIN civicrm_option_value sov ON sov.option_group_id = %3 AND ccs.soft_credit_type_id = sov.value
LEFT JOIN civicrm_option_value cov ON cov.option_group_id = %4 AND cc.contribution_status_id = cov.value
';
$where = "\n WHERE cc.is_test = %2 AND ccs.contact_id = %1";
if ($filter) {
$where .= $filter;
}
$query .= "{$where} ORDER BY {$orderBy} {$limit}";
$params = array(1 => array($contact_id, 'Integer'), 2 => array($isTest, 'Integer'), 3 => array($softOgId, 'Integer'), 4 => array($statusOgId, 'Integer'));
$cs = CRM_Core_DAO::executeQuery($query, $params);
$dTParams['total'] = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()');
$result = array();
while ($cs->fetch()) {
$result[$cs->id]['amount'] = CRM_Utils_Money::format($cs->amount, $cs->currency);
$result[$cs->id]['currency'] = $cs->currency;
$result[$cs->id]['contributor_id'] = $cs->contributor_id;
$result[$cs->id]['contribution_id'] = $cs->contribution_id;
$result[$cs->id]['contributor_name'] = CRM_Utils_System::href($cs->contributor_name, 'civicrm/contact/view', "reset=1&cid={$cs->contributor_id}");
$result[$cs->id]['financial_type'] = $cs->financial_type;
$result[$cs->id]['receive_date'] = CRM_Utils_Date::customFormat($cs->receive_date, $config->dateformatDatetime);
$result[$cs->id]['pcp_id'] = $cs->pcp_id;
$result[$cs->id]['pcp_title'] = $cs->pcp_title ? $cs->pcp_title : 'n/a';
$result[$cs->id]['pcp_display_in_roll'] = $cs->pcp_display_in_roll;
$result[$cs->id]['pcp_roll_nickname'] = $cs->pcp_roll_nickname;
$result[$cs->id]['pcp_personal_note'] = $cs->pcp_personal_note;
$result[$cs->id]['contribution_status'] = $cs->contribution_status;
$result[$cs->id]['sct_label'] = $cs->sct_label;
$replace = array('contributionid' => $cs->contribution_id, 'contactId' => $cs->contributor_id);
$result[$cs->id]['links'] = CRM_Core_Action::formLink($links, NULL, $replace);
if ($isTest) {
$result[$cs->id]['contribution_status'] = $result[$cs->id]['contribution_status'] . '<br /> (test)';
}
}
return $result;
}