original_string: public function get_samples($sampleids) {
          global $DB;
  
          $enrolments = enrol_get_course_users(false, false, array(), $sampleids);
  
          // Some course enrolments.
          list($enrolsql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
  
          $samplesdata = array();
          foreach ($enrolments as $userenrolmentid => $user) {
  
              $sampleid = $userenrolmentid;
              $samplesdata[$sampleid]['user_enrolments'] = (object)array(
                  'id' => $user->ueid,
                  'status' => $user->uestatus,
                  'enrolid' => $user->ueenrolid,
                  'userid' => $user->id,
                  'timestart' => $user->uetimestart,
                  'timeend' => $user->uetimeend,
                  'modifierid' => $user->uemodifierid,
                  'timecreated' => $user->uetimecreated,
                  'timemodified' => $user->uetimemodified
              );
              unset($user->ueid);
              unset($user->uestatus);
              unset($user->ueenrolid);
              unset($user->uetimestart);
              unset($user->uetimeend);
              unset($user->uemodifierid);
              unset($user->uetimecreated);
              unset($user->uetimemodified);
  
              // Enrolment samples are grouped by the course they belong to, so all $sampleids belong to the same
              // course, $courseid and $coursemodinfo will only query the DB once and cache the course data in memory.
              $courseid = $this->get_sample_courseid($sampleid);
              $coursemodinfo = get_fast_modinfo($courseid);
              $coursecontext = \context_course::instance($courseid);
  
              $samplesdata[$sampleid]['course'] = $coursemodinfo->get_course();
              $samplesdata[$sampleid]['context'] = $coursecontext;
              $samplesdata[$sampleid]['user'] = $user;
  
              // Fill the cache.
              $this->samplecourses[$sampleid] = $coursemodinfo->get_course()->id;
          }
  
          $enrolids = array_keys($samplesdata);
          return array(array_combine($enrolids, $enrolids), $samplesdata);
      }
code: public function get_samples($sampleids) {
          global $DB;
  
          $enrolments = enrol_get_course_users(false, false, array(), $sampleids);
  
          // Some course enrolments.
          list($enrolsql, $params) = $DB->get_in_or_equal($sampleids, SQL_PARAMS_NAMED);
  
          $samplesdata = array();
          foreach ($enrolments as $userenrolmentid => $user) {
  
              $sampleid = $userenrolmentid;
              $samplesdata[$sampleid]['user_enrolments'] = (object)array(
                  'id' => $user->ueid,
                  'status' => $user->uestatus,
                  'enrolid' => $user->ueenrolid,
                  'userid' => $user->id,
                  'timestart' => $user->uetimestart,
                  'timeend' => $user->uetimeend,
                  'modifierid' => $user->uemodifierid,
                  'timecreated' => $user->uetimecreated,
                  'timemodified' => $user->uetimemodified
              );
              unset($user->ueid);
              unset($user->uestatus);
              unset($user->ueenrolid);
              unset($user->uetimestart);
              unset($user->uetimeend);
              unset($user->uemodifierid);
              unset($user->uetimecreated);
              unset($user->uetimemodified);
  
              // Enrolment samples are grouped by the course they belong to, so all $sampleids belong to the same
              // course, $courseid and $coursemodinfo will only query the DB once and cache the course data in memory.
              $courseid = $this->get_sample_courseid($sampleid);
              $coursemodinfo = get_fast_modinfo($courseid);
              $coursecontext = \context_course::instance($courseid);
  
              $samplesdata[$sampleid]['course'] = $coursemodinfo->get_course();
              $samplesdata[$sampleid]['context'] = $coursecontext;
              $samplesdata[$sampleid]['user'] = $user;
  
              // Fill the cache.
              $this->samplecourses[$sampleid] = $coursemodinfo->get_course()->id;
          }
  
          $enrolids = array_keys($samplesdata);
          return array(array_combine($enrolids, $enrolids), $samplesdata);
      }
code_tokens: public function get_samples ( $ sampleids ) { global $ DB ; $ enrolments = enrol_get_course_users ( false , false , array ( ) , $ sampleids ) ; // Some course enrolments. list ( $ enrolsql , $ params ) = $ DB -> get_in_or_equal ( $ sampleids , SQL_PARAMS_NAMED ) ; $ samplesdata = array ( ) ; foreach ( $ enrolments as $ userenrolmentid => $ user ) { $ sampleid = $ userenrolmentid ; $ samplesdata [ $ sampleid ] [ 'user_enrolments' ] = ( object ) array ( 'id' => $ user -> ueid , 'status' => $ user -> uestatus , 'enrolid' => $ user -> ueenrolid , 'userid' => $ user -> id , 'timestart' => $ user -> uetimestart , 'timeend' => $ user -> uetimeend , 'modifierid' => $ user -> uemodifierid , 'timecreated' => $ user -> uetimecreated , 'timemodified' => $ user -> uetimemodified ) ; unset ( $ user -> ueid ) ; unset ( $ user -> uestatus ) ; unset ( $ user -> ueenrolid ) ; unset ( $ user -> uetimestart ) ; unset ( $ user -> uetimeend ) ; unset ( $ user -> uemodifierid ) ; unset ( $ user -> uetimecreated ) ; unset ( $ user -> uetimemodified ) ; // Enrolment samples are grouped by the course they belong to, so all $sampleids belong to the same // course, $courseid and $coursemodinfo will only query the DB once and cache the course data in memory. $ courseid = $ this -> get_sample_courseid ( $ sampleid ) ; $ coursemodinfo = get_fast_modinfo ( $ courseid ) ; $ coursecontext = \ context_course :: instance ( $ courseid ) ; $ samplesdata [ $ sampleid ] [ 'course' ] = $ coursemodinfo -> get_course ( ) ; $ samplesdata [ $ sampleid ] [ 'context' ] = $ coursecontext ; $ samplesdata [ $ sampleid ] [ 'user' ] = $ user ; // Fill the cache. $ this -> samplecourses [ $ sampleid ] = $ coursemodinfo -> get_course ( ) -> id ; } $ enrolids = array_keys ( $ samplesdata ) ; return array ( array_combine ( $ enrolids , $ enrolids ) , $ samplesdata ) ; }
docstring: Returns all samples from the samples ids.
  
  @param int[] $sampleids
  @return array
docstring_tokens: Returns all samples from the samples ids .