You are here

function node_makemeeting_simplepoll_load in Make Meeting Scheduler 6

node_load()

Parameters

mixed $node:

File

./makemeeting_simplepoll.module, line 412
Make Meeting Simple Poll module

Code

function node_makemeeting_simplepoll_load($node) {

  // load the answers
  $answers = array();
  $result = db_query("SELECT * FROM {makemeeting_poll_rows} WHERE nid = %d", $node->nid);
  while ($row = db_fetch_array($result)) {
    $answers['field' . $row['answer_id']] = $row['answer_text'];
  }

  // load the votes
  $votes = array();
  $result = db_query("SELECT * FROM {makemeeting_poll_votes} WHERE poll_id = %d ORDER BY dt", $node->nid);
  while ($row = db_fetch_array($result)) {
    $votes[$row['user_name']][$row['answer_id']] = $row['answer_value'];
  }

  // load poll options
  $poll_head = db_fetch_array(db_query("SELECT * FROM {makemeeting_poll_heads} WHERE nid = %d", $node->nid));
  return array(
    "answers" => $answers,
    "votes" => $votes,
    "poll_type" => $poll_head['poll_type'],
    "poll_url" => $poll_head['url'],
    "poll_admin_url" => $poll_head['admin_url'],
    "anonym_name" => $poll_head['anonym_name'],
    "anonym_email" => $poll_head['anonym_email'],
    "email_notification" => $poll_head['email_notification'],
    "secure" => $poll_head['secure'],
    "multiple_allowed" => $poll_head['multiple_allowed'],
    "maybe_option" => $poll_head['maybe_option'],
  );
}