function recommender_command_form_submit in Recommender API 7.6
File
- ./
recommender.module, line 212
Code
function recommender_command_form_submit($form, &$form_state) {
$data = $form_state['values']['common']['data'];
$default_options = isset($data['options']) ? $data['options'] : array();
$input = array(
'algorithm' => $data['algorithm'],
'data structure' => recommender_prepare_data_structure($data['data structure']),
'options' => $default_options + (isset($form_state['values']['options']) ? $form_state['values']['options'] : array()),
);
if (variable_get('recommender_show_database_option', FALSE) && !empty($form_state['values']['common']['database'])) {
global $databases;
list($db_name, $db_target) = explode('-', $form_state['values']['common']['database']);
$input['database'] = $databases[$db_name][$db_target];
}
$command = isset($data['command']) ? $data['command'] : $data['algorithm'];
$result = computing_create($data['application'], $command, $form_state['values']['common']['label'], $input);
if ($result) {
drupal_set_message(t('Adding new recommender command successfully. Please run "drush recommender-run" or use Java agent program to execute the command.'));
}
else {
drupal_set_message(t('Cannot add new recommender command. Please inform site administrators.'), 'error');
}
$form_state['redirect'] = COMPUTING_MODULE_ADMIN_PATH;
}