-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdescription_accept.php
More file actions
63 lines (50 loc) · 2.18 KB
/
description_accept.php
File metadata and controls
63 lines (50 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
global $DB;
require_once('../../config.php');
$courseid = required_param('courseid', PARAM_INT);
$blockid = required_param('blockid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
// Ensure we have a valid courseid and can load the associated course object.
if (! $course = $DB->get_record('course', array('id' => $courseid)) ) {
error(get_string('invalidcourse', 'block_pbltool', $courseid));
}
// ensure the user has access to this course
require_login($course);
// ensure the block exits
if (! $block = $DB->get_record("block_instances", array("id" => $blockid))) {
error("Block ID was incorrect or no longer exists");
}
// Ensure the block belongs to the course.
// if ($block->pageid != $courseid) {
// error("Block ID does not belong to course");
// }
require_capability('block/pbltool:managepages', get_context_instance(CONTEXT_COURSE, $courseid));
$record = $DB->get_record('block_pbltool_projects', array('blockid' => $blockid, 'groupid' => $groupid));
$toform->id = $record->id;
$toform->status = 1;
if (!$DB->update_record('block_pbltool_projects', $toform)) {
print_error(get_string('updateerror', 'block_pbltool'));
}
/********* Log Accept Description **********/
$event = \block_pbltool\event\accept_description::create(array(
'objectid' => $blockid,
'context' => $PAGE->context,
'other' => "1 : $groupid",
));
$event->trigger();
/****************************************/
redirect("$CFG->wwwroot/blocks/pbltool/view.php?blockid=$blockid&courseid=$courseid&groupid=$groupid");