You are here

function node_makemeeting_load in Make Meeting Scheduler 6

Same name and namespace in other branches
  1. 7 makemeeting.module \node_makemeeting_load()

Implements node_load().

File

./makemeeting.module, line 524
Make Meeting module

Code

function node_makemeeting_load($node) {

  // load the poll days and options
  $days_and_options = array();
  $poll_head = db_fetch_array(db_query("SELECT * FROM {makemeeting_poll_heads} WHERE nid = %d", $node->nid));
  $answer_result = db_query("SELECT * FROM {makemeeting_poll_rows} WHERE nid = %d ORDER BY answer_id", $node->nid);
  while ($answer_row = db_fetch_array($answer_result)) {
    $options_result = db_query("SELECT * FROM {makemeeting_poll_alters} WHERE answer_id = %d ORDER BY alter_id", $answer_row['answer_id']);
    while ($options_row = db_fetch_array($options_result)) {
      $days_and_options[$answer_row['answer_id'] . "_" . $answer_row['answer_text']][] = $options_row['alter_id'] . "_" . $options_row['alter_text'];
    }
  }

  // load answers
  $answers = array();
  $votes_result = db_query("SELECT * FROM {makemeeting_poll_votes} WHERE poll_id = %d ORDER BY dt", $node->nid);
  while ($votes_row = db_fetch_array($votes_result)) {
    $answers[$votes_row['user_name']][$votes_row['answer_id']] = $votes_row['answer_value'];
  }
  return array(
    "days_and_options" => $days_and_options,
    "answers" => $answers,
    "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'],
  );
}