original_string: public function get_all_submissions($userid) {
          global $DB, $USER;
  
          // If the userid is not null then use userid.
          if (!$userid) {
              $userid = $USER->id;
          }
  
          $params = array();
  
          if ($this->get_instance()->teamsubmission) {
              $groupid = 0;
              $group = $this->get_submission_group($userid);
              if ($group) {
                  $groupid = $group->id;
              }
  
              // Params to get the group submissions.
              $params = array('assignment'=>$this->get_instance()->id, 'groupid'=>$groupid, 'userid'=>0);
          } else {
              // Params to get the user submissions.
              $params = array('assignment'=>$this->get_instance()->id, 'userid'=>$userid);
          }
  
          // Return the submissions ordered by attempt.
          $submissions = $DB->get_records('assign_submission', $params, 'attemptnumber ASC');
  
          return $submissions;
      }
code: public function get_all_submissions($userid) {
          global $DB, $USER;
  
          // If the userid is not null then use userid.
          if (!$userid) {
              $userid = $USER->id;
          }
  
          $params = array();
  
          if ($this->get_instance()->teamsubmission) {
              $groupid = 0;
              $group = $this->get_submission_group($userid);
              if ($group) {
                  $groupid = $group->id;
              }
  
              // Params to get the group submissions.
              $params = array('assignment'=>$this->get_instance()->id, 'groupid'=>$groupid, 'userid'=>0);
          } else {
              // Params to get the user submissions.
              $params = array('assignment'=>$this->get_instance()->id, 'userid'=>$userid);
          }
  
          // Return the submissions ordered by attempt.
          $submissions = $DB->get_records('assign_submission', $params, 'attemptnumber ASC');
  
          return $submissions;
      }
code_tokens: public function get_all_submissions ( $ userid ) { global $ DB , $ USER ; // If the userid is not null then use userid. if ( ! $ userid ) { $ userid = $ USER -> id ; } $ params = array ( ) ; if ( $ this -> get_instance ( ) -> teamsubmission ) { $ groupid = 0 ; $ group = $ this -> get_submission_group ( $ userid ) ; if ( $ group ) { $ groupid = $ group -> id ; } // Params to get the group submissions. $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'groupid' => $ groupid , 'userid' => 0 ) ; } else { // Params to get the user submissions. $ params = array ( 'assignment' => $ this -> get_instance ( ) -> id , 'userid' => $ userid ) ; } // Return the submissions ordered by attempt. $ submissions = $ DB -> get_records ( 'assign_submission' , $ params , 'attemptnumber ASC' ) ; return $ submissions ; }
docstring: Get the submissions for all previous attempts.
  
  @param int $userid If not set, $USER->id will be used.
  @return array $submissions All submission records for this user (or group).
docstring_tokens: Get the submissions for all previous attempts .