You are here

function advpoll_insert in Advanced Poll 6.3

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

Implementation of hook_insert().

This is called upon node creation.

File

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

Code

function advpoll_insert($node) {
  $mode = _advpoll_get_mode($node->type);
  if ($mode) {
    db_query("INSERT INTO {advpoll} \n        (nid, \n         mode, \n         use_list, \n         active, \n         max_choices, \n         algorithm, \n         show_votes, \n         create_view_block, \n         start_date, \n         end_date, \n         writeins, \n         show_writeins, \n         footer_message) \n         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->footer_message) ? filter_xss($node->footer_message) : '');

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