original_string: protected function get_student_activities($sampleid, $tablename, $starttime, $endtime) {
  
          // May not be available.
          $user = $this->retrieve('user', $sampleid);
  
          if ($this->course === null) {
              // The indicator scope is a range, so all activities belong to the same course.
              $this->course = \core_analytics\course::instance($this->retrieve('course', $sampleid));
          }
  
          if ($this->activitylogs === null) {
              // Fetch all activity logs in each activity in the course, not restricted to a specific sample so we can cache it.
  
              $courseactivities = $this->course->get_all_activities($this->get_activity_type());
  
              // Null if no activities of this type in this course.
              if (empty($courseactivities)) {
                  $this->activitylogs = false;
                  return null;
              }
              $this->activitylogs = $this->fetch_activity_logs($courseactivities, $starttime, $endtime);
          }
  
          if ($this->grades === null) {
              // Even if this is probably already filled during fill_per_analysable_caches.
              $this->fetch_student_grades($this->course);
          }
  
          if ($cm = $this->retrieve('cm', $sampleid)) {
              // Samples are at cm level or below.
              $useractivities = array(\context_module::instance($cm->id)->id => $cm);
          } else {
              // Activities that should be completed during this time period.
              $useractivities = $this->get_activities($starttime, $endtime, $user);
          }
  
          return $useractivities;
      }
code: protected function get_student_activities($sampleid, $tablename, $starttime, $endtime) {
  
          // May not be available.
          $user = $this->retrieve('user', $sampleid);
  
          if ($this->course === null) {
              // The indicator scope is a range, so all activities belong to the same course.
              $this->course = \core_analytics\course::instance($this->retrieve('course', $sampleid));
          }
  
          if ($this->activitylogs === null) {
              // Fetch all activity logs in each activity in the course, not restricted to a specific sample so we can cache it.
  
              $courseactivities = $this->course->get_all_activities($this->get_activity_type());
  
              // Null if no activities of this type in this course.
              if (empty($courseactivities)) {
                  $this->activitylogs = false;
                  return null;
              }
              $this->activitylogs = $this->fetch_activity_logs($courseactivities, $starttime, $endtime);
          }
  
          if ($this->grades === null) {
              // Even if this is probably already filled during fill_per_analysable_caches.
              $this->fetch_student_grades($this->course);
          }
  
          if ($cm = $this->retrieve('cm', $sampleid)) {
              // Samples are at cm level or below.
              $useractivities = array(\context_module::instance($cm->id)->id => $cm);
          } else {
              // Activities that should be completed during this time period.
              $useractivities = $this->get_activities($starttime, $endtime, $user);
          }
  
          return $useractivities;
      }
code_tokens: protected function get_student_activities ( $ sampleid , $ tablename , $ starttime , $ endtime ) { // May not be available. $ user = $ this -> retrieve ( 'user' , $ sampleid ) ; if ( $ this -> course === null ) { // The indicator scope is a range, so all activities belong to the same course. $ this -> course = \ core_analytics \ course :: instance ( $ this -> retrieve ( 'course' , $ sampleid ) ) ; } if ( $ this -> activitylogs === null ) { // Fetch all activity logs in each activity in the course, not restricted to a specific sample so we can cache it. $ courseactivities = $ this -> course -> get_all_activities ( $ this -> get_activity_type ( ) ) ; // Null if no activities of this type in this course. if ( empty ( $ courseactivities ) ) { $ this -> activitylogs = false ; return null ; } $ this -> activitylogs = $ this -> fetch_activity_logs ( $ courseactivities , $ starttime , $ endtime ) ; } if ( $ this -> grades === null ) { // Even if this is probably already filled during fill_per_analysable_caches. $ this -> fetch_student_grades ( $ this -> course ) ; } if ( $ cm = $ this -> retrieve ( 'cm' , $ sampleid ) ) { // Samples are at cm level or below. $ useractivities = array ( \ context_module :: instance ( $ cm -> id ) -> id => $ cm ) ; } else { // Activities that should be completed during this time period. $ useractivities = $ this -> get_activities ( $ starttime , $ endtime , $ user ) ; } return $ useractivities ; }
docstring: Returns the activities the user had access to between a time period.
  
  @param int $sampleid
  @param string $tablename
  @param int $starttime
  @param int $endtime
  @return array
docstring_tokens: Returns the activities the user had access to between a time period .