function crm_core_match_testing_page in CRM Core 7
Page callback to display match debug info.
Parameters
object $contact: CRM Core Contact.
Return value
string
1 string reference to 'crm_core_match_testing_page'
- crm_core_match_menu in modules/
crm_core_match/ crm_core_match.module - Implements hook_menu().
File
- modules/
crm_core_match/ crm_core_match.test.inc, line 21 - Contains functionality for testing purposes.
Code
function crm_core_match_testing_page($contact) {
$output = '';
$engines = crm_core_match_get_engines();
// Display engines table.
$rows = array();
foreach ($engines as $engine) {
if ($engine
->getStatus()) {
$rows[] = array(
'data' => array(
$engine
->getID(),
$engine
->getName(),
$engine
->getDescription(),
$engine
->getMachineName(),
$engine
->getWeight(),
),
);
}
}
$header = array(
t('Engine ID'),
t('Engine name'),
t('Engine description'),
t('Engine machine name'),
t('Weight'),
);
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'empty' => t('No matching engines enabled or associated with contacts of this type.'),
));
foreach ($engines as $engine) {
$matches = array();
$engine
->execute($contact, $matches);
}
if (empty($matches)) {
$output .= '<h1>No matches currently available.</h1>';
}
else {
$output .= '<h1>Matches:</h1>';
// Display matched contacts table.
$rows = array();
$contacts = crm_core_contact_load_multiple($matches);
foreach ($contacts as $matched_contact) {
$uri = $matched_contact
->uri();
$link = l($matched_contact
->label(), $uri['path']);
$rows[] = array(
'data' => array(
$matched_contact->contact_id,
$link,
),
);
}
$header = array(
t('Contact ID'),
t('Contact Name'),
);
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
}
return $output;
}