original_string: public static function view_user_list($courseid) {
          global $CFG;
          require_once($CFG->dirroot . "/user/lib.php");
          require_once($CFG->dirroot . '/course/lib.php');
  
          $params = self::validate_parameters(self::view_user_list_parameters(),
                                              array(
                                                  'courseid' => $courseid
                                              ));
  
          $warnings = array();
  
          if (empty($params['courseid'])) {
              $params['courseid'] = SITEID;
          }
  
          $course = get_course($params['courseid']);
  
          if ($course->id == SITEID) {
              $context = context_system::instance();
          } else {
              $context = context_course::instance($course->id);
          }
          self::validate_context($context);
  
          course_require_view_participants($context);
  
          user_list_view($course, $context);
  
          $result = array();
          $result['status'] = true;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function view_user_list($courseid) {
          global $CFG;
          require_once($CFG->dirroot . "/user/lib.php");
          require_once($CFG->dirroot . '/course/lib.php');
  
          $params = self::validate_parameters(self::view_user_list_parameters(),
                                              array(
                                                  'courseid' => $courseid
                                              ));
  
          $warnings = array();
  
          if (empty($params['courseid'])) {
              $params['courseid'] = SITEID;
          }
  
          $course = get_course($params['courseid']);
  
          if ($course->id == SITEID) {
              $context = context_system::instance();
          } else {
              $context = context_course::instance($course->id);
          }
          self::validate_context($context);
  
          course_require_view_participants($context);
  
          user_list_view($course, $context);
  
          $result = array();
          $result['status'] = true;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function view_user_list ( $ courseid ) { global $ CFG ; require_once ( $ CFG -> dirroot . "/user/lib.php" ) ; require_once ( $ CFG -> dirroot . '/course/lib.php' ) ; $ params = self :: validate_parameters ( self :: view_user_list_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; $ warnings = array ( ) ; if ( empty ( $ params [ 'courseid' ] ) ) { $ params [ 'courseid' ] = SITEID ; } $ course = get_course ( $ params [ 'courseid' ] ) ; if ( $ course -> id == SITEID ) { $ context = context_system :: instance ( ) ; } else { $ context = context_course :: instance ( $ course -> id ) ; } self :: validate_context ( $ context ) ; course_require_view_participants ( $ context ) ; user_list_view ( $ course , $ context ) ; $ result = array ( ) ; $ result [ 'status' ] = true ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Trigger the user_list_viewed event.
  
  @param int $courseid id of course
  @return array of warnings and status result
  @since Moodle 2.9
  @throws moodle_exception
docstring_tokens: Trigger the user_list_viewed event .