mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-40241_master' of https://github.com/dmonllao/moodle
This commit is contained in:
commit
7b58b245bf
6 changed files with 82 additions and 12 deletions
|
@ -19,6 +19,9 @@
|
|||
* Toggles the manual completion flag for a particular activity or course completion
|
||||
* and the current user.
|
||||
*
|
||||
* If by student params: course=2
|
||||
* If by manager params: course=2&user=4&rolec=3&sesskey=ghfgsdf
|
||||
*
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package course
|
||||
*/
|
||||
|
@ -31,6 +34,10 @@ $cmid = optional_param('id', 0, PARAM_INT);
|
|||
$courseid = optional_param('course', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
// Check if we are marking a user complete via the completion report.
|
||||
$user = optional_param('user', 0, PARAM_INT);
|
||||
$rolec = optional_param('rolec', 0, PARAM_INT);
|
||||
|
||||
if (!$cmid && !$courseid) {
|
||||
print_error('invalidarguments');
|
||||
}
|
||||
|
@ -45,16 +52,14 @@ if ($courseid) {
|
|||
require_login($course);
|
||||
|
||||
$completion = new completion_info($course);
|
||||
$trackeduser = ($user ? $user : $USER->id);
|
||||
|
||||
if (!$completion->is_enabled()) {
|
||||
throw new moodle_exception('completionnotenabled', 'completion');
|
||||
} elseif (!$completion->is_tracked_user($USER->id)) {
|
||||
} else if (!$completion->is_tracked_user($trackeduser)) {
|
||||
throw new moodle_exception('nottracked', 'completion');
|
||||
}
|
||||
|
||||
// Check if we are marking a user complete via the completion report
|
||||
$user = optional_param('user', 0, PARAM_INT);
|
||||
$rolec = optional_param('rolec', 0, PARAM_INT);
|
||||
|
||||
if ($user && $rolec) {
|
||||
require_sesskey();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue