function node_makemeeting_load in Make Meeting Scheduler 7
Same name and namespace in other branches
- 6 makemeeting.module \node_makemeeting_load()
Implementation of hook_node_load()
File
- ./
makemeeting.module, line 616 - Make Meeting module
Code
function node_makemeeting_load(&$nodes) {
foreach ($nodes as &$node) {
// load the poll days and options
$days_and_options = array();
$poll_head = db_query("SELECT * FROM {makemeeting_poll_heads} WHERE nid = :nid", array(
':nid' => $node->nid,
))
->fetchAssoc();
$answer_result = db_query("SELECT * FROM {makemeeting_poll_rows} WHERE nid = :nid ORDER BY answer_id", array(
':nid' => $node->nid,
));
foreach ($answer_result as $answer_row) {
$options_result = db_query("SELECT * FROM {makemeeting_poll_alters} WHERE answer_id = :answer_id ORDER BY alter_id", array(
':answer_id' => $answer_row->answer_id,
));
foreach ($options_result as $options_row) {
$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 = :poll_id ORDER BY dt", array(
':poll_id' => $node->nid,
));
foreach ($votes_result as $votes_row) {
$answers[$votes_row->user_name][$votes_row->answer_id] = $votes_row->answer_value;
}
$node->days_and_options = $days_and_options;
$node->answers = $answers;
$node->poll_type = $poll_head['poll_type'];
$node->poll_url = $poll_head['url'];
$node->poll_admin_url = $poll_head['admin_url'];
$node->anonym_name = $poll_head['anonym_name'];
$node->anonym_email = $poll_head['anonym_email'];
$node->email_notification = $poll_head['email_notification'];
$node->secure = $poll_head['secure'];
$node->multiple_allowed = $poll_head['multiple_allowed'];
$node->maybe_option = $poll_head['maybe_option'];
}
}