Skip to content

Commit 864eff0

Browse files
committed
Relatório de inscritos em cursos de EaD
1 parent b670dad commit 864eff0

13 files changed

+1229
-0
lines changed

report/ilbenrol/action.php

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
// This file is part of Moodle - http://moodle.org/
4+
//
5+
// Moodle is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// Moodle is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17+
18+
/**
19+
* Wrapper script redirecting user operations to correct destination.
20+
*
21+
* @copyright 1999 Martin Dougiamas http://dougiamas.com
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
* @package user
24+
*/
25+
26+
require_once("../../config.php");
27+
require("{$CFG->dirroot}/enrol/locallib.php");
28+
29+
$action = required_param('formaction', PARAM_TEXT);
30+
$id = required_param('id', PARAM_INT);
31+
$users = optional_param_array('user', array(), PARAM_INT);
32+
$returnto = required_param('returnto', PARAM_TEXT);
33+
34+
if (!confirm_sesskey()) {
35+
print_error('confirmsesskeybad');
36+
}
37+
38+
if (count($users) == 0) {
39+
print_error('invalidformdata', '', $returnto);
40+
}
41+
42+
$role_confirmed = get_config(null, 'report_ilbenrol_confirmed');
43+
$role_revoked = get_config(null, 'report_ilbenrol_revoked');
44+
45+
if (!$role_confirmed or !$role_revoked) {
46+
print_error('invalidargorconf');
47+
}
48+
49+
$course = $DB->get_record('course',array('id'=>$id));
50+
51+
if (!$course) {
52+
print_error('invalidcourseid');
53+
}
54+
55+
require_login($course);
56+
57+
$context = context_course::instance($course->id);
58+
$manager = new course_enrolment_manager($PAGE, $course);
59+
$roles = $manager->get_all_roles();
60+
$PAGE->set_heading($course->fullname);
61+
$PAGE->set_url('/user/action.php', array('action'=>$action,'id'=>$id));
62+
$PAGE->set_pagelayout('report');
63+
$PAGE->set_title(get_string('title','report_ilbenrol'));
64+
$PAGE->set_heading($course->fullname);
65+
66+
require_login($course);
67+
require_capability('report/ilbenrol:view',$context);
68+
69+
if (!array_key_exists($role_confirmed, $roles) or !array_key_exists($role_revoked, $roles)) {
70+
print_error('invalidargorconf');
71+
}
72+
73+
echo $OUTPUT->header();
74+
75+
if ($action === 'confirmenrol') {
76+
$from_role = $roles[$role_revoked];
77+
$to_role = $roles[$role_confirmed];
78+
} else if ($action === 'revokeenrol') {
79+
$from_role = $roles[$role_confirmed];
80+
$to_role = $roles[$role_revoked];
81+
} else {
82+
print_error('unknownuseraction');
83+
}
84+
85+
echo "<ul>";
86+
foreach ($users as $userid=>$nothing) {
87+
$user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
88+
echo '<li>' . get_string('changeduser', 'report_ilbenrol', array('user'=>fullname($user), 'from'=>$from_role->localname, 'to'=>$to_role->localname)) . '</li>';
89+
$manager->assign_role_to_user($to_role->id, $user->id);
90+
$manager->unassign_role_from_user($user->id, $from_role->id);
91+
}
92+
93+
echo '</ul><br/>';
94+
95+
echo "<a href=\"{$returnto}\">".get_string('return', 'report_ilbenrol').'</a>';
96+
echo $OUTPUT->footer();

report/ilbenrol/db/access.php

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Capabilities
19+
*
20+
* @package report_progress
21+
* @copyright 2008 Sam Marshall
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
defined('MOODLE_INTERNAL') || die();
26+
27+
$capabilities = array(
28+
29+
'report/ilbenrol:view' => array(
30+
'riskbitmask' => RISK_PERSONAL,
31+
'captype' => 'read',
32+
'contextlevel' => CONTEXT_COURSE,
33+
'archetypes' => array(
34+
'teacher' => CAP_ALLOW,
35+
'editingteacher' => CAP_ALLOW,
36+
'manager' => CAP_ALLOW
37+
),
38+
39+
'clonepermissionsfrom' => 'coursereport/progress:view',
40+
)
41+
);
42+
43+

report/ilbenrol/db/install.php

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Post installation and migration code.
19+
*
20+
* @package report
21+
* @subpackage progress
22+
* @copyright 2011 Petr Skoda {@link http://skodak.org}
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
defined('MOODLE_INTERNAL') || die;
27+
28+
function xmldb_report_ilbenrol_install() {
29+
global $DB;
30+
31+
}
32+

0 commit comments

Comments
 (0)