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


PHP mygroupid函数代码示例

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


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

示例1: get_current_group

/**
 * Gets the current group - either from the session variable or from the database.
 *
 * @global object
 * @param int $courseid The course being examined - relates to id field in
 * 'course' table.
 * @param bool $full If true, the return value is a full record object.
 * If false, just the id of the record.
 * @return int|bool
 */
function get_current_group($courseid, $full = false) {
    global $SESSION;

    if (isset($SESSION->currentgroup[$courseid])) {
        if ($full) {
            return groups_get_group($SESSION->currentgroup[$courseid]);
        } else {
            return $SESSION->currentgroup[$courseid];
        }
    }

    $mygroupid = mygroupid($courseid);
    if (is_array($mygroupid)) {
        $mygroupid = array_shift($mygroupid);
        set_current_group($courseid, $mygroupid);
        if ($full) {
            return groups_get_group($mygroupid);
        } else {
            return $mygroupid;
        }
    }

    if ($full) {
        return false;
    } else {
        return 0;
    }
}
开发者ID:nuckey,项目名称:moodle,代码行数:38,代码来源:deprecatedlib.php

示例2: course_setup

 course_setup($course->id);
 $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
 $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
 if (!forum_user_can_post($forum)) {
     if (has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) {
         // User is a guest here!
         $SESSION->wantsurl = $FULLME;
         $SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
         redirect($CFG->wwwroot . '/course/enrol.php?id=' . $course->id, get_string('youneedtoenrol'));
     } else {
         print_error('nopostforum', 'forum');
     }
 }
 if (groupmode($course, $cm)) {
     // Make sure user can post here
     $mygroupid = mygroupid($course->id);
     if (!((empty($mygroupid) and $discussion->groupid == -1) || ismember($discussion->groupid) || has_capability('moodle/site:accessallgroups', $modcontext, NULL, false))) {
         print_error('nopostdiscussion', 'forum');
     }
 }
 if (!$cm->visible and !has_capability('moodle/course:manageactivities', $coursecontext)) {
     error(get_string("activityiscurrentlyhidden"));
 }
 // Load up the $post variable.
 $post = new object();
 $post->course = $course->id;
 $post->forum = $forum->id;
 $post->discussion = $parent->discussion;
 $post->parent = $parent->id;
 $post->subject = $parent->subject;
 $post->userid = $USER->id;
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:post.php

示例3: array_unshift

 } else {
     array_unshift($learningtable->head, $strsection);
 }
 array_unshift($learningtable->align, "center");
 if ($learningforums) {
     $currentsection = "";
     foreach ($learningforums as $key => $forum) {
         $forum->visible = instance_is_visible("forum", $forum) || has_capability('moodle/course:view', $coursecontext);
         $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id);
         $context = get_context_instance(CONTEXT_MODULE, $cm->id);
         if (!groups_course_module_visible($cm)) {
             continue;
         }
         $currentgroup = groups_get_activity_group($cm);
         $groupmode = groups_get_activity_groupmode($cm);
         $cantaccessagroup = $groupmode and !has_capability('moodle/site:accessallgroups', $context) and !mygroupid($course->id);
         if ($groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
             $count = count_records("forum_discussions", "forum", "{$forum->id}", "groupid", $currentgroup);
         } else {
             $count = count_records("forum_discussions", "forum", "{$forum->id}");
         }
         if ($usetracking) {
             if ($forum->trackingtype == FORUM_TRACKING_ON || !isset($untracked[$forum->id])) {
                 $groupid = $groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $context) ? $currentgroup : false;
                 $unread = forum_tp_count_forum_unread_posts($USER->id, $forum->id, $groupid);
                 if ($unread > 0) {
                     $unreadlink = '<span class="unread"><a href="view.php?f=' . $forum->id . '">' . $unread . '</a>';
                     $unreadlink .= '<a title="' . $strmarkallread . '" href="markposts.php?f=' . $forum->id . '&amp;mark=read"><img src="' . $CFG->pixpath . '/t/clear.gif" alt="' . $strmarkallread . '" /></a></span>';
                 } else {
                     $unreadlink = '<span class="read"><a href="view.php?f=' . $forum->id . '">' . $unread . '</a></span>';
                 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:index.php

示例4: get_current_group

/**
 * Gets the current group - either from the session variable or from the database.
 *
 * @deprecated Since year 2006 - please do not use this function any more.
 * @todo MDL-50273 This will be deleted in Moodle 3.2.
 *
 * @global object
 * @param int $courseid The course being examined - relates to id field in
 * 'course' table.
 * @param bool $full If true, the return value is a full record object.
 * If false, just the id of the record.
 * @return int|bool
 */
function get_current_group($courseid, $full = false)
{
    global $SESSION;
    debugging('get_current_group() is deprecated, please use groups_get_* instead', DEBUG_DEVELOPER);
    if (isset($SESSION->currentgroup[$courseid])) {
        if ($full) {
            return groups_get_group($SESSION->currentgroup[$courseid]);
        } else {
            return $SESSION->currentgroup[$courseid];
        }
    }
    $mygroupid = mygroupid($courseid);
    if (is_array($mygroupid)) {
        $mygroupid = array_shift($mygroupid);
        set_current_group($courseid, $mygroupid);
        if ($full) {
            return groups_get_group($mygroupid);
        } else {
            return $mygroupid;
        }
    }
    if ($full) {
        return false;
    } else {
        return 0;
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:40,代码来源:deprecatedlib.php

示例5: get_feedback_groupid

function get_feedback_groupid($course, $cm)
{
    $groupmode = groupmode($course, $cm);
    //get groupid
    if ($groupmode > 0 && !isadmin()) {
        return mygroupid($course->id);
    } else {
        return false;
    }
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:10,代码来源:lib.php

示例6: wiki_user_can_access_teacher_wiki

function wiki_user_can_access_teacher_wiki(&$wiki, $groupid, &$course)
{
    global $USER;
    /// Get the groupmode. It's been added to the wiki object.
    $groupmode = groups_get_activity_groupmode($wiki);
    /// A user can access a teacher wiki, if:
    ///     - group mode is NOGROUPS,
    ///     - group mode is VISIBLEGROUPS,
    ///     - group mode is SEPARATEGROUPS, and they are a member of the requested group,
    ///     - they are a teacher or administrator,
    if ($groupmode == NOGROUPS or $groupmode == VISIBLEGROUPS or $groupmode == SEPARATEGROUPS and @in_array($groupid, mygroupid($course->id)) or wiki_is_teacher($wiki, $USER->id)) {
        $can_access = true;
    } else {
        $can_access = false;
    }
    return $can_access;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:17,代码来源:lib.php


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