/**
  * Submit the logged in users seplment for grading.
  *
  * @param int $seplmentid The id of the seplment
  * @return array of warnings to indicate any errors.
  * @since Moodle 2.6
  */
 public static function submit_for_grading($seplmentid, $acceptsubmissionstatement)
 {
     global $CFG, $USER;
     require_once "{$CFG->dirroot}/mod/sepl/locallib.php";
     $params = self::validate_parameters(self::submit_for_grading_parameters(), array('seplmentid' => $seplmentid, 'acceptsubmissionstatement' => $acceptsubmissionstatement));
     $cm = get_coursemodule_from_instance('sepl', $params['seplmentid'], 0, false, MUST_EXIST);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     $seplment = new sepl($context, $cm, null);
     $warnings = array();
     $data = new stdClass();
     $data->submissionstatement = $params['acceptsubmissionstatement'];
     $notices = array();
     if (!$seplment->submit_for_grading($data, $notices)) {
         $detail = 'User id: ' . $USER->id . ', Assignment id: ' . $params['seplmentid'] . ' Notices:' . implode(', ', $notices);
         $warnings[] = self::generate_warning($params['seplmentid'], 'couldnotsubmitforgrading', $detail);
     }
     return $warnings;
 }