original_string: public function get_user_enrolments($userid) {
          global $DB;
          list($instancessql, $params, $filter) = $this->get_instance_sql();
          $params['userid'] = $userid;
          $userenrolments = $DB->get_records_select('user_enrolments', "enrolid $instancessql AND userid = :userid", $params);
          $instances = $this->get_enrolment_instances();
          $plugins = $this->get_enrolment_plugins(false);
          $inames = $this->get_enrolment_instance_names();
          foreach ($userenrolments as &$ue) {
              $ue->enrolmentinstance     = $instances[$ue->enrolid];
              $ue->enrolmentplugin       = $plugins[$ue->enrolmentinstance->enrol];
              $ue->enrolmentinstancename = $inames[$ue->enrolmentinstance->id];
          }
          return $userenrolments;
      }
code: public function get_user_enrolments($userid) {
          global $DB;
          list($instancessql, $params, $filter) = $this->get_instance_sql();
          $params['userid'] = $userid;
          $userenrolments = $DB->get_records_select('user_enrolments', "enrolid $instancessql AND userid = :userid", $params);
          $instances = $this->get_enrolment_instances();
          $plugins = $this->get_enrolment_plugins(false);
          $inames = $this->get_enrolment_instance_names();
          foreach ($userenrolments as &$ue) {
              $ue->enrolmentinstance     = $instances[$ue->enrolid];
              $ue->enrolmentplugin       = $plugins[$ue->enrolmentinstance->enrol];
              $ue->enrolmentinstancename = $inames[$ue->enrolmentinstance->id];
          }
          return $userenrolments;
      }
code_tokens: public function get_user_enrolments ( $ userid ) { global $ DB ; list ( $ instancessql , $ params , $ filter ) = $ this -> get_instance_sql ( ) ; $ params [ 'userid' ] = $ userid ; $ userenrolments = $ DB -> get_records_select ( 'user_enrolments' , "enrolid $instancessql AND userid = :userid" , $ params ) ; $ instances = $ this -> get_enrolment_instances ( ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; $ inames = $ this -> get_enrolment_instance_names ( ) ; foreach ( $ userenrolments as & $ ue ) { $ ue -> enrolmentinstance = $ instances [ $ ue -> enrolid ] ; $ ue -> enrolmentplugin = $ plugins [ $ ue -> enrolmentinstance -> enrol ] ; $ ue -> enrolmentinstancename = $ inames [ $ ue -> enrolmentinstance -> id ] ; } return $ userenrolments ; }
docstring: Gets the enrolments this user has in the course - including all suspended plugins and instances.
  
  @global moodle_database $DB
  @param int $userid
  @return array
docstring_tokens: Gets the enrolments this user has in the course - including all suspended plugins and instances .