function heartbeat_activity_ahah in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 heartbeat.admin.inc \heartbeat_activity_ahah()
- 7 heartbeat.pages.inc \heartbeat_activity_ahah()
ahah callback
1 string reference to 'heartbeat_activity_ahah'
- heartbeat_menu in ./
heartbeat.module - Implementation of hook_menu().
File
- ./
heartbeat.admin.inc, line 1501 - Admnistration tasks for heartbeat.
Code
function heartbeat_activity_ahah($element) {
$form_state = array(
'storage' => NULL,
'submitted' => FALSE,
);
$form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters'];
$form_id = array_shift($args);
$form['#post'] = $_POST;
$form['#redirect'] = FALSE;
$form['#programmed'] = FALSE;
$form_state['post'] = $_POST;
drupal_process_form($form_id, $form, $form_state);
$form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
$javascript = drupal_add_js(NULL, NULL, 'header');
$_SESSION['messages'] = array();
if (isset($form['hb_fields'][$element])) {
$ahah_form = $form['hb_fields'][$element];
}
elseif (isset($form['fs_settings'][$element])) {
$ahah_form = $form['fs_settings'][$element];
}
if ($ahah_form) {
//drupal_set_message(_heartbeat_activity_get_time($form_state['values'][$element]));
$ahah_form['#description'] = '<div class="status">' . t('Currently set ') . _heartbeat_activity_get_time($form_state['values'][$element]) . '</div>';
unset($ahah_form['#prefix'], $ahah_form['#suffix']);
// Prevent duplicate wrappers.
drupal_json(array(
'status' => TRUE,
'data' => theme('status_messages') . drupal_render($ahah_form),
'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
));
}
else {
drupal_json(array(
'status' => FALSE,
'data' => t('Element not found: @element', array(
'@element' => $element,
)),
'settings' => call_user_func_array('array_merge_recursive', $javascript['setting']),
));
}
exit;
}