public static function revert_submissions_to_draft($assignmentid, $userids) {
        global $CFG;

        $params = self::validate_parameters(self::revert_submissions_to_draft_parameters(),
                        array('assignmentid' => $assignmentid,
                              'userids' => $userids));

        list($assignment, $course, $cm, $context) = self::validate_assign($params['assignmentid']);

        $warnings = array();
        foreach ($params['userids'] as $userid) {
            if (!$assignment->revert_to_draft($userid)) {
                $detail = 'User id: ' . $userid . ', Assignment id: ' . $params['assignmentid'];
                $warnings[] = self::generate_warning($params['assignmentid'],
                                                     'couldnotrevert',
                                                     $detail);
            }
        }

        return $warnings;
    }
public static function revert_submissions_to_draft($assignmentid, $userids) {
        global $CFG;

        $params = self::validate_parameters(self::revert_submissions_to_draft_parameters(),
                        array('assignmentid' => $assignmentid,
                              'userids' => $userids));

        list($assignment, $course, $cm, $context) = self::validate_assign($params['assignmentid']);

        $warnings = array();
        foreach ($params['userids'] as $userid) {
            if (!$assignment->revert_to_draft($userid)) {
                $detail = 'User id: ' . $userid . ', Assignment id: ' . $params['assignmentid'];
                $warnings[] = self::generate_warning($params['assignmentid'],
                                                     'couldnotrevert',
                                                     $detail);
            }
        }

        return $warnings;
    }
public static function revert_submissions_to_draft ( $ assignmentid , $ userids ) { global $ CFG ; $ params = self :: validate_parameters ( self :: revert_submissions_to_draft_parameters ( ) , array ( 'assignmentid' => $ assignmentid , 'userids' => $ userids ) ) ; list ( $ assignment , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignmentid' ] ) ; $ warnings = array ( ) ; foreach ( $ params [ 'userids' ] as $ userid ) { if ( ! $ assignment -> revert_to_draft ( $ userid ) ) { $ detail = 'User id: ' . $ userid . ', Assignment id: ' . $ params [ 'assignmentid' ] ; $ warnings [ ] = self :: generate_warning ( $ params [ 'assignmentid' ] , 'couldnotrevert' , $ detail ) ; } } return $ warnings ; }
Reverts a list of user submissions to draft for a single assignment.

@param int $assignmentid The id of the assignment
@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
Reverts a list of user submissions to draft for a single assignment .