本文整理汇总了PHP中CourseManager::is_user_accepted_legal方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::is_user_accepted_legal方法的具体用法?PHP CourseManager::is_user_accepted_legal怎么用?PHP CourseManager::is_user_accepted_legal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::is_user_accepted_legal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
$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'])) {
$user_accepted_legal = CourseManager::is_user_accepted_legal($user_id, $course_code, $session_id);
if ($user_accepted_legal || $user_pass_open_course) {
// Redirect to course session home.
header('Location: ' . $url);
exit;
}
} else {
api_not_allowed();
}
}
Display::display_header();
echo $pluginMessage;
if ($hideForm == false) {
$form->display();
}
Display::display_footer();
示例2: isset
$is_courseCoach = false;
//course coach
$is_courseAdmin = false;
$is_courseTutor = false;
$is_courseMember = false;
if (isset($uidReset) && $uidReset || isset($cidReset) && $cidReset) {
if (isset($_cid) && $_cid) {
$my_user_id = isset($user_id) ? intval($user_id) : 0;
$variable = 'accept_legal_' . $my_user_id . '_' . $_course['real_id'] . '_' . $session_id;
$user_pass_open_course = false;
if (api_check_user_access_to_legal($_course['visibility']) && Session::read($variable)) {
$user_pass_open_course = true;
}
//Checking if the user filled the course legal agreement
if ($_course['activate_legal'] == 1 && !api_is_platform_admin() && !api_is_anonymous()) {
$user_is_subscribed = CourseManager::is_user_accepted_legal($user_id, $_course['id'], $session_id) || $user_pass_open_course;
if (!$user_is_subscribed) {
$url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id;
header('Location: ' . $url);
exit;
}
}
}
if (isset($user_id) && $user_id && isset($_real_cid) && $_real_cid) {
//Check if user is subscribed in a course
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT * FROM {$course_user_table}\n WHERE\n user_id = '" . $user_id . "' AND\n relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND\n c_id = '{$_real_cid}'";
$result = Database::query($sql);
$cuData = null;
if (Database::num_rows($result) > 0) {
// this user have a recorded state for this course
示例3: init_course
//.........这里部分代码省略.........
}
}
}
}
}
}
/* COURSE / USER REL. INIT */
$session_id = api_get_session_id();
$user_id = isset($_user['user_id']) ? $_user['user_id'] : null;
//Course permissions
$is_courseAdmin = false;
//course teacher
$is_courseTutor = false;
//course teacher - some rights
$is_courseMember = false;
//course student
//Course - User permissions
$is_sessionAdmin = false;
if ($reset) {
if (isset($user_id) && $user_id && isset($_cid) && $_cid) {
//Check if user is subscribed in a course
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT * FROM {$course_user_table}\n WHERE\n user_id = '" . $user_id . "' AND\n relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND\n course_code = '{$course_id}'";
$result = Database::query($sql);
$cuData = null;
if (Database::num_rows($result) > 0) {
// this user have a recorded state for this course
$cuData = Database::fetch_array($result, 'ASSOC');
$is_courseAdmin = (bool) $cuData['status'] == 1;
$is_courseTutor = (bool) $cuData['is_tutor'] == 1;
$is_courseMember = true;
// Checking if the user filled the course legal agreement
if ($_course['activate_legal'] == 1 && !api_is_platform_admin()) {
$user_is_subscribed = CourseManager::is_user_accepted_legal($user_id, $_course['id'], $session_id);
if (!$user_is_subscribed) {
$url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id;
header('Location: ' . $url);
exit;
}
}
}
//We are in a session course? Check session permissions
if (!empty($session_id)) {
//I'm not the teacher of the course
if ($is_courseAdmin == false) {
// this user has no status related to this course
// The user is subscribed in a session? The user is a Session coach a Session admin ?
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
//Session coach, session admin, course coach admin
$sql = "SELECT session.id_coach, session_admin_id, session_rcru.user_id\n FROM {$tbl_session} session, {$tbl_session_course_user} session_rcru\n WHERE\n session_rcru.session_id = session.id AND\n session_rcru.c_id = '{$_real_cid}' AND\n session_rcru.user_id = '{$user_id}' AND\n session_rcru.session_id = {$session_id} AND\n session_rcru.status = 2";
$result = Database::query($sql);
$row = Database::store_result($result);
//I'm a session admin?
if (isset($row) && isset($row[0]) && $row[0]['session_admin_id'] == $user_id) {
$is_courseMember = false;
$is_courseTutor = false;
$is_courseAdmin = false;
$is_courseCoach = false;
$is_sessionAdmin = true;
} else {
//Im a coach or a student?
$sql = "SELECT user_id, status\n FROM " . $tbl_session_course_user . "\n WHERE\n c_id = '{$_cid}' AND\n user_id = '" . $user_id . "' AND\n session_id = '" . $session_id . "'\n LIMIT 1";
$result = Database::query($sql);
if (Database::num_rows($result)) {
示例4: api_get_course_info
$is_courseAdmin = false;
$is_courseTutor = false;
$is_courseCoach = false;
$is_sessionAdmin = false;
if ($courseReset) {
if (isset($courseId) && $courseId && $courseId != -1) {
$courseInfo = api_get_course_info();
$userId = isset($userId) ? intval($userId) : 0;
$variable = 'accept_legal_' . $userId . '_' . $courseInfo['real_id'] . '_' . $sessionId;
$user_pass_open_course = false;
if (api_check_user_access_to_legal($courseInfo['visibility']) && Session::read($variable)) {
$user_pass_open_course = true;
}
//Checking if the user filled the course legal agreement
if ($courseInfo['activate_legal'] == 1 && !api_is_platform_admin()) {
$user_is_subscribed = CourseManager::is_user_accepted_legal($userId, $courseInfo, $sessionId) || $user_pass_open_course;
if (!$user_is_subscribed) {
$url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $courseInfo['code'] . '&session_id=' . $sessionId;
header('Location: ' . $url);
exit;
}
}
//Check if user is subscribed in a course
$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT * FROM {$course_user_table} WHERE user_id = '" . $userId . "' AND\n relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND c_id = " . api_get_course_int_id();
$result = Database::query($sql);
$cuData = null;
if (Database::num_rows($result) > 0) {
// this user have a recorded state for this course
$cuData = Database::fetch_array($result, 'ASSOC');
$is_courseAdmin = (bool) ($cuData['status'] == 1);