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


PHP UserManager::is_user_id_valid方法代码示例

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


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

示例1: WSSessionGetDetailsByUser

 /**
  * @param $params
  * @return null|soap_fault
  */
 public static function WSSessionGetDetailsByUser($params)
 {
     global $debug;
     if ($debug) {
         error_log('WSUserSubscribedInCourse');
         error_log('Params ' . print_r($params, 1));
     }
     if (!WSHelperVerifyKey($params)) {
         return return_error(WS_ERROR_SECRET_KEY);
     }
     $result = return_error(WS_ERROR_NOT_FOUND_RESULT);
     // Check params
     if (is_array($params) && !empty($params['session_id']) && !empty($params['user_id'])) {
         $userId = UserManager::get_user_id_from_original_id($params['user_id'], $params['user_field']);
         $sessionId = (int) $params['session_id'];
         // Check if user exists
         if (UserManager::is_user_id_valid($userId) && SessionManager::isValidId($sessionId)) {
             // Check if student is already subscribed
             $plugin = AdvancedSubscriptionPlugin::create();
             $isOpen = $plugin->isSessionOpen($sessionId);
             $status = $plugin->getQueueStatus($userId, $sessionId);
             $vacancy = $plugin->getVacancy($sessionId);
             $data = $plugin->getSessionDetails($sessionId);
             $isUserInTargetGroup = $plugin->isUserInTargetGroup($userId, $sessionId);
             if (!empty($data) && is_array($data)) {
                 $data['status'] = $status;
                 // Vacancy and queue status cases:
                 if ($isOpen) {
                     // Go to Course session
                     $data['action_url'] = self::$plugin->getOpenSessionUrl($userId, $params);
                     if (SessionManager::isUserSubscribedAsStudent($sessionId, $userId)) {
                         $data['status'] = 10;
                     }
                 } else {
                     if (!$isUserInTargetGroup) {
                         $data['status'] = -2;
                     } else {
                         try {
                             $isAllowed = self::$plugin->isAllowedToDoRequest($userId, $params);
                             $data['message'] = self::$plugin->getStatusMessage($status, $isAllowed);
                         } catch (\Exception $e) {
                             $data['message'] = $e->getMessage();
                         }
                         $params['action'] = 'subscribe';
                         $params['sessionId'] = intval($sessionId);
                         $params['currentUserId'] = 0;
                         // No needed
                         $params['studentUserId'] = intval($userId);
                         $params['queueId'] = 0;
                         // No needed
                         $params['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START;
                         if ($vacancy > 0) {
                             // Check conditions
                             if ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
                                 // No in Queue, require queue subscription url action
                                 $data['action_url'] = self::$plugin->getTermsUrl($params);
                             } elseif ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
                                 // send url action
                                 $data['action_url'] = self::$plugin->getSessionUrl($sessionId);
                             } else {
                                 // In queue, output status message, no more info.
                             }
                         } else {
                             if ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
                                 $data['action_url'] = self::$plugin->getSessionUrl($sessionId);
                             } elseif ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
                                 // in Queue or not, cannot be subscribed to session
                                 $data['action_url'] = self::$plugin->getTermsUrl($params);
                             } else {
                                 // In queue, output status message, no more info.
                             }
                         }
                     }
                 }
                 $result = $data;
             } else {
                 // Return soap fault No result was found
                 $result = return_error(WS_ERROR_NOT_FOUND_RESULT);
             }
         } else {
             // Return soap fault No result was found
             $result = return_error(WS_ERROR_NOT_FOUND_RESULT);
         }
     } else {
         // Return soap fault Not valid input params
         $result = return_error(WS_ERROR_INVALID_INPUT);
     }
     return $result;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:93,代码来源:HookAdvancedSubscription.php

示例2: get_lang

         echo '
             <div class="row">
                 <div class="col-sm-10 col-sm-offset-2">
                     <a class="btn btn-primary" id="send_message_link">
                         <em class="fa fa-envelope"></em> ' . get_lang('Send') . '
                     </a>
                 </div>
             </div>
         ';
     }
     break;
 case 'user_id_exists':
     if (api_is_anonymous()) {
         echo '';
     } else {
         if (UserManager::is_user_id_valid($_GET['user_id'])) {
             echo 1;
         } else {
             echo 0;
         }
     }
     break;
 case 'search_tags':
     if (api_is_anonymous()) {
         echo '';
     } else {
         if (isset($_GET['tag']) && isset($_GET['field_id'])) {
             echo UserManager::get_tags($_GET['tag'], $_GET['field_id'], 'json', '10');
         }
     }
     break;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:user_manager.ajax.php

示例3: array

 $invalid_users = array();
 $clean_users = array();
 if (!empty($users)) {
     $empty_line = 0;
     foreach ($users as $user_data) {
         $user_id = null;
         $user_data = array_change_key_case($user_data, CASE_LOWER);
         // Checking "username" field
         if (isset($user_data['username']) && !empty($user_data['username'])) {
             $user_id = UserManager::get_user_id_from_username($user_data['username']);
         }
         // Checking "id" field
         if (isset($user_data['id']) && !empty($user_data['id'])) {
             $user_id = $user_data['id'];
         }
         if (UserManager::is_user_id_valid($user_id)) {
             $clean_users[] = $user_id;
         } else {
             $invalid_users[] = $user_data;
         }
     }
     if (empty($invalid_users)) {
         $type = 'confirmation';
         $message = get_lang('ListOfUsersSubscribedToCourse');
         if ($unsubscribe_users) {
             $current_user_list = CourseManager::get_user_list_from_course_code($course_code, $session_id);
             if (!empty($current_user_list)) {
                 $user_ids = array();
                 foreach ($current_user_list as $user) {
                     $user_ids[] = $user['user_id'];
                 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:user_import.php

示例4: getUserId

 /**
  * Gets the real user id based on the user id field name and value. Note that if the user id field name is "chamilo_user_id", it will use the user id
  * in the system database
  * 
  * @param string User id field name
  * @param string User id value
  * @return mixed System user id if the user was found, WSError otherwise
  */
 protected function getUserId($user_id_field_name, $user_id_value)
 {
     if ($user_id_field_name == "chamilo_user_id") {
         if (UserManager::is_user_id_valid(intval($user_id_value))) {
             return intval($user_id_value);
         } else {
             return new WSError(100, "User not found");
         }
     } else {
         $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name);
         if ($user_id == 0) {
             return new WSError(100, "User not found");
         } else {
             return $user_id;
         }
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:25,代码来源:webservice.php


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