本文整理匯總了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;
}
}