original_string: public static function get_chat_users($chatsid) {
          global $DB, $PAGE;
  
          $params = self::validate_parameters(self::get_chat_users_parameters(),
                                              array(
                                                  'chatsid' => $chatsid
                                              ));
          $warnings = array();
  
          // Request and permission validation.
          if (!$chatuser = $DB->get_record('chat_users', array('sid' => $params['chatsid']))) {
              throw new moodle_exception('notlogged', 'chat');
          }
          $chat = $DB->get_record('chat', array('id' => $chatuser->chatid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($chat, 'chat');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          require_capability('mod/chat:chat', $context);
  
          // First, delete old users from the chats.
          chat_delete_old_users();
  
          $users = chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid);
          $returnedusers = array();
  
          foreach ($users as $user) {
  
              $userpicture = new user_picture($user);
              $userpicture->size = 1; // Size f1.
              $profileimageurl = $userpicture->get_url($PAGE)->out(false);
  
              $returnedusers[] = array(
                  'id' => $user->id,
                  'fullname' => fullname($user),
                  'profileimageurl' => $profileimageurl
              );
          }
  
          $result = array();
          $result['users'] = $returnedusers;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_chat_users($chatsid) {
          global $DB, $PAGE;
  
          $params = self::validate_parameters(self::get_chat_users_parameters(),
                                              array(
                                                  'chatsid' => $chatsid
                                              ));
          $warnings = array();
  
          // Request and permission validation.
          if (!$chatuser = $DB->get_record('chat_users', array('sid' => $params['chatsid']))) {
              throw new moodle_exception('notlogged', 'chat');
          }
          $chat = $DB->get_record('chat', array('id' => $chatuser->chatid), '*', MUST_EXIST);
          list($course, $cm) = get_course_and_cm_from_instance($chat, 'chat');
  
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          require_capability('mod/chat:chat', $context);
  
          // First, delete old users from the chats.
          chat_delete_old_users();
  
          $users = chat_get_users($chatuser->chatid, $chatuser->groupid, $cm->groupingid);
          $returnedusers = array();
  
          foreach ($users as $user) {
  
              $userpicture = new user_picture($user);
              $userpicture->size = 1; // Size f1.
              $profileimageurl = $userpicture->get_url($PAGE)->out(false);
  
              $returnedusers[] = array(
                  'id' => $user->id,
                  'fullname' => fullname($user),
                  'profileimageurl' => $profileimageurl
              );
          }
  
          $result = array();
          $result['users'] = $returnedusers;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_chat_users ( $ chatsid ) { global $ DB , $ PAGE ; $ params = self :: validate_parameters ( self :: get_chat_users_parameters ( ) , array ( 'chatsid' => $ chatsid ) ) ; $ warnings = array ( ) ; // Request and permission validation. if ( ! $ chatuser = $ DB -> get_record ( 'chat_users' , array ( 'sid' => $ params [ 'chatsid' ] ) ) ) { throw new moodle_exception ( 'notlogged' , 'chat' ) ; } $ chat = $ DB -> get_record ( 'chat' , array ( 'id' => $ chatuser -> chatid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ chat , 'chat' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; require_capability ( 'mod/chat:chat' , $ context ) ; // First, delete old users from the chats. chat_delete_old_users ( ) ; $ users = chat_get_users ( $ chatuser -> chatid , $ chatuser -> groupid , $ cm -> groupingid ) ; $ returnedusers = array ( ) ; foreach ( $ users as $ user ) { $ userpicture = new user_picture ( $ user ) ; $ userpicture -> size = 1 ; // Size f1. $ profileimageurl = $ userpicture -> get_url ( $ PAGE ) -> out ( false ) ; $ returnedusers [ ] = array ( 'id' => $ user -> id , 'fullname' => fullname ( $ user ) , 'profileimageurl' => $ profileimageurl ) ; } $ result = array ( ) ; $ result [ 'users' ] = $ returnedusers ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Get the list of users in the given chat session.
  
  @param int $chatsid the chat session id
  @return array of warnings and the user lists
  @since Moodle 3.0
  @throws moodle_exception
docstring_tokens: Get the list of users in the given chat session .