[drupal] handle sensor form submission

This commit is contained in:
Bart Van Der Meerssche 2011-03-18 10:03:05 +00:00
parent 1b26bf0e8c
commit 9d9befbee0
1 changed files with 11 additions and 0 deletions

View File

@ -891,9 +891,20 @@ function _logger_sensors_form() {
'#value' => t('Update'), '#value' => t('Update'),
); );
$form['#submit'][] = '_logger_sensors_submit';
return $form; return $form;
} }
function _logger_sensors_submit($form, &$form_state) {
foreach ($form_state['values']['list'] as $sensor => $chart) {
if ($chart)
db_query("UPDATE {logger_meters} SET chart = %d WHERE meter = '%s'", 1, $sensor);
else
db_query("UPDATE {logger_meters} SET chart = %d WHERE meter = '%s'", 0, $sensor);
}
}
/** /**
* Implementation of hook_form_alter(). * Implementation of hook_form_alter().
*/ */