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


PHP forum_go_back_to函数代码示例

本文整理汇总了PHP中forum_go_back_to函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_go_back_to函数的具体用法?PHP forum_go_back_to怎么用?PHP forum_go_back_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_string

                if ($fromform->mailnow) {
                    $message .= get_string("postmailnow", "forum");
                    $timemessage = 4;
                } else {
                    $message .= '<p>' . get_string("postaddedsuccess", "forum") . '</p>';
                    $message .= '<p>' . get_string("postaddedtimeleft", "forum", format_time($CFG->maxeditingtime)) . '</p>';
                }
                if ($subscribemessage = forum_post_subscription($discussion, $forum)) {
                    $timemessage = 4;
                }
                // Update completion status
                $completion = new completion_info($course);
                if ($completion->is_enabled($cm) && ($forum->completiondiscussions || $forum->completionposts)) {
                    $completion->update_state($cm, COMPLETION_COMPLETE);
                }
                redirect(forum_go_back_to("view.php?f={$fromform->forum}"), $message . $subscribemessage, $timemessage);
            } else {
                print_error("couldnotadd", "forum", $errordestination);
            }
            exit;
        }
    }
}
// To get here they need to edit a post, and the $post
// variable will be loaded with all the particulars,
// so bring up the form.
// $course, $forum are defined.  $discussion is for edit and reply only.
if ($post->discussion) {
    if (!($toppost = $DB->get_record("forum_posts", array("discussion" => $post->discussion, "parent" => 0)))) {
        print_error('cannotfindparentpost', 'forum', '', $post->id);
    }
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:post.php

示例2: forum_is_subscribed

        }
        if ($cansub && $cm->visible == 0 && !has_capability('mod/forum:managesubscriptions', $modcontext)) {
            $cansub = false;
        }
        if (!forum_is_forcesubscribed($forum)) {
            $subscribed = forum_is_subscribed($USER->id, $forum);
            if ((has_capability('moodle/course:manageactivities', $coursecontext, $USER->id) || $forum->forcesubscribe != FORUM_DISALLOWSUBSCRIBE) && $subscribe && !$subscribed && $cansub) {
                forum_subscribe($USER->id, $forumid, $modcontext);
            } else {
                if (!$subscribe && $subscribed) {
                    forum_unsubscribe($USER->id, $forumid, $modcontext);
                }
            }
        }
    }
    $returnto = forum_go_back_to("index.php?id={$course->id}");
    $shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
    if ($subscribe) {
        redirect($returnto, get_string('nowallsubscribed', 'forum', $shortname), 1);
    } else {
        redirect($returnto, get_string('nowallunsubscribed', 'forum', $shortname), 1);
    }
}
/// First, let's process the general forums and build up a display
if ($generalforums) {
    foreach ($generalforums as $forum) {
        $cm = $modinfo->instances['forum'][$forum->id];
        $context = context_module::instance($cm->id);
        $count = forum_count_discussions($forum, $cm, $course);
        if ($usetracking) {
            if ($forum->trackingtype == FORUM_TRACKING_OFF) {
开发者ID:gwsd2015,项目名称:LogiClass,代码行数:31,代码来源:index.php

示例3: required_param

$id = required_param('id', PARAM_INT);
// The forum to subscribe or unsubscribe to
$returnpage = optional_param('returnpage', 'index.php', PARAM_FILE);
// Page to return to.
require_sesskey();
if (!($forum = $DB->get_record("forum", array("id" => $id)))) {
    print_error('invalidforumid', 'forum');
}
if (!($course = $DB->get_record("course", array("id" => $forum->course)))) {
    print_error('invalidcoursemodule');
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
    print_error('invalidcoursemodule');
}
require_login($course, false, $cm);
$returnto = forum_go_back_to($returnpage . '?id=' . $course->id . '&f=' . $forum->id);
if (!forum_tp_can_track_forums($forum)) {
    redirect($returnto);
}
$info = new stdClass();
$info->name = fullname($USER);
$info->forum = format_string($forum->name);
$eventparams = array('context' => context_module::instance($cm->id), 'relateduserid' => $USER->id, 'other' => array('forumid' => $forum->id));
if (forum_tp_is_tracked($forum)) {
    if (forum_tp_stop_tracking($forum->id)) {
        $event = \mod_forum\event\readtracking_disabled::create($eventparams);
        $event->trigger();
        redirect($returnto, get_string("nownottracking", "forum", $info), 1);
    } else {
        print_error('cannottrack', '', $_SERVER["HTTP_REFERER"]);
    }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:settracking.php

示例4: optional_param

// The forum to subscribe or unsubscribe to
$returnpage = optional_param('returnpage', 'index.php', PARAM_FILE);
// Page to return to.
require_sesskey();
if (!($forum = $DB->get_record("forum", array("id" => $id)))) {
    print_error('invalidforumid', 'forum');
}
if (!($course = $DB->get_record("course", array("id" => $forum->course)))) {
    print_error('invalidcoursemodule');
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
    print_error('invalidcoursemodule');
}
require_login($course, false, $cm);
$returnpageurl = new moodle_url('/mod/forum/' . $returnpage, array('id' => $course->id, 'f' => $forum->id));
$returnto = forum_go_back_to($returnpageurl);
if (!forum_tp_can_track_forums($forum)) {
    redirect($returnto);
}
$info = new stdClass();
$info->name = fullname($USER);
$info->forum = format_string($forum->name);
$eventparams = array('context' => context_module::instance($cm->id), 'relateduserid' => $USER->id, 'other' => array('forumid' => $forum->id));
if (forum_tp_is_tracked($forum)) {
    if (forum_tp_stop_tracking($forum->id)) {
        $event = \mod_forum\event\readtracking_disabled::create($eventparams);
        $event->trigger();
        redirect($returnto, get_string("nownottracking", "forum", $info), 1);
    } else {
        print_error('cannottrack', '', get_local_referer(false));
    }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:settracking.php

示例5: print_error

                    $timemessage = 6;
                }
            } else {
                print_error("couldnotadd", "forum", $errordestination);
            }
        }

        // Update completion status.
        $completion = new completion_info($course);
        if ($completion->is_enabled($cm) &&
                ($forum->completiondiscussions || $forum->completionposts)) {
            $completion->update_state($cm, COMPLETION_COMPLETE);
        }

        // Redirect back to the discussion.
        redirect(forum_go_back_to($redirectto->out()), $message . $subscribemessage, $timemessage);
    }
}



// To get here they need to edit a post, and the $post
// variable will be loaded with all the particulars,
// so bring up the form.

// $course, $forum are defined.  $discussion is for edit and reply only.

if ($post->discussion) {
    if (! $toppost = $DB->get_record("forum_posts", array("discussion" => $post->discussion, "parent" => 0))) {
        print_error('cannotfindparentpost', 'forum', '', $post->id);
    }
开发者ID:nickbert77,项目名称:moodle,代码行数:31,代码来源:post.php

示例6: has_capability

        if ($cansub && $cm->visible == 0 && !has_capability('mod/forum:managesubscriptions', $modcontext)) {
            $cansub = false;
        }
        if (!\mod_forum\subscriptions::is_forcesubscribed($forum)) {
            $subscribed = \mod_forum\subscriptions::is_subscribed($USER->id, $forum, null, $cm);
            $canmanageactivities = has_capability('moodle/course:manageactivities', $coursecontext, $USER->id);
            if (($canmanageactivities || \mod_forum\subscriptions::is_subscribable($forum)) && $subscribe && !$subscribed && $cansub) {
                \mod_forum\subscriptions::subscribe_user($USER->id, $forum, $modcontext, true);
            } else {
                if (!$subscribe && $subscribed) {
                    \mod_forum\subscriptions::unsubscribe_user($USER->id, $forum, $modcontext, true);
                }
            }
        }
    }
    $returnto = forum_go_back_to(new moodle_url('/mod/forum/index.php', array('id' => $course->id)));
    $shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
    if ($subscribe) {
        redirect($returnto, get_string('nowallsubscribed', 'forum', $shortname), null, \core\output\notification::NOTIFY_SUCCESS);
    } else {
        redirect($returnto, get_string('nowallunsubscribed', 'forum', $shortname), null, \core\output\notification::NOTIFY_SUCCESS);
    }
}
/// First, let's process the general forums and build up a display
if ($generalforums) {
    foreach ($generalforums as $forum) {
        $cm = $modinfo->instances['forum'][$forum->id];
        $context = context_module::instance($cm->id);
        $count = forum_count_discussions($forum, $cm, $course);
        if ($usetracking) {
            if ($forum->trackingtype == FORUM_TRACKING_OFF) {
开发者ID:sirromas,项目名称:lms,代码行数:31,代码来源:index.php

示例7: error

// Page to return to.
if (!($forum = get_record("forum", "id", $f))) {
    error("Forum ID was incorrect");
}
if (!($course = get_record("course", "id", $forum->course))) {
    error("Forum doesn't belong to a course!");
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
    error("Incorrect cm!");
}
$user = $USER;
require_course_login($course, false, $cm);
if ($returnpage == 'index.php') {
    $returnto = forum_go_back_to($returnpage . '?id=' . $course->id);
} else {
    $returnto = forum_go_back_to($returnpage . '?f=' . $forum->id);
}
if (isguest()) {
    // Guests can't change forum
    $wwwroot = $CFG->wwwroot . '/login/index.php';
    if (!empty($CFG->loginhttps)) {
        $wwwroot = str_replace('http:', 'https:', $wwwroot);
    }
    $navigation = build_navigation('', $cm);
    print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
    notice_yesno(get_string('noguesttracking', 'forum') . '<br /><br />' . get_string('liketologin'), $wwwroot, $returnto);
    print_footer($course);
    exit;
}
$info = new object();
$info->name = fullname($user);
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:markposts.php

示例8: get_string

                        } else {
                            $message .= '<p>' . get_string("postaddedsuccess", "forum") . '</p>';
                            $message .= '<p>' . get_string("postaddedtimeleft", "forum", format_time($CFG->maxeditingtime)) . '</p>';
                        }
                        $subscribemessage = forum_post_subscription($fromform, $forum, $discussion);
                    } else {
                        print_error("couldnotadd", "forum", $errordestination);
                    }
                }
                // Update completion status.
                $completion = new completion_info($course);
                if ($completion->is_enabled($cm) && ($forum->completiondiscussions || $forum->completionposts)) {
                    $completion->update_state($cm, COMPLETION_COMPLETE);
                }
                // Redirect back to the discussion.
                redirect(forum_go_back_to($redirectto->out()), $message . $subscribemessage, null, \core\output\notification::NOTIFY_SUCCESS);
            }
        }
    }
}
// To get here they need to edit a post, and the $post
// variable will be loaded with all the particulars,
// so bring up the form.
// $course, $forum are defined.  $discussion is for edit and reply only.
if ($post->discussion) {
    if (!($toppost = $DB->get_record("forum_posts", array("discussion" => $post->discussion, "parent" => 0)))) {
        print_error('cannotfindparentpost', 'forum', '', $post->id);
    }
} else {
    $toppost = new stdClass();
    $toppost->subject = $forum->type == "news" ? get_string("addanewtopic", "forum") : get_string("addanewdiscussion", "forum");
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:post.php

示例9: print_error

$PAGE->set_url($url);
if (!($forum = $DB->get_record("forum", array("id" => $f)))) {
    print_error('invalidforumid', 'forum');
}
if (!($course = $DB->get_record("course", array("id" => $forum->course)))) {
    print_error('invalidcourseid');
}
if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
    print_error('invalidcoursemodule');
}
$user = $USER;
require_login($course, false, $cm);
if ($returnpage == 'index.php') {
    $returnto = forum_go_back_to(new moodle_url("/mod/forum/{$returnpage}", array('id' => $course->id)));
} else {
    $returnto = forum_go_back_to(new moodle_url("/mod/forum/{$returnpage}", array('f' => $forum->id)));
}
if (isguestuser()) {
    // Guests can't change forum
    $PAGE->set_title($course->shortname);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    echo $OUTPUT->confirm(get_string('noguesttracking', 'forum') . '<br /><br />' . get_string('liketologin'), get_login_url(), $returnto);
    echo $OUTPUT->footer();
    exit;
}
$info = new stdClass();
$info->name = fullname($user);
$info->forum = format_string($forum->name);
if ($mark == 'read') {
    if (!empty($d)) {
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:markposts.php


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