original_string: public function get_all_samples(\core_analytics\analysable $course) {
  
          $enrolments = enrol_get_course_users($course->get_id());
  
          // We fetch all enrolments, but we are only interested in students.
          $studentids = $course->get_students();
  
          $samplesdata = array();
          foreach ($enrolments as $userenrolmentid => $user) {
  
              if (empty($studentids[$user->id])) {
                  // Not a student.
                  continue;
              }
  
              $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);
  
              $samplesdata[$sampleid]['course'] = $course->get_course_data();
              $samplesdata[$sampleid]['context'] = $course->get_context();
              $samplesdata[$sampleid]['user'] = $user;
  
              // Fill the cache.
              $this->samplecourses[$sampleid] = $course->get_id();
          }
  
          $enrolids = array_keys($samplesdata);
          return array(array_combine($enrolids, $enrolids), $samplesdata);
      }
code: public function get_all_samples(\core_analytics\analysable $course) {
  
          $enrolments = enrol_get_course_users($course->get_id());
  
          // We fetch all enrolments, but we are only interested in students.
          $studentids = $course->get_students();
  
          $samplesdata = array();
          foreach ($enrolments as $userenrolmentid => $user) {
  
              if (empty($studentids[$user->id])) {
                  // Not a student.
                  continue;
              }
  
              $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);
  
              $samplesdata[$sampleid]['course'] = $course->get_course_data();
              $samplesdata[$sampleid]['context'] = $course->get_context();
              $samplesdata[$sampleid]['user'] = $user;
  
              // Fill the cache.
              $this->samplecourses[$sampleid] = $course->get_id();
          }
  
          $enrolids = array_keys($samplesdata);
          return array(array_combine($enrolids, $enrolids), $samplesdata);
      }
code_tokens: public function get_all_samples ( \ core_analytics \ analysable $ course ) { $ enrolments = enrol_get_course_users ( $ course -> get_id ( ) ) ; // We fetch all enrolments, but we are only interested in students. $ studentids = $ course -> get_students ( ) ; $ samplesdata = array ( ) ; foreach ( $ enrolments as $ userenrolmentid => $ user ) { if ( empty ( $ studentids [ $ user -> id ] ) ) { // Not a student. continue ; } $ 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 ) ; $ samplesdata [ $ sampleid ] [ 'course' ] = $ course -> get_course_data ( ) ; $ samplesdata [ $ sampleid ] [ 'context' ] = $ course -> get_context ( ) ; $ samplesdata [ $ sampleid ] [ 'user' ] = $ user ; // Fill the cache. $ this -> samplecourses [ $ sampleid ] = $ course -> get_id ( ) ; } $ enrolids = array_keys ( $ samplesdata ) ; return array ( array_combine ( $ enrolids , $ enrolids ) , $ samplesdata ) ; }
docstring: All course student enrolments.
  
  It does return all student enrolments including the suspended ones.
  
  @param \core_analytics\analysable $course
  @return array
docstring_tokens: All course student enrolments .