本文整理汇总了PHP中set_current_group函数的典型用法代码示例。如果您正苦于以下问题:PHP set_current_group函数的具体用法?PHP set_current_group怎么用?PHP set_current_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_current_group函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: 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;
}
}