You are here

function advpoll_update in Advanced Poll 5

Same name and namespace in other branches
  1. 6.3 advpoll.module \advpoll_update()
  2. 6 advpoll.module \advpoll_update()
  3. 6.2 advpoll.module \advpoll_update()

Implementation of hook_update().

This is called upon node edition.

File

./advpoll.module, line 733
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function advpoll_update($node) {
  db_query("UPDATE {advpoll} SET active = %d, max_choices = %d, algorithm = '%s', use_list = %d, show_votes = %d, start_date = '%s', end_date = '%s', writeins = %d, show_writeins = %d, question = '%s' WHERE nid = %d", !$node->settings['close'], $node->settings['max_choices'], $node->settings['algorithm'], $node->settings['use_list'], $node->settings['show_votes'], $node->settings['start_date'] ? strtotime($node->settings['start_date']) : 0, $node->settings['end_date'] ? strtotime($node->settings['end_date']) : 0, $node->settings['writeins'], $node->settings['show_writeins'], $node->question, $node->nid);
  _advpoll_insert_choices($node->nid, $_POST['choice']);
  votingapi_recalculate_results('advpoll', $node->nid);
}