当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionManager::get_user_status_in_session方法代码示例

本文整理汇总了PHP中SessionManager::get_user_status_in_session方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::get_user_status_in_session方法的具体用法?PHP SessionManager::get_user_status_in_session怎么用?PHP SessionManager::get_user_status_in_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SessionManager的用法示例。


在下文中一共展示了SessionManager::get_user_status_in_session方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 $header = array(array(get_lang('Code'), true), array(get_lang('Title'), true), array(get_lang('Status'), true), array(get_lang('TimeSpentInTheCourse'), true), array(get_lang('TotalPostsInAllForums'), true), array('', false));
 $headerList = array();
 foreach ($header as $item) {
     $headerList[] = $item[0];
 }
 $csvContent[] = array();
 $csvContent[] = array(get_lang('Sessions'));
 foreach ($sessions as $session_item) {
     $data = array();
     $personal_course_list = array();
     $id_session = $session_item['session_id'];
     $csvContent[] = array($session_item['session_name']);
     $csvContent[] = $headerList;
     foreach ($session_item['courses'] as $my_course) {
         $courseInfo = api_get_course_info_by_id($my_course['real_id']);
         $sessionStatus = SessionManager::get_user_status_in_session($user['user_id'], $courseInfo['real_id'], $id_session);
         $status = null;
         switch ($sessionStatus) {
             case 0:
             case STUDENT:
                 $status = get_lang('Student');
                 break;
             case 2:
                 $status = get_lang('CourseCoach');
                 break;
         }
         $tools = '<a href="course_information.php?code=' . $courseInfo['code'] . '&id_session=' . $id_session . '">' . Display::return_icon('synthese_view.gif', get_lang('Overview')) . '</a>' . '<a href="' . $courseInfo['course_public_url'] . '?id_session=' . $id_session . '">' . Display::return_icon('course_home.gif', get_lang('CourseHomepage')) . '</a>';
         if ($my_course['status'] == STUDENT) {
             $tools .= '<a href="user_information.php?action=unsubscribeSessionCourse&course_code=' . $courseInfo['code'] . '&user_id=' . $user['user_id'] . '&id_session=' . $id_session . '">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
         }
         $timeSpent = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'], $courseInfo['real_id'], $id_session));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_information.php

示例2: header

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'])) {
        $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();
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:legal.php

示例3: unsubscribe_user_from_session

 /**
  * Unsubscribe user from session
  *
  * @param int session id
  * @param int user id
  * @param int reason of unsubscription see function get_session_change_user_reasons()
  * @return bool true in case of success, false in case of error
  */
 public static function unsubscribe_user_from_session($session_id, $user_id)
 {
     $session_id = intval($session_id);
     $user_id = intval($user_id);
     $reason_id = intval($reason_id);
     $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $user_status = SessionManager::get_user_status_in_session($session_id, $user_id);
     if ($user_status['moved_to'] != 0) {
         //You can't subscribe a user that was moved
         return false;
     }
     $delete_sql = "DELETE FROM {$tbl_session_rel_user} WHERE id_session = '{$session_id}' AND id_user ='{$user_id}' AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
     $result = Database::query($delete_sql);
     $return = Database::affected_rows($result);
     // Update number of users
     $update_sql = "UPDATE {$tbl_session} SET nbr_users = nbr_users - {$return} WHERE id='{$session_id}' ";
     Database::query($update_sql);
     // Get the list of courses related to this session
     $course_list = SessionManager::get_course_list_by_session_id($session_id);
     if (!empty($course_list)) {
         foreach ($course_list as $course) {
             $courseId = $course['id'];
             // Delete user from course
             $result = Database::query("DELETE FROM {$tbl_session_rel_course_rel_user} WHERE id_session='{$session_id}' AND c_id='{$courseId}' AND id_user='{$user_id}'");
             if (Database::affected_rows($result)) {
                 // Update number of users in this relation
                 Database::query("UPDATE {$tbl_session_rel_course} SET nbr_users=nbr_users - 1 WHERE id_session='{$session_id}' AND c_id ='{$courseId}'");
             }
         }
     }
     return true;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:43,代码来源:sessionmanager.lib.php

示例4: header

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_info['real_id'], $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();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:legal.php

示例5: check_if_user_is_subscribe_to_session

 static function check_if_user_is_subscribe_to_session($user_id, $session_id, $message = null, $before = array())
 {
     $user_session_status = SessionManager::get_user_status_in_session($session_id, $user_id);
     if (!empty($user_session_status)) {
         return array('entity' => 'session_rel_user', 'before' => $before, 'after' => $user_session_status, 'message' => "User {$user_id} added to Session {$session_id}  - user relation_type in session: {$user_session_status['relation_type']}- {$message} ", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
     } else {
         return array('message' => "User {$user_id} was NOT added to Session {$session_id}  - {$message}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:9,代码来源:migration.custom.class.php

示例6: array

if (api_is_platform_admin()) {
    $sessions = SessionManager::get_sessions_admin(array('order' => 'name'));
} else {
    $sessions = SessionManager::get_sessions_by_general_coach(api_get_session_id());
}
$message = null;
$session_to_select = array();
foreach ($sessions as $session) {
    if ($session_id != $session['id']) {
        $session_to_select[$session['id']] = $session['name'];
    }
}
$session_name = api_get_session_name($session_id);
$user_info = api_get_user_info($user_id);
//Check if user was already moved
$user_status = SessionManager::get_user_status_in_session($session_id, $user_id);
if (isset($user_status['moved_to']) && $user_status['moved_to'] != 0 || $user_status['moved_status'] == SessionManager::SESSION_CHANGE_USER_REASON_ENROLLMENT_ANNULATION) {
    api_not_allowed(true);
}
$form = new FormValidator('change_user_session', 'post', api_get_self());
$form->addElement('hidden', 'user_id', $user_id);
$form->addElement('hidden', 'id_session', $session_id);
$form->addElement('header', get_lang('ChangeUserSession'));
$form->addElement('label', get_lang('User'), '<b>' . $user_info['complete_name'] . '</b>');
$form->addElement('label', get_lang('CurrentSession'), $session_name);
$form->addElement('select', 'reason_id', get_lang('Action'), SessionManager::get_session_change_user_reasons(), array('id' => 'reason_id'));
$form->addElement('select', 'new_session_id', get_lang('SessionDestination'), $session_to_select, array('id' => 'new_session_id'));
$form->addElement('button', 'submit', get_lang('Change'));
$content = $form->return_form();
if ($form->validate()) {
    $values = $form->getSubmitValues();
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:change_user_session.php

示例7: array

 $header = array(array(get_lang('Code'), true), array(get_lang('Title'), true), array(get_lang('Status'), true), array(get_lang('TimeSpentInTheCourse'), true), array(get_lang('TotalPostsInAllForums'), true), array('', false));
 $headerList = array();
 foreach ($header as $item) {
     $headerList[] = $item[0];
 }
 $csvContent[] = array();
 $csvContent[] = array(get_lang('Sessions'));
 foreach ($sessions as $session_item) {
     $data = array();
     $personal_course_list = array();
     $id_session = $session_item['session_id'];
     $csvContent[] = array($session_item['session_name']);
     $csvContent[] = $headerList;
     foreach ($session_item['courses'] as $my_course) {
         $courseInfo = api_get_course_info($my_course['code']);
         $sessionStatus = SessionManager::get_user_status_in_session($user['user_id'], $my_course['code'], $id_session);
         $status = null;
         switch ($sessionStatus) {
             case 0:
             case STUDENT:
                 $status = get_lang('Student');
                 break;
             case 2:
                 $status = get_lang('CourseCoach');
                 break;
         }
         $tools = '<a href="course_information.php?code=' . $courseInfo['code'] . '&id_session=' . $id_session . '">' . Display::return_icon('synthese_view.gif', get_lang('Overview')) . '</a>' . '<a href="' . api_get_path(WEB_COURSE_PATH) . $courseInfo['path'] . '?id_session=' . $id_session . '">' . Display::return_icon('course_home.gif', get_lang('CourseHomepage')) . '</a>';
         if ($my_course['status'] == STUDENT) {
             $tools .= '<a href="user_information.php?action=unsubscribe&course_code=' . $courseInfo['code'] . '&user_id=' . $user['user_id'] . '">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
         }
         $timeSpent = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'], $courseInfo['code'], $id_session));
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:user_information.php


注:本文中的SessionManager::get_user_status_in_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。