Exemplo n.º 1
0
        }
        if ($close_date) {
            $poll->close_date = $close_date;
        }
        $poll->open_poll = !$open_poll ? 0 : 1;
        if (!$poll->save()) {
            register_error(elgg_echo("poll:error"));
            if ($container_guid) {
                forward("poll/add/" . $container_guid);
            } else {
                forward("poll/add");
            }
            exit;
        }
        elgg_clear_sticky_form('poll');
        poll_add_choices($poll, $new_choices);
        poll_manage_front_page($poll, $front_page);
        if (is_array($tagarray)) {
            $poll->tags = $tagarray;
        }
        $poll_create_in_river = elgg_get_plugin_setting('create_in_river', 'poll');
        if ($poll_create_in_river != 'no') {
            add_to_river('river/object/poll/create', 'create', elgg_get_logged_in_user_guid(), $poll->guid);
        }
        // Success message
        system_message(elgg_echo("poll:added"));
    }
}
// Forward to the poll page
forward($poll->getURL());
exit;
Exemplo n.º 2
0
function poll_replace_choices($poll, $new_choices)
{
    poll_delete_choices($poll);
    poll_add_choices($poll, $new_choices);
}