function pmperson_migrate_email_adjust_form in Drupal PM (Project Management) 7.3
Same name and namespace in other branches
- 8 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_email_adjust_form()
- 7.2 pmperson/includes/pmperson.migrate.inc \pmperson_migrate_email_adjust_form()
Form for resolving email conflicts.
See also
1 string reference to 'pmperson_migrate_email_adjust_form'
- pmperson_forms in pmperson/
pmperson.module - Implements hook_forms().
File
- pmperson/
includes/ pmperson.migrate.inc, line 613 - Migration functions for the PM Person module.
Code
function pmperson_migrate_email_adjust_form($form, $form_state, $type = NULL, $id = NULL, $mail = NULL) {
$form = array();
$col_data[$type] = array(
'id' => $id,
'mail' => $mail,
);
if ($id) {
$form['type'] = array(
'#type' => 'value',
'#value' => $type,
);
$form['id'] = array(
'#type' => 'value',
'#value' => $id,
);
$description = '';
switch ($type) {
case 'user':
$nid = db_query('SELECT nid FROM {pmperson} WHERE user_uid = :user_uid', array(
':user_uid' => $id,
))
->fetchField();
if ($nid) {
$description = 'uid: ' . $id . ' - linked to pmperson: ' . _pmperson_migrate_node_get_title($nid) . " (nid: {$nid})";
$col_data[$type]['linked_id'] = $nid;
}
else {
$description = 'uid: ' . $id . ' - ' . t('unlinked');
$col_data[$type]['linked_id'] = NULL;
}
break;
case 'pmperson':
$uid = db_query('SELECT user_uid FROM {pmperson} WHERE nid = :nid', array(
':nid' => $id,
))
->fetchField();
if ($uid and $account = user_load($uid)) {
$description = 'nid: ' . $id . ' - linked to user: ' . $account->name . " (uid: {$account->uid})";
$col_data[$type]['linked_id'] = $account->uid;
}
else {
$description = 'nid: ' . $id . ' - ' . t('unlinked');
$col_data[$type]['linked_id'] = NULL;
}
default:
// @todo Code...
break;
}
$form['mail'] = array(
'#type' => 'textfield',
'#default_value' => $mail,
'#description' => $description,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#submit' => array(
'pmperson_migrate_email_adjust_form_save_submit',
),
'#validate' => array(
'pmperson_migrate_email_adjust_form_save_validate',
),
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array(
'pmperson_migrate_email_adjust_form_delete_submit',
),
);
}
$form['col_data'] = array(
'#type' => 'value',
'#value' => $col_data,
);
return $form;
}