当前位置: 首页>>代码示例>>PHP>>正文


PHP Poll::updateChoices方法代码示例

本文整理汇总了PHP中Poll::updateChoices方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::updateChoices方法的具体用法?PHP Poll::updateChoices怎么用?PHP Poll::updateChoices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Poll的用法示例。


在下文中一共展示了Poll::updateChoices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: empty

$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));
开发者ID:iionly,项目名称:poll,代码行数:31,代码来源:edit.php


注:本文中的Poll::updateChoices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。