本文整理汇总了PHP中forum::get_activity_group方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_activity_group方法的具体用法?PHP forum::get_activity_group怎么用?PHP forum::get_activity_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_activity_group方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($forum)
{
$params = $forum->get_link_params_array();
if ($forum->get_group_mode()) {
$params['group'] = forum::get_activity_group($forum->get_course_module());
}
return parent::get_button($forum, get_string('markallread', 'forumng'), 'markread.php', true, $params);
}
示例2: required_param
* @package forumNG
*/
require_once '../../../../config.php';
require_once $CFG->dirroot . '/mod/forumng/forum.php';
$cmid = required_param('id', PARAM_INT);
$cloneid = optional_param('clone', 0, PARAM_INT);
try {
$forum = forum::get_from_cmid($cmid, $cloneid);
$course = $forum->get_course();
$cm = $forum->get_course_module();
$context = $forum->get_context();
if ($forum->is_shared() || $forum->is_clone()) {
throw new forum_exception("<strong>View post by user</strong> doesn't work for a shared forum.");
}
// Check forum access (using forum group, if required)
$forumgroupid = forum::get_activity_group($cm, false);
$forum->require_view($forumgroupid);
// TODO: Use/define a more accurate capability. This will do for now.
require_capability('mod/forumng:viewallposts', $forum->get_context());
// Print page header
$forum->print_subpage_header(get_string('userposts', 'forumng'));
// This section uses custom groups rather than the normal forum groups.
// We are using the groups that are set for the course and not the ones
// for the forum. This is because we want it so that even if the forum
// does not have groups, or it has weird groups, the control for who can
// see which posts is based on the 'real' tutor group which should be
// defined at course level.
$groups = null;
if ($course->groupmode) {
// Get groups. Because the logic for this is slightly weird (we're
// using course groups regardless of activity group setting; etc) it
示例3: required_param
$id = required_param('id', PARAM_INT);
// On the view page ONLY we allow a default for the clone parameter that won't
// cause an error if it's omitted. All other pages have default 0, which will
// show up any errors caused if the parameter is omitted somewhere.
$cloneid = optional_param('clone', forum::CLONE_DIRECT, PARAM_INT);
try {
// Construct forum variable (will check id is valid)
$forum = forum::get_from_cmid($id, $cloneid);
$course = $forum->get_course();
$cm = $forum->get_course_module();
// If this is a clone, redirect to original
if ($forum->is_clone()) {
$forum->redirect_to_original();
}
// Check that forum can be viewed [Handles all other permissions]
$groupid = forum::get_activity_group($cm, true);
$forum->require_view($groupid, 0, true);
// Get update button, if allowed for current user
$strforum = get_string("modulename", "forum");
$buttontext = $forum->display_search_form();
// Atom header meta tag
$feedtype = $forum->get_effective_feed_option();
if ($feedtype == forum::FEEDTYPE_DISCUSSIONS || $feedtype == forum::FEEDTYPE_ALL_POSTS && $forum->can_view_discussions()) {
$atomurl = $forum->get_feed_url(forum::FEEDFORMAT_ATOM, $groupid);
$meta = '<link rel="alternate" type="application/atom+xml" ' . 'title="Atom feed" href="' . htmlspecialchars($atomurl) . '" />';
} else {
$meta = '';
}
// Initialize $PAGE, compute blocks
require_once $CFG->dirroot . '/mod/forumng/pagelib.php';
global $CURRENTFORUM;
示例4: display_subscribe_options
/**
* Display subscribe options.
* @param forum $forum Forum
* @param string $text Textual note
* @param int $subscribed
* @param bool $button True if subscribe/unsubscribe button should be shown
* @param bool $viewlink True if 'view subscribers' link should be shown
* @return string HTML code for this area
*/
public function display_subscribe_options($forum, $text, $subscribed, $button, $viewlink)
{
$out = '<div class="forumng-subscribe-options">' . '<h3>' . get_string('subscription', 'forumng') . '</h3>' . '<p>' . $text . '</p>';
$cm = $forum->get_course_module();
if ($button) {
$outsubmit = '';
$currentgroupid = forum::get_activity_group($cm, true);
if ($currentgroupid == forum::NO_GROUPS) {
$currentgroupid = 0;
}
if ($subscribed == forum::FULLY_SUBSCRIBED || $subscribed == forum::FULLY_SUBSCRIBED_GROUPMODE) {
$outsubmit .= '<input type="submit" name="submitunsubscribe" value="' . get_string('unsubscribeshort', 'forumng') . '" />';
} else {
if ($subscribed == forum::PARTIALLY_SUBSCRIBED) {
//print both subscribe button and unsubscribe button
$outsubmit .= '<input type="submit" name="submitsubscribe" value="' . get_string('subscribelong', 'forumng') . '" />' . '<input type="submit" name="submitunsubscribe" value="' . get_string('unsubscribelong', 'forumng') . '" />';
} else {
if ($subscribed == forum::NOT_SUBSCRIBED) {
//default unsubscribed, print subscribe button
$outsubmit .= '<input type="submit" name="submitsubscribe" value="' . get_string('subscribeshort', 'forumng') . '" />';
} else {
if ($subscribed == forum::THIS_GROUP_PARTIALLY_SUBSCRIBED) {
$outsubmit .= '<input type="submit" name="submitsubscribe_thisgroup" value="' . get_string('subscribegroup', 'forumng') . '" />' . '<input type="submit" name="submitunsubscribe_thisgroup" value="' . get_string('unsubscribegroup_partial', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
} else {
if ($subscribed == forum::THIS_GROUP_SUBSCRIBED) {
$outsubmit .= '<input type="submit" name="submitunsubscribe_thisgroup" value="' . get_string('unsubscribegroup', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
} else {
if ($subscribed == forum::THIS_GROUP_NOT_SUBSCRIBED) {
$outsubmit .= '<input type="submit" name="submitsubscribe_thisgroup" value="' . get_string('subscribegroup', 'forumng') . '" />' . '<input type="hidden" name="g" value="' . $currentgroupid . '" />';
}
}
}
}
}
}
$out .= '<form action="subscribe.php" method="post"><div>' . $forum->get_link_params(forum::PARAM_FORM) . '<input type="hidden" name="back" value="view" />' . $outsubmit . '</div></form>';
}
if ($viewlink) {
$out .= ' <div class="forumng-subscribe-admin">' . '<a href="subscribers.php?' . $forum->get_link_params(forum::PARAM_HTML) . '">' . get_string('viewsubscribers', 'forumng') . '</a></div>';
}
$out .= '</div>';
return $out;
}
示例5:
$canunsubscribesomething = true;
$submitbutton = "<input type='submit' name='submitunsubscribe' value='{$strunsubscribe}' />";
} else {
$cansubscribesomething = true;
$submitbutton = "<input type='submit' name='submitsubscribe' value='{$strsubscribe}' />";
}
$subscribetext .= " " . "<form method='post' action='subscribe.php'><div>" . $forum->get_link_params(forum::PARAM_FORM) . "<input type='hidden' name='back' value='index' />" . $submitbutton . "</div></form>";
}
$subscribetext .= '</div>';
$row[] = $subscribetext;
}
// If this forum has RSS/Atom feeds, show link
if ($showrss) {
if ($type = $forum->get_effective_feed_option()) {
// Get group (may end up being none)
$groupid = forum::get_activity_group($forum->get_course_module(), false);
$row[] = $forum->display_feed_links($groupid);
} else {
$row[] = ' ';
}
}
$table->data[] = $row;
}
print_table($table);
// 'Subscribe all' links
if ($canmaybesubscribe) {
print '<div class="forumng-allsubscribe">';
$subscribedisabled = $cansubscribesomething ? '' : 'disabled="disabled"';
$unsubscribedisabled = $canunsubscribesomething ? '' : 'disabled="disabled"';
print "<form method='post' action='subscribe.php'><div>" . "<input type='hidden' name='course' value='{$course->id}' />" . "<input type='hidden' name='back' value='index' />" . "<input type='submit' name='submitsubscribe' value='" . get_string('allsubscribe', 'forumng') . "' {$subscribedisabled}/>" . "<input type='submit' name='submitunsubscribe' value='" . get_string('allunsubscribe', 'forumng') . "' {$unsubscribedisabled}/>" . "</div></form> ";
print '</div>';