function sf_prematch_list in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_list()
- 7 sf_prematch/sf_prematch.admin.inc \sf_prematch_list()
@todo Please document this function.
See also
1 string reference to 'sf_prematch_list'
- sf_prematch_menu in sf_prematch/
sf_prematch.module - Implements hook_menu().
File
- sf_prematch/
sf_prematch.admin.inc, line 13 - Admin functions for sf_prematch module.
Code
function sf_prematch_list() {
// Define the header for the admin table.
$header = array(
t('Drupal object'),
t('Salesforce object'),
array(
'data' => t('Operations'),
'colspan' => 3,
),
);
//$maps = salesforce_api_salesforce_fieldmap_load_all();
// TODO Please convert this statement to the D7 database API syntax.
$result = db_query("SELECT fm.*, pm.rule " . "FROM {salesforce_fieldmap} fm LEFT JOIN {salesforce_prematch} pm " . "ON fm.name = pm.name");
$rows = array();
// Loop through all the indexed field maps.
foreach ($result as $map) {
if ($map->rule) {
$op_add_edit = l(t('edit prematch'), SALESFORCE_PATH_FIELDMAPS . '/' . $map->name . '/prematching');
$op_del = l(t('delete prematch'), SALESFORCE_PATH_FIELDMAPS . '/' . $map->name . '/prematching/delete');
}
else {
$op_add_edit = l(t('add prematch'), SALESFORCE_PATH_FIELDMAPS . '/' . $map->name . '/prematching');
$op_del = '';
}
// Add the row to the table with the basic operations.
$rows[] = array(
salesforce_api_fieldmap_object_label('drupal', $map->drupal_entity, $map->drupal_bundle),
salesforce_api_fieldmap_object_label('salesforce', 'salesforce', $map->salesforce),
$op_add_edit,
$op_del,
);
}
// Add a message if no objects have been mapped.
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('You have not yet assigned prematching to any fieldmaps.'),
'colspan' => 7,
),
);
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
));
return $output;
}