You are here

function advpoll_insert in Advanced Poll 6.2

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

Implementation of hook_insert().

This is called upon node creation.

File

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

Code

function advpoll_insert($node) {
  $mode = _advpoll_get_mode($node->type);
  db_query("INSERT INTO {advpoll} (nid, mode, use_list, active, max_choices, algorithm, show_votes, create_view_block, start_date, end_date, writeins, show_writeins, question) VALUES (%d, '%s', %d, %d, %d, '%s', %d, %d, '%s', '%s', %d, %d, '%s')", $node->nid, $mode, $node->settings['use_list'], !$node->settings['close'], $node->settings['max_choices'], $node->settings['algorithm'], $node->settings['show_votes'], $node->settings['create_view_block'], $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'], isset($node->question) ? $node->question : '');

  // Insert the choices.
  _advpoll_insert_choices($node);
  advpoll_update_views();
}