/** * Locks (prevent updates to) submissions in this setaskment. * * @param int $setaskmentid The id of the setaskment * @param array $userids Array of user ids to lock * @return array of warnings for each submission that could not be locked. * @since Moodle 2.6 */ public static function unlock_submissions($setaskmentid, $userids) { global $CFG; require_once "{$CFG->dirroot}/mod/setask/locallib.php"; $params = self::validate_parameters(self::unlock_submissions_parameters(), array('setaskmentid' => $setaskmentid, 'userids' => $userids)); $cm = get_coursemodule_from_instance('setask', $params['setaskmentid'], 0, false, MUST_EXIST); $context = context_module::instance($cm->id); self::validate_context($context); $setaskment = new setask($context, $cm, null); $warnings = array(); foreach ($params['userids'] as $userid) { if (!$setaskment->unlock_submission($userid)) { $detail = 'User id: ' . $userid . ', Assignment id: ' . $params['setaskmentid']; $warnings[] = self::generate_warning($params['setaskmentid'], 'couldnotunlock', $detail); } } return $warnings; }