original_string: public static function copy_previous_attempt($assignmentid) {
  
          $params = self::validate_parameters(self::copy_previous_attempt_parameters(),
                                              array('assignmentid' => $assignmentid));
  
          list($assignment, $course, $cm, $context) = self::validate_assign($params['assignmentid']);
  
          $notices = array();
  
          $assignment->copy_previous_attempt($notices);
  
          $warnings = array();
          foreach ($notices as $notice) {
              $warnings[] = self::generate_warning($assignmentid,
                                                   'couldnotcopyprevioussubmission',
                                                   $notice);
          }
  
          return $warnings;
      }
code: public static function copy_previous_attempt($assignmentid) {
  
          $params = self::validate_parameters(self::copy_previous_attempt_parameters(),
                                              array('assignmentid' => $assignmentid));
  
          list($assignment, $course, $cm, $context) = self::validate_assign($params['assignmentid']);
  
          $notices = array();
  
          $assignment->copy_previous_attempt($notices);
  
          $warnings = array();
          foreach ($notices as $notice) {
              $warnings[] = self::generate_warning($assignmentid,
                                                   'couldnotcopyprevioussubmission',
                                                   $notice);
          }
  
          return $warnings;
      }
code_tokens: public static function copy_previous_attempt ( $ assignmentid ) { $ params = self :: validate_parameters ( self :: copy_previous_attempt_parameters ( ) , array ( 'assignmentid' => $ assignmentid ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignmentid' ] ) ; $ notices = array ( ) ; $ assignment -> copy_previous_attempt ( $ notices ) ; $ warnings = array ( ) ; foreach ( $ notices as $ notice ) { $ warnings [ ] = self :: generate_warning ( $ assignmentid , 'couldnotcopyprevioussubmission' , $ notice ) ; } return $ warnings ; }
docstring: Copy a students previous attempt to a new attempt.
  
  @param int $assignmentid
  @return array of warnings to indicate any errors.
  @since Moodle 2.6
docstring_tokens: Copy a students previous attempt to a new attempt .