本文整理汇总了PHP中CourseManager::is_user_subscribed_in_course方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::is_user_subscribed_in_course方法的具体用法?PHP CourseManager::is_user_subscribed_in_course怎么用?PHP CourseManager::is_user_subscribed_in_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::is_user_subscribed_in_course方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Auth
if ($isSpecialCourse) {
if (isset($_GET['autoreg'])) {
$autoRegistration = Security::remove_XSS($_GET['autoreg']);
if ($autoRegistration == 1) {
if (CourseManager::subscribe_user($user_id, $course_code, STUDENT)) {
Session::write('is_allowed_in_course', true);
}
}
}
}
if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
if (Security::check_token('get')) {
Security::clear_token();
$auth = new Auth();
$msg = $auth->subscribe_user($course_code);
if (CourseManager::is_user_subscribed_in_course($user_id, $course_code)) {
Session::write('is_allowed_in_course', true);
}
if (!empty($msg)) {
$show_message .= Display::return_message(get_lang($msg['message']), 'info', false);
}
}
}
/* Is the user allowed here? */
api_protect_course_script(true);
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$course_code])) {
Event::accessCourse();
$coursesAlreadyVisited[$course_code] = 1;
Session::write('coursesAlreadyVisited', $coursesAlreadyVisited);
}
示例2: date
$user_data['expiration_date']['Y'] = date('Y');
} else {
$user_data['radio_expiration_date'] = 1;
$user_data['expiration_date'] = array();
$user_data['expiration_date']['d'] = substr($expiration_date, 8, 2);
$user_data['expiration_date']['F'] = substr($expiration_date, 5, 2);
$user_data['expiration_date']['Y'] = substr($expiration_date, 0, 4);
$user_data['expiration_date']['H'] = substr($expiration_date, 11, 2);
$user_data['expiration_date']['i'] = substr($expiration_date, 14, 2);
}
$form->setDefaults($user_data);
$error_drh = false;
// Validate form
if ($form->validate()) {
$user = $form->getSubmitValues(1);
$is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
if ($user['status'] == DRH && $is_user_subscribed_in_course) {
$error_drh = true;
} else {
$userInfo = api_get_user_info($user_id);
$picture_element = $form->getElement('picture');
$picture = $picture_element->getValue();
$picture_uri = $user_data['picture_uri'];
if (isset($user['delete_picture']) && $user['delete_picture']) {
$picture_uri = UserManager::delete_user_picture($user_id);
} elseif (!empty($picture['name'])) {
$picture_uri = UserManager::update_user_picture($user_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);
}
$lastname = $user['lastname'];
$firstname = $user['firstname'];
$password = $user['password'];
示例3: foreach
// inactive students
$last_connection_date = Tracking::get_last_connection_date($student_id, true, true);
if ($last_connection_date !== false) {
if (time() - 3600 * 24 * 7 > $last_connection_date) {
$nb_inactive_students++;
}
} else {
$nb_inactive_students++;
}
$total_time_spent += Tracking::get_time_spent_on_the_platform($student_id);
$total_courses += Tracking::count_course_per_student($student_id);
$avg_student_progress = 0;
$avg_student_score = 0;
$nb_courses_student = 0;
foreach ($courses as $courseId) {
if (CourseManager::is_user_subscribed_in_course($student_id, $courseId, true)) {
$nb_courses_student++;
$nb_posts += Tracking::count_student_messages($student_id, $courseId);
$nb_assignments += Tracking::count_student_assignments($student_id, $courseId);
$avg_student_progress += Tracking::get_avg_student_progress($student_id, $courseId);
$myavg_temp = Tracking::get_avg_student_score($student_id, $courseId);
if (is_numeric($myavg_temp)) {
$avg_student_score += $myavg_temp;
}
if ($nb_posts !== null && $nb_assignments !== null && $avg_student_progress !== null && $avg_student_score !== null) {
//if one of these scores is null, it means that we had a problem connecting to the right database, so don't count it in
$nb_courses_student++;
}
}
}
// average progress of the student
示例4: redirectToCourse
/**
* Direct course link see #5299
*
* You can send to your students an URL like this
* http://chamilodev.beeznest.com/main/auth/inscription.php?c=ABC&e=3
* Where "c" is the course code and "e" is the exercise Id, after a successful
* registration the user will be sent to the course or exercise
*
*/
public static function redirectToCourse($form_data)
{
$course_code_redirect = Session::read('course_redirect');
$_user = api_get_user_info();
$user_id = api_get_user_id();
if (!empty($course_code_redirect)) {
$course_info = api_get_course_info($course_code_redirect);
if (!empty($course_info)) {
if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$form_data['action'] = $course_info['course_public_url'];
$form_data['message'] = sprintf(get_lang('YouHaveBeenRegisteredToCourseX'), $course_info['title']);
$form_data['button'] = Display::button('next', get_lang('GoToCourse', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
$exercise_redirect = intval(Session::read('exercise_redirect'));
// Specify the course id as the current context does not
// hold a global $_course array
$objExercise = new Exercise($course_info['real_id']);
$result = $objExercise->read($exercise_redirect);
if (!empty($exercise_redirect) && !empty($result)) {
$form_data['action'] = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $exercise_redirect . '&cidReq=' . $course_info['code'];
$form_data['message'] .= '<br />' . get_lang('YouCanAccessTheExercise');
$form_data['button'] = Display::button('next', get_lang('Go', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
}
if (!empty($form_data['action'])) {
header('Location: ' . $form_data['action']);
exit;
}
}
}
}
}
return $form_data;
}
示例5: header
CourseManager::save_user_legal($user_id, $course_code, $session_id);
if (api_check_user_access_to_legal($course_info['visibility'])) {
Session::write($variable, true);
}
if ($pluginLegal) {
header('Location:' . $url);
exit;
}
}
}
$user_pass_open_course = false;
if (api_check_user_access_to_legal($course_info['visibility']) && Session::read($variable)) {
$user_pass_open_course = true;
}
if (empty($session_id)) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_code) || api_check_user_access_to_legal($course_info['visibility'])) {
$user_accepted_legal = CourseManager::is_user_accepted_legal($user_id, $course_code);
if ($user_accepted_legal || $user_pass_open_course) {
//Redirect to course home
header('Location: ' . $url);
exit;
}
} else {
api_not_allowed();
}
} else {
if (api_is_platform_admin()) {
header('Location: ' . $url);
}
$userStatus = SessionManager::get_user_status_in_session($user_id, $course_code, $session_id);
if (isset($userStatus) || api_check_user_access_to_legal($course_info['visibility'])) {
示例6: get_logged_user_course_html
/**
* Helper functions definition
*/
public static function get_logged_user_course_html($my_course, $count)
{
global $nosession, $nbDigestEntries, $orderKey, $digest, $thisCourseSysCode;
if (!$nosession) {
global $now, $date_start, $date_end;
}
//initialise
$result = '';
// Table definitions
$main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$course_code = $my_course['code'];
$course_visual_code = $my_course['course_info']['official_code'];
$course_title = $my_course['course_info']['title'];
$course_info = Database :: get_course_info($course_code);
$course_id = $course_info['real_id'];
$course_access_settings = CourseManager :: get_access_settings($course_code);
$course_visibility = $course_access_settings['visibility'];
$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
//function logic - act on the data
$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($course_code);
if ($is_virtual_course) {
// If the current user is also subscribed in the real course to which this
// virtual course is linked, we don't need to display the virtual course entry in
// the course list - it is combined with the real course entry.
$target_course_code = CourseManager :: get_target_of_linked_course($course_code);
$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
if ($is_subscribed_in_target_course) {
return; //do not display this course entry
}
}
$s_htlm_status_icon = Display::return_icon('course.gif', get_lang('Course'));
//display course entry
$result .= '<div id="div_'.$count.'">';
//$result .= '<h3><img src="../img/nolines_plus.gif" id="btn_'.$count.'" onclick="toogle_course(this,\''.$course_id.'\' )">';
$result .= $s_htlm_status_icon;
//show a hyperlink to the course, unless the course is closed and user is not course admin
if ($course_visibility != COURSE_VISIBILITY_HIDDEN && ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)) {
//$result .= '<a href="javascript:void(0)" id="ln_'.$count.'" onclick=toogle_course(this,\''.$course_id.'\');> '.$course_title.'</a>';
$result .= $course_title;
} else {
$result .= $course_title." "." ".get_lang('CourseClosed')."";
}
$result .= '</h3>';
//$current_course_settings = CourseManager :: get_access_settings($my_course['k']);
// display the what's new icons
/*if ($nbDigestEntries > 0) {
reset($digest);
$result .= '<ul>';
while (list ($key2) = each($digest[$thisCourseSysCode])) {
$result .= '<li>';
if ($orderKey[1] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key2] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key2][\"name\"]</a>";
} else {
$result .= api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '</li>';
$result .= '<ul>';
reset($digest[$thisCourseSysCode][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2])) {
$result .= '<li>';
if ($orderKey[2] == 'keyTools') {
$result .= "<a href=\"$toolsList[$key3] [\"path\"] $thisCourseSysCode \">";
$result .= "$toolsList[$key3][\"name\"]</a>";
} else {
$result .= api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get());
}
$result .= '<ul compact="compact">';
reset($digest[$thisCourseSysCode][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$thisCourseSysCode][$key2][$key3])) {
$result .= '<li>';
$result .= htmlspecialchars(substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT));
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
$result .= '</li>';
}
$result .= '</ul>';
}*/
$result .= '</li>';
$result .= '</div>';
if (!$nosession) {
$session = '';
//.........这里部分代码省略.........
示例7: api_get_course_info
/*
* Direct course link see #5299
*
* You can send to your students an URL like this
* http://chamilodev.beeznest.com/main/auth/inscription.php?c=ABC&e=3
* Where "c" is the course code and "e" is the exercise Id, after a successful
* registration the user will be sent to the course or exercise
*
*/
$course_code_redirect = Session::read('course_redirect');
if (!empty($course_code_redirect)) {
$course_info = api_get_course_info($course_code_redirect);
if (!empty($course_info)) {
if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) {
$user_id = api_get_user_id();
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$form_data['action'] = $course_info['course_public_url'];
$form_data['message'] = sprintf(get_lang('YouHaveBeenRegisteredToCourseX'), $course_info['title']);
$form_data['button'] = Display::button('next', get_lang('GoToCourse', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
$exercise_redirect = intval(Session::read('exercise_redirect'));
// Specifiy course ID as the current context does not
// hold a global $_course array
$objExercise = new Exercise($course_info['real_id']);
$result = $objExercise->read($exercise_redirect);
if (!empty($exercise_redirect) && !empty($result)) {
$form_data['action'] = api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $exercise_redirect . '&cidReq=' . $course_info['code'];
$form_data['message'] .= '<br />' . get_lang('YouCanAccessTheExercise');
$form_data['button'] = Display::button('next', get_lang('Go', null, $_user['language']), array('class' => 'btn btn-primary btn-large'));
}
if (!empty($form_data['action'])) {
header('Location: ' . $form_data['action']);
示例8: foreach
$user_ids[] = $user['user_id'];
}
CourseManager::unsubscribe_user($user_ids, $course_code, $session_id);
}
}
foreach ($clean_users as $userId) {
$userInfo = api_get_user_info($userId);
CourseManager::subscribe_user($userId, $course_code, STUDENT, $session_id);
if (empty($session_id)) {
//just to make sure
if (CourseManager::is_user_subscribed_in_course($userId, $course_code)) {
$user_to_show[] = $userInfo['complete_name'];
}
} else {
//just to make sure
if (CourseManager::is_user_subscribed_in_course($userId, $course_code, true, $session_id)) {
$user_to_show[] = $userInfo['complete_name'];
}
}
}
} else {
$message = get_lang('CheckUsersWithId');
$type = 'warning';
foreach ($invalid_users as $invalid_user) {
$user_to_show[] = $invalid_user;
}
}
}
}
}
Display::display_header();
示例9: header
// IMPORTANT to avoid caching of documents
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
header('Cache-Control: public');
header('Pragma: no-cache');
$course_id = intval($_REQUEST['course_id']);
$user_id = api_get_user_id();
$course_info = api_get_course_info_by_id($course_id);
$doc_url = $_REQUEST['file'];
$session_id = api_get_session_id();
if (empty($course_id)) {
$course_id = api_get_course_int_id();
}
if (empty($course_id) || empty($doc_url)) {
api_not_allowed();
}
$is_user_is_subscribed = CourseManager::is_user_subscribed_in_course($user_id, $course_id, true, $session_id);
if (!api_is_allowed_to_edit() && !$is_user_is_subscribed) {
api_not_allowed();
}
//change the '&' that got rewritten to '///' by mod_rewrite back to '&'
$doc_url = str_replace('///', '&', $doc_url);
//still a space present? it must be a '+' (that got replaced by mod_rewrite)
$doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace('/..', '', $doc_url);
//echo $doc_url;
$full_file_name = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/upload/calendar/' . $doc_url;
//if the rewrite rule asks for a directory, we redirect to the document explorer
if (is_dir($full_file_name)) {
//remove last slash if present
//$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
//mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
示例10: isCourseMember
/**
* @return boolean indicating if user with user_id=$user_id is a course member
* @todo check if this function is still necessary. There might be a library function for this.
*/
function isCourseMember($user_id)
{
$_course = api_get_course_info();
$course_code = $_course['code'];
$is_course_member = CourseManager::is_user_subscribed_in_course($user_id, $course_code, true);
return $is_course_member;
}
示例11: switch
$is_courseTutor = false;
$is_courseCoach = false;
$is_sessionAdmin = false;
}
// Checking the course access
$is_allowed_in_course = false;
if (isset($_course) && isset($_course['visibility'])) {
switch ($_course['visibility']) {
case COURSE_VISIBILITY_OPEN_WORLD:
//3
$is_allowed_in_course = true;
break;
case COURSE_VISIBILITY_OPEN_PLATFORM:
//2
$courseCode = $_course['code'];
$isUserSubscribedInCourse = CourseManager::is_user_subscribed_in_course($user_id, $courseCode, $session_id);
if (isset($user_id) && $isUserSubscribedInCourse === true && !api_is_anonymous($user_id)) {
$is_allowed_in_course = true;
}
break;
case COURSE_VISIBILITY_REGISTERED:
//1
if ($is_platformAdmin || $is_courseMember) {
$is_allowed_in_course = true;
}
break;
case COURSE_VISIBILITY_CLOSED:
//0
if ($is_platformAdmin || $is_courseAdmin) {
$is_allowed_in_course = true;
}
示例12: isCourseMember
/**
* @return boolean indicating if user with user_id=$user_id is a course member
* @todo check if this function is still necessary. There might be a library function for this.
*/
function isCourseMember($user_id)
{
$courseId = api_get_course_int_id();
return CourseManager::is_user_subscribed_in_course($user_id, $courseId, true);
}
示例13: api_get_path
// including some libraries that are also used in the documents tool
require_once api_get_path(SYS_CODE_PATH) . 'document/document.inc.php';
// we use a function build_document_icon_tag
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
/* Virtual course support */
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$course_info = api_get_course_info($course_code);
$session_id = api_get_session_id();
$action = isset($_GET['action']) ? $_GET['action'] : null;
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$postAction = isset($_POST['action']) ? $_POST['action'] : null;
if (empty($session_id)) {
$is_course_member = CourseManager::is_user_subscribed_in_course($user_id, $course_info['real_id'], false);
} else {
$is_course_member = CourseManager::is_user_subscribed_in_course($user_id, $course_info['real_id'], true, $session_id);
}
/* Object Initialisation */
// we need this here because the javascript to re-upload the file needs an array
// off all the documents that have already been sent.
// @todo consider moving the javascripts in a function that displays the javascripts
// only when it is needed.
if ($action == 'add') {
$dropbox_person = new Dropbox_Person($_user['user_id'], $is_courseAdmin, $is_courseTutor);
}
/* Create javascript and htmlHeaders */
$javascript = "<script type=\"text/javascript\">\n\tfunction confirmsend ()\n\t{\n\t\tif (confirm(\"" . get_lang('MailingConfirmSend', '') . "\")){\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction confirmation (name)\n\t{\n\t\tif (confirm(\"" . get_lang('ConfirmDelete', '') . " : \"+ name )){\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tfunction checkForm (frm)\n\t{\n\t\tif (frm.elements['recipients[]'].selectedIndex < 0){\n\t\t\talert(\"" . get_lang('NoUserSelected', '') . "\");\n\t\t\treturn false;\n\t\t} else if (frm.file.value == '') {\n\t\t\talert(\"" . get_lang('NoFileSpecified', '') . "\");\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}\n\t";
if (dropbox_cnf('allowOverwrite')) {
//sentArray keeps list of all files still available in the sent files list
//of the user.
//This is used to show or hide the overwrite file-radio button of the upload form
示例14: get_users
function get_users($from, $limit, $column, $direction)
{
$active = isset($_GET['active']) ? $_GET['active'] : 1;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
$lastConnectionDate = null;
if (!empty($sleepingDays)) {
$lastConnectionDate = api_get_utc_datetime(strtotime($sleepingDays . ' days ago'));
}
$is_western_name_order = api_is_western_name_order();
$coach_id = api_get_user_id();
$drhLoaded = false;
if (api_is_drh()) {
$column = 'u.user_id';
if (api_drh_can_access_all_session_content()) {
$students = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id(), false, $from, $limit, $column, $direction, $keyword, $active, $lastConnectionDate, null, null, api_is_student_boss() ? null : STUDENT);
$drhLoaded = true;
}
}
if ($drhLoaded == false) {
$students = UserManager::getUsersFollowedByUser(api_get_user_id(), api_is_student_boss() ? null : STUDENT, false, false, false, $from, $limit, $column, $direction, $active, $lastConnectionDate, api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER, $keyword);
}
$all_datas = array();
foreach ($students as $student_data) {
$student_id = $student_data['user_id'];
if (isset($_GET['id_session'])) {
$courses = Tracking::get_course_list_in_session_from_student($student_id, $_GET['id_session']);
}
$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0;
$nb_courses_student = 0;
if (!empty($courses)) {
foreach ($courses as $course_code) {
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
if (CourseManager::is_user_subscribed_in_course($student_id, $course_code, true)) {
$avg_time_spent += Tracking::get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
$my_average = Tracking::get_avg_student_score($student_id, $course_code);
if (is_numeric($my_average)) {
$avg_student_score += $my_average;
}
$avg_student_progress += Tracking::get_avg_student_progress($student_id, $course_code);
$total_assignments += Tracking::count_student_assignments($student_id, $course_code);
$total_messages += Tracking::count_student_messages($student_id, $course_code);
$nb_courses_student++;
}
}
}
if ($nb_courses_student > 0) {
$avg_time_spent = $avg_time_spent / $nb_courses_student;
$avg_student_score = $avg_student_score / $nb_courses_student;
$avg_student_progress = $avg_student_progress / $nb_courses_student;
} else {
$avg_time_spent = null;
$avg_student_score = null;
$avg_student_progress = null;
}
$row = array();
if ($is_western_name_order) {
$row[] = $student_data['firstname'];
$row[] = $student_data['lastname'];
} else {
$row[] = $student_data['lastname'];
$row[] = $student_data['firstname'];
}
$string_date = Tracking::get_last_connection_date($student_id, true);
$first_date = Tracking::get_first_connection_date($student_id);
$row[] = $first_date;
$row[] = $string_date;
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$detailsLink = '<a href="myStudents.php?student=' . $student_id . '&id_coach=' . $coach_id . '&id_session=' . $_GET['id_session'] . '">
<img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
} else {
$detailsLink = '<a href="myStudents.php?student=' . $student_id . '">
<img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
}
$row[] = $detailsLink;
$all_datas[] = $row;
}
return $all_datas;
}
示例15: api_detect_user_roles
/**
* @param int $user_id
* @param int $courseId
* @param int $session_id
* @return array
*/
function api_detect_user_roles($user_id, $courseId, $session_id = 0)
{
$user_roles = array();
/*$user_info = api_get_user_info($user_id);
$user_roles[] = $user_info['status'];*/
$courseInfo = api_get_course_info_by_id($courseId);
$course_code = $courseInfo['code'];
$url_id = api_get_current_access_url_id();
if (api_is_platform_admin_by_id($user_id, $url_id)) {
$user_roles[] = PLATFORM_ADMIN;
}
/*if (api_is_drh()) {
$user_roles[] = DRH;
}*/
if (!empty($session_id)) {
if (SessionManager::user_is_general_coach($user_id, $session_id)) {
$user_roles[] = SESSION_GENERAL_COACH;
}
}
if (!empty($course_code)) {
if (empty($session_id)) {
if (CourseManager::is_course_teacher($user_id, $course_code)) {
$user_roles[] = COURSEMANAGER;
}
if (CourseManager::get_tutor_in_course_status($user_id, $course_code)) {
$user_roles[] = COURSE_TUTOR;
}
if (CourseManager::is_user_subscribed_in_course($user_id, $course_code)) {
$user_roles[] = COURSE_STUDENT;
}
} else {
$user_status_in_session = SessionManager::get_user_status_in_course_session($user_id, $courseId, $session_id);
if (!empty($user_status_in_session)) {
if ($user_status_in_session == 0) {
$user_roles[] = SESSION_STUDENT;
}
if ($user_status_in_session == 2) {
$user_roles[] = SESSION_COURSE_COACH;
}
}
/*if (api_is_course_session_coach($user_id, $course_code, $session_id)) {
$user_roles[] = SESSION_COURSE_COACH;
}*/
}
}
return $user_roles;
}