function rate_vote_ahah in Rate 6.2
Same name and namespace in other branches
- 7 rate.module \rate_vote_ahah()
AHAH callback for the vote buttons.
1 string reference to 'rate_vote_ahah'
- rate_menu in ./
rate.module - Implements hook_menu().
File
- ./
rate.module, line 660 - Rate module
Code
function rate_vote_ahah() {
$content_type = $_GET['content_type'];
$content_id = (int) $_GET['content_id'];
$widget_id = (int) $_GET['widget_id'];
$widget_mode = (int) $_GET['widget_mode'];
$widgets = variable_get(RATE_VAR_WIDGETS, array());
$widget = $widgets[$widget_id];
$links = array();
foreach ($widget->options as $option) {
// This name must be unique for all submit buttons across the page, AHAH will fail otherwise.
$id = "opt-{$widget_id}-{$content_type}-{$content_id}-{$option[0]}";
$token = _rate_get_token($id);
if (isset($_GET['token']) && $_GET['token'] == $token) {
rate_save_vote($widget, $content_type, $content_id, $option[0], TRUE);
}
}
print rate_generate_widget($widget_id, $content_type, $content_id, $widget_mode, TRUE, TRUE);
module_invoke_all('exit') & exit;
}