/**
  * Reverts a list of user submissions to draft for a single seplment.
  *
  * @param int $seplmentid The id of the seplment
  * @param array $userids Array of user ids to revert
  * @return array of warnings for each submission that could not be reverted.
  * @since Moodle 2.6
  */
 public static function revert_submissions_to_draft($seplmentid, $userids)
 {
     global $CFG;
     require_once "{$CFG->dirroot}/mod/sepl/locallib.php";
     $params = self::validate_parameters(self::revert_submissions_to_draft_parameters(), array('seplmentid' => $seplmentid, 'userids' => $userids));
     $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();
     foreach ($params['userids'] as $userid) {
         if (!$seplment->revert_to_draft($userid)) {
             $detail = 'User id: ' . $userid . ', Assignment id: ' . $params['seplmentid'];
             $warnings[] = self::generate_warning($params['seplmentid'], 'couldnotrevert', $detail);
         }
     }
     return $warnings;
 }