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


PHP SessionManager::removeUsersFromCourseSession方法代码示例

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


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

示例1: importUnsubSessionsExtIdStatic

 /**
  * @param string $file
  */
 private function importUnsubSessionsExtIdStatic($file)
 {
     $data = Import::csv_reader($file);
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         foreach ($data as $row) {
             $chamiloUserName = $row['UserName'];
             $chamiloCourseCode = $row['CourseCode'];
             $externalSessionId = $row['ExtSessionID'];
             $dateStop = $row['DateStop'];
             $chamiloSessionId = null;
             if (!empty($externalSessionId)) {
                 $chamiloSessionId = SessionManager::get_session_id_from_original_id($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $sessionInfo = api_get_session_info($chamiloSessionId);
             if (empty($sessionInfo)) {
                 $this->logger->addError('Session does not exists: ' . $chamiloSessionId);
                 continue;
             }
             $courseInfo = api_get_course_info($chamiloCourseCode);
             if (empty($courseInfo)) {
                 $this->logger->addError('Course does not exists: ' . $courseInfo);
                 continue;
             }
             $userId = Usermanager::get_user_id_from_username($chamiloUserName);
             if (empty($userId)) {
                 $this->logger->addError('User does not exists: ' . $chamiloUserName);
                 continue;
             }
             SessionManager::removeUsersFromCourseSession(array($userId), $chamiloSessionId, $courseInfo);
             $this->logger->addError("User '{$chamiloUserName}' was remove from Session: #{$chamiloSessionId} - Course: " . $courseInfo['code']);
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:37,代码来源:import_csv.php

示例2: get_lang

        $urlInformation = '<p>' . get_lang('NoUrlForThisUser') . '</p>';
    }
}
$message = null;
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'unsubscribe':
            if (CourseManager::get_user_in_course_status($_GET['user_id'], $_GET['course_code']) == STUDENT) {
                CourseManager::unsubscribe_user($_GET['user_id'], $_GET['course_code'], $_GET['id_session']);
                $message = Display::return_message(get_lang('UserUnsubscribed'));
            } else {
                $message = Display::return_message(get_lang('CannotUnsubscribeUserFromCourse'), 'error');
            }
            break;
        case 'unsubscribeSessionCourse':
            SessionManager::removeUsersFromCourseSession(array($_GET['user_id']), $_GET['id_session'], api_get_course_info($_GET['course_code']));
            $message = Display::return_message(get_lang('UserUnsubscribed'));
            break;
        case 'export':
            Export::arrayToCsv($csvContent, 'user_information_' . $user);
            exit;
            break;
    }
}
Display::display_header($tool_name);
echo '<div class="actions">
        <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . intval($_GET['user_id']) . '" title="' . get_lang('Reporting') . '">' . Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM) . '
        </a>
        ' . $login_as_icon . '
        ' . $editUser . '
        ' . $exportLink . '
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_information.php

示例3: WSUnsubscribeTeacherFromSessionCourse

/**
 * Subscribe teacher to a session course
 *
 *  @param array $params - WSFunction parameters (include VerifyKey)
 *  @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
 */
function WSUnsubscribeTeacherFromSessionCourse($params)
{
    global $debug;
    if ($debug) {
        error_log('WSSubscribeTeacherToSessionCourse');
    }
    if ($debug) {
        error_log('Params ' . print_r($params, 1));
    }
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $userId = $params['userId'];
    // Chamilo user Id
    $sessionId = $params['sessionId'];
    // Current Session course ID
    $courseId = $params['courseId'];
    // Course Real Id
    return SessionManager::removeUsersFromCourseSession($userId, $sessionId, $courseId);
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:26,代码来源:registration.soap.php

示例4: WSUnsubscribeTeacherFromSessionCourse

/**
 * Subscribe teacher to a session course
 *
 *  @param array $params - WSFunction parameters (include VerifyKey)
 *  @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
 */
function WSUnsubscribeTeacherFromSessionCourse($params)
{
    global $debug;
    if ($debug) {
        error_log('WSSubscribeTeacherToSessionCourse');
    }
    if (!WSHelperVerifyKey($params)) {
        return returnError(WS_ERROR_SECRET_KEY);
    }
    if ($debug) {
        error_log('Params ' . print_r($params, 1));
    }
    $params = parseCourseSessionUserParams($params);
    $userId = $params['user_id'];
    $courseId = $params['course_id'];
    $sessionId = $params['session_id'];
    SessionManager::removeUsersFromCourseSession([$userId], $sessionId, $courseId);
    $coaches = SessionManager::getCoachesByCourseSession($sessionId, $courseId);
    $result = 0;
    if (!empty($coaches)) {
        if ($debug) {
            error_log('Coaches:  ' . print_r($coaches, 1));
        }
        if (!in_array($userId, $coaches)) {
            $result = 1;
        }
    } else {
        $result = 1;
    }
    if ($debug) {
        error_log('Final Result: ' . $result);
    }
    return $result;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:40,代码来源:registration.soap.php

示例5: WSUnsubscribeTeacherFromSessionCourse

/**
 * Subscribe teacher to a session course
 *
 *  @param array $params - WSFunction parameters (include VerifyKey)
 *  @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
 */
function WSUnsubscribeTeacherFromSessionCourse($params)
{
    global $debug;
    if ($debug) {
        error_log('WSSubscribeTeacherToSessionCourse');
    }
    if ($debug) {
        error_log('Params ' . print_r($params, 1));
    }
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $params = parseCourseSessionUserParams($params);
    $userId = $params['user_id'];
    $courseId = $params['course_id'];
    $sessionId = $params['session_id'];
    return intval(SessionManager::removeUsersFromCourseSession($userId, $sessionId, $courseId));
}
开发者ID:daffef,项目名称:chamilo-lms,代码行数:24,代码来源:registration.soap.php

示例6: changeTeacherSubscription

 /**
  * Change Teacher subscription (helper method)
  *
  * @param string User id field name
  * @param string User id value
  * @param string Session id field name
  * @param string Session id value
  * @param string Course id field name
  * @param string Course id value
  * @param int State (1 to subscribe, 0 to unsubscribe)
  * @return mixed True on success, WSError otherwise
  */
 protected function changeTeacherSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $course_id_field_name, $course_id_value, $state)
 {
     $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
     if ($session_id instanceof WSError) {
         return $session_id;
     } else {
         $user_id = $this->getUserId($user_id_field_name, $user_id_value);
         if ($user_id instanceof WSError) {
             return $user_id;
         } else {
             $course_id = $this->getCourseId($course_id_field_name, $course_id_value);
             if ($course_id instanceof WSError) {
                 return $course_id;
             } else {
                 if ($state == 1) {
                     SessionManager::set_coach_to_course_session($user_id, $session_id, $course_id);
                 } else {
                     $user_id = array(0 => $user_id);
                     $result = SessionManager::removeUsersFromCourseSession($user_id, $session_id, $course_id);
                     if (!$result) {
                         return new WSError(303, 'There was an error unsubscribing this Teacher from the session');
                     }
                 }
                 return true;
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:40,代码来源:webservice_session.php


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