本文整理汇总了PHP中UserGroup::getGroupUsersByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::getGroupUsersByUser方法的具体用法?PHP UserGroup::getGroupUsersByUser怎么用?PHP UserGroup::getGroupUsersByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::getGroupUsersByUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirmation
ini_set('max_execution_time', 0);
//extra javascript functions for in html head:
$htmlHeadXtra[] = "<script>\nfunction confirmation() {\n\tif (confirm(\" " . trim(get_lang('AreYouSureToDelete')) . " ?\")) {\n\t return true;\n\t} else {\n\t return false;\n\t}\n}\n</script>";
api_block_anonymous_users();
if (!api_is_allowed_to_edit() && !api_is_student_boss()) {
api_not_allowed(true);
}
$cat_id = isset($_GET['cat_id']) ? (int) $_GET['cat_id'] : null;
$action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null;
$filterOfficialCode = isset($_POST['filter']) ? Security::remove_XSS($_POST['filter']) : null;
$filterOfficialCodeGet = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
switch ($action) {
case 'export_all_certificates':
if (api_is_student_boss()) {
$userGroup = new UserGroup();
$userList = $userGroup->getGroupUsersByUser(api_get_user_id());
} else {
$userList = array();
if (!empty($filterOfficialCodeGet)) {
$userList = UserManager::getUsersByOfficialCode($filterOfficialCodeGet);
}
}
Category::exportAllCertificates($cat_id, $userList);
break;
case 'generate_all_certificates':
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id());
if (!empty($user_list)) {
foreach ($user_list as $user_info) {
if ($user_info['status'] == INVITEE) {
continue;
}
示例2: array
if ($sessionId == -1) {
$userIdList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('admin', null);
$userIdList = array_column($userIdList, 'user_id');
$sessionList = SessionManager::get_sessions_list();
$sessionIdList = array_column($sessionList, 'id');
$courseCodeList = array();
foreach ($sessionList as $session) {
$courses = SessionManager::get_course_list_by_session_id($session['id']);
$courseCodeList = array_merge($courseCodeList, array_column($courses, 'code'));
}
}
$searchByGroups = true;
}
if ($searchByGroups) {
$userGroup = new UserGroup();
$userIdList = array_merge($userIdList, $userGroup->getGroupUsersByUser(api_get_user_id()));
}
if (is_array($userIdList)) {
$userIdList = array_unique($userIdList);
}
if (api_is_student_boss()) {
$userCourses = [];
foreach ($userIdList as $userId) {
$userCourses = array_merge($userCourses, CourseManager::get_courses_list_by_user_id($userId, true));
$userSessions = SessionManager::getSessionsFollowedByUser($userId);
$sessionIdList = array_merge($sessionIdList, array_column($userSessions, 'id'));
}
$courseCodeList = array_column($userCourses, 'code');
}
if (!empty($courseCodeList)) {
$courseCodeList = array_unique($courseCodeList);
示例3: getSessionsFollowedForGroupAdmin
/**
* Get list of sessions based on users of a group for a group admin
* @param int $userId The user id
* @return array
*/
public static function getSessionsFollowedForGroupAdmin($userId)
{
$sessionList = array();
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
$sessionUserTable = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$userGroup = new UserGroup();
$userIdList = $userGroup->getGroupUsersByUser($userId);
if (empty($userIdList)) {
return [];
}
$sql = "SELECT DISTINCT s.*\n FROM {$sessionTable} s\n INNER JOIN {$sessionUserTable} sru ON s.id = sru.id_session\n WHERE\n (sru.id_user IN (" . implode(', ', $userIdList) . ")\n AND sru.relation_type = 0\n )";
if (api_is_multiple_url_enabled()) {
$sessionAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) {
$sql = "SELECT DISTINCT s.* " . "FROM {$sessionTable} s " . "INNER JOIN {$sessionUserTable} sru ON s.id = sru.id_session " . "INNER JOIN {$sessionAccessUrlTable} srau ON s.id = srau.session_id " . "WHERE srau.access_url_id = {$accessUrlId} " . "AND ( " . "sru.id_user IN (" . implode(', ', $userIdList) . ") " . "AND sru.relation_type = 0" . ")";
}
}
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$sessionList[] = $row;
}
return $sessionList;
}
示例4: getCoursesFollowedByGroupAdmin
/**
* Get list of courses based on users of a group for a group admin
* @param int $userId The user id
* @return array
*/
public static function getCoursesFollowedByGroupAdmin($userId)
{
$coursesList = [];
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$courseUserTable = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$userGroup = new UserGroup();
$userIdList = $userGroup->getGroupUsersByUser($userId);
if (empty($userIdList)) {
return [];
}
$sql = "SELECT DISTINCT(c.id), c.title\n FROM {$courseTable} c\n INNER JOIN {$courseUserTable} cru ON c.id = cru.c_id\n WHERE (\n cru.user_id IN (" . implode(', ', $userIdList) . ")\n AND cru.relation_type = 0\n )";
if (api_is_multiple_url_enabled()) {
$courseAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) {
$sql = "SELECT DISTINCT(c.id), c.title\n FROM {$courseTable} c\n INNER JOIN {$courseUserTable} cru ON c.id = cru.c_id\n INNER JOIN {$courseAccessUrlTable} crau ON c.id = crau.c_id\n WHERE crau.access_url_id = {$accessUrlId}\n AND (\n cru.id_user IN (" . implode(', ', $userIdList) . ") AND\n cru.relation_type = 0\n )";
}
}
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$coursesList[] = $row;
}
return $coursesList;
}
示例5: array
use ChamiloSession as Session;
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_TRACKING;
api_block_anonymous_users();
$interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "mySpace/index.php", "name" => get_lang("MySpace"));
$selectedSession = isset($_POST['session']) && !empty($_POST['session']) ? intval($_POST['session']) : 0;
$selectedCourse = isset($_POST['course']) && !empty($_POST['course']) ? intval($_POST['course']) : 0;
$selectedMonth = isset($_POST['month']) && !empty($_POST['month']) ? intval($_POST['month']) : 0;
$selectedYear = isset($_POST['year']) && !empty($_POST['year']) ? trim($_POST['year']) : null;
$selectedStudent = isset($_POST['student']) && !empty($_POST['student']) ? intval($_POST['student']) : 0;
$userId = api_get_user_id();
$sessions = $courses = $months = $students = [0 => get_lang('Select')];
if (api_is_student_boss()) {
$userGroup = new UserGroup();
$userList = $userGroup->getGroupUsersByUser($userId);
$sessionsList = SessionManager::getSessionsFollowedForGroupAdmin($userId);
} else {
$sessionsList = SessionManager::getSessionsCoachedByUser($userId, false, api_is_platform_admin());
}
foreach ($sessionsList as $session) {
$sessions[$session['id']] = $session['name'];
}
if ($selectedSession > 0) {
if (!SessionManager::isValidId($selectedSession)) {
Session::write('reportErrorMessage', get_lang('NoSession'));
header("Location: {$selfUrl}");
exit;
}
$coursesList = SessionManager::get_course_list_by_session_id($selectedSession);
if (is_array($coursesList)) {