original_string: public function get_progress_all($where = '', $where_params = array(), $groupid = 0,
              $sort = '', $pagesize = '', $start = '', context $extracontext = null) {
          global $CFG, $DB;
  
          // Get list of applicable users
          $users = $this->get_tracked_users($where, $where_params, $groupid, $sort,
                  $start, $pagesize, $extracontext);
  
          // Get progress information for these users in groups of 1, 000 (if needed)
          // to avoid making the SQL IN too long
          $results = array();
          $userids = array();
          foreach ($users as $user) {
              $userids[] = $user->id;
              $results[$user->id] = $user;
              $results[$user->id]->progress = array();
          }
  
          for($i=0; $i<count($userids); $i+=1000) {
              $blocksize = count($userids)-$i < 1000 ? count($userids)-$i : 1000;
  
              list($insql, $params) = $DB->get_in_or_equal(array_slice($userids, $i, $blocksize));
              array_splice($params, 0, 0, array($this->course->id));
              $rs = $DB->get_recordset_sql("
                  SELECT
                      cmc.*
                  FROM
                      {course_modules} cm
                      INNER JOIN {course_modules_completion} cmc ON cm.id=cmc.coursemoduleid
                  WHERE
                      cm.course=? AND cmc.userid $insql", $params);
              foreach ($rs as $progress) {
                  $progress = (object)$progress;
                  $results[$progress->userid]->progress[$progress->coursemoduleid] = $progress;
              }
              $rs->close();
          }
  
          return $results;
      }
code: public function get_progress_all($where = '', $where_params = array(), $groupid = 0,
              $sort = '', $pagesize = '', $start = '', context $extracontext = null) {
          global $CFG, $DB;
  
          // Get list of applicable users
          $users = $this->get_tracked_users($where, $where_params, $groupid, $sort,
                  $start, $pagesize, $extracontext);
  
          // Get progress information for these users in groups of 1, 000 (if needed)
          // to avoid making the SQL IN too long
          $results = array();
          $userids = array();
          foreach ($users as $user) {
              $userids[] = $user->id;
              $results[$user->id] = $user;
              $results[$user->id]->progress = array();
          }
  
          for($i=0; $i<count($userids); $i+=1000) {
              $blocksize = count($userids)-$i < 1000 ? count($userids)-$i : 1000;
  
              list($insql, $params) = $DB->get_in_or_equal(array_slice($userids, $i, $blocksize));
              array_splice($params, 0, 0, array($this->course->id));
              $rs = $DB->get_recordset_sql("
                  SELECT
                      cmc.*
                  FROM
                      {course_modules} cm
                      INNER JOIN {course_modules_completion} cmc ON cm.id=cmc.coursemoduleid
                  WHERE
                      cm.course=? AND cmc.userid $insql", $params);
              foreach ($rs as $progress) {
                  $progress = (object)$progress;
                  $results[$progress->userid]->progress[$progress->coursemoduleid] = $progress;
              }
              $rs->close();
          }
  
          return $results;
      }
code_tokens: public function get_progress_all ( $ where = '' , $ where_params = array ( ) , $ groupid = 0 , $ sort = '' , $ pagesize = '' , $ start = '' , context $ extracontext = null ) { global $ CFG , $ DB ; // Get list of applicable users $ users = $ this -> get_tracked_users ( $ where , $ where_params , $ groupid , $ sort , $ start , $ pagesize , $ extracontext ) ; // Get progress information for these users in groups of 1, 000 (if needed) // to avoid making the SQL IN too long $ results = array ( ) ; $ userids = array ( ) ; foreach ( $ users as $ user ) { $ userids [ ] = $ user -> id ; $ results [ $ user -> id ] = $ user ; $ results [ $ user -> id ] -> progress = array ( ) ; } for ( $ i = 0 ; $ i < count ( $ userids ) ; $ i += 1000 ) { $ blocksize = count ( $ userids ) - $ i < 1000 ? count ( $ userids ) - $ i : 1000 ; list ( $ insql , $ params ) = $ DB -> get_in_or_equal ( array_slice ( $ userids , $ i , $ blocksize ) ) ; array_splice ( $ params , 0 , 0 , array ( $ this -> course -> id ) ) ; $ rs = $ DB -> get_recordset_sql ( "
                  SELECT
                      cmc.*
                  FROM
                      {course_modules} cm
                      INNER JOIN {course_modules_completion} cmc ON cm.id=cmc.coursemoduleid
                  WHERE
                      cm.course=? AND cmc.userid $insql" , $ params ) ; foreach ( $ rs as $ progress ) { $ progress = ( object ) $ progress ; $ results [ $ progress -> userid ] -> progress [ $ progress -> coursemoduleid ] = $ progress ; } $ rs -> close ( ) ; } return $ results ; }
docstring: Obtains progress information across a course for all users on that course, or
  for all users in a specific group. Intended for use when displaying progress.
  
  This includes only users who, in course context, have one of the roles for
  which progress is tracked (the gradebookroles admin option) and are enrolled in course.
  
  Users are included (in the first array) even if they do not have
  completion progress for any course-module.
  
  @param bool $sortfirstname If true, sort by first name, otherwise sort by
  last name
  @param string $where Where clause sql (optional)
  @param array $where_params Where clause params (optional)
  @param int $groupid Group ID or 0 (default)/false for all groups
  @param int $pagesize Number of users to actually return (optional)
  @param int $start User to start at if paging (optional)
  @param context $extracontext If set, includes extra user information fields
  as appropriate to display for current user in this context
  @return stdClass with ->total and ->start (same as $start) and ->users;
  an array of user objects (like mdl_user id, firstname, lastname)
  containing an additional ->progress array of coursemoduleid => completionstate
docstring_tokens: Obtains progress information across a course for all users on that course or for all users in a specific group . Intended for use when displaying progress .