/**
  * Copy a students previous attempt to a new attempt.
  *
  * @param int $seplmentid
  * @return array of warnings to indicate any errors.
  * @since Moodle 2.6
  */
 public static function copy_previous_attempt($seplmentid)
 {
     global $CFG, $USER;
     require_once "{$CFG->dirroot}/mod/sepl/locallib.php";
     $params = self::validate_parameters(self::copy_previous_attempt_parameters(), array('seplmentid' => $seplmentid));
     $cm = get_coursemodule_from_instance('sepl', $seplmentid, 0, false, MUST_EXIST);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     $seplment = new sepl($context, $cm, null);
     $notices = array();
     $seplment->copy_previous_attempt($submissiondata, $notices);
     $warnings = array();
     foreach ($notices as $notice) {
         $warnings[] = self::generate_warning($seplmentid, 'couldnotcopyprevioussubmission', $notice);
     }
     return $warnings;
 }