Created
July 5, 2021 11:19
-
-
Save andrewnicols/8cf36e5a1967aa7ba57a135c8e78a21b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('CLI_SCRIPT', true); | |
require_once('config.php'); | |
$cmid = 16; | |
$users = [ | |
11, | |
]; | |
require_once($CFG->dirroot . '/mod/assign/locallib.php'); | |
[$course, $cm] = get_course_and_cm_from_cmid($cmid); | |
$context = \context_module::instance($cm->id); | |
$assign = new assign($context, $cm, $course); | |
foreach ($users as $userid) { | |
$user = \core_user::get_user($userid); | |
\core\session\manager::init_empty_session(); | |
\core\session\manager::set_user($user); | |
$notices = []; | |
$assign->submit_for_grading([ | |
'userid' => $user->id, | |
], $notices); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment