function recommender_settings_form_submit in Recommender API 6.3
Same name and namespace in other branches
- 6.2 recommender.module \recommender_settings_form_submit()
- 7.3 recommender.admin.inc \recommender_settings_form_submit()
- 7.4 recommender.admin.inc \recommender_settings_form_submit()
- 7.5 recommender.admin.inc \recommender_settings_form_submit()
File
- ./
recommender.admin.inc, line 107
Code
function recommender_settings_form_submit($form, &$form_state) {
// save settings
if ($form_state['clicked_button']['#name'] == 'save') {
$result = db_query("SELECT name FROM {recommender_app} ORDER BY name");
while ($row = db_fetch_object($result)) {
$name = $row->name;
$cron = $form_state['values'][$name];
if ($cron == 'null') {
$cron = NULL;
}
db_query("UPDATE {recommender_app} SET cron=%d WHERE name='%s'", $cron, $name);
}
drupal_set_message(t("The settings have been saved."));
}
else {
if ($form_state['clicked_button']['#name'] == 'run') {
$apps = $form_state['values']['apps'];
variable_set('recommender_apps', $apps);
// trigger recommender_run()
foreach ($apps as $app_name) {
if (!empty($app_name)) {
recommender_create_command($app_name);
}
}
}
}
}