Esempio n. 1
0
File: edit.php Progetto: iionly/poll
$poll->access_id = $access_id;
$poll->question = $question;
$poll->title = $question;
$poll->description = $description;
$poll->open_poll = $open_poll ? 1 : 0;
$poll->close_date = empty($close_date) ? null : $close_date;
$poll->max_votes = $max_votes;
$poll->tags = string_to_tag_array($tags);
if (!$poll->save()) {
    register_error(elgg_echo("poll:error"));
    forward(REFERER);
}
if ($new) {
    $poll->setChoices($new_choices);
} else {
    $choices_changed = $poll->updateChoices($new_choices, $former_access_id);
    // if poll choices have been modified and this poll has been created as multiple-anwer poll and
    // such polls are currently not allowed then reset the max number of allowed votes to 1
    if ($max_votes > 1 && $choices_changed) {
        $multiple_answer_polls = elgg_get_plugin_setting('multiple_answer_polls', 'poll');
        if ($multiple_answer_polls != "yes") {
            $poll->max_votes = 1;
        }
    }
}
poll_manage_front_page($poll, $front_page);
elgg_clear_sticky_form('poll');
$poll_create_in_river = elgg_get_plugin_setting('create_in_river', 'poll');
if ($poll_create_in_river != 'no') {
    if ($new) {
        elgg_create_river_item(array('view' => 'river/object/poll/create', 'action_type' => 'create', 'subject_guid' => $user->guid, 'object_guid' => $poll->guid));