Skip to content

Commit 207ccc4

Browse files
committed
Adição de métodos de inscrição
1 parent b133d4c commit 207ccc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+5133
-0
lines changed

enrol/ilbead/cli/sync.php

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
* CLI update for self ilb ead enrolments, use for debugging or immediate update
19+
* of all courses.
20+
*
21+
* Notes:
22+
* - it is required to use the web server account when executing PHP CLI scripts
23+
* - you need to change the "www-data" to match the apache user account
24+
* - use "su" if "sudo" not available
25+
*
26+
* @package enrol_ilbead
27+
* @copyright 2012 Petr Skoda {@link http://skodak.org}
28+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29+
*/
30+
31+
define('CLI_SCRIPT', true);
32+
33+
require(__DIR__.'/../../../config.php');
34+
require_once("$CFG->libdir/clilib.php");
35+
36+
// Now get cli options.
37+
list($options, $unrecognized) = cli_get_params(array('verbose'=>false, 'help'=>false), array('v'=>'verbose', 'h'=>'help'));
38+
39+
if ($unrecognized) {
40+
$unrecognized = implode("\n ", $unrecognized);
41+
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
42+
}
43+
44+
if ($options['help']) {
45+
echo "Execute self ilb ead course enrol updates.
46+
47+
Options:
48+
-v, --verbose Print verbose progress information
49+
-h, --help Print out this help
50+
51+
Example:
52+
\$ sudo -u www-data /usr/bin/php enrol/ilbead/cli/sync.php
53+
";
54+
die;
55+
}
56+
57+
if (!enrol_is_enabled('ilbead')) {
58+
cli_error('enrol_ilbead plugin is disabled, synchronisation stopped', 2);
59+
}
60+
61+
if (empty($options['verbose'])) {
62+
$trace = new null_progress_trace();
63+
} else {
64+
$trace = new text_progress_trace();
65+
}
66+
67+
/** @var $plugin enrol_ilbead_plugin */
68+
$plugin = enrol_get_plugin('ilbead');
69+
70+
$result = $plugin->sync($trace, null);
71+
$plugin->send_expiry_notifications($trace);
72+
73+
exit($result);

enrol/ilbead/db/access.php

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 for self ilb ead enrolment plugin.
19+
*
20+
* @package enrol_ilbead
21+
* @copyright 2010 Petr Skoda {@link http://skodak.org}
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+
/* Add or edit enrol-ilbead instance in course. */
30+
'enrol/ilbead:config' => array(
31+
32+
'captype' => 'write',
33+
'contextlevel' => CONTEXT_COURSE,
34+
'archetypes' => array(
35+
'editingteacher' => CAP_ALLOW,
36+
'manager' => CAP_ALLOW,
37+
)
38+
),
39+
40+
/* Manage user ilb ead self-enrolments. */
41+
'enrol/ilbead:manage' => array(
42+
43+
'captype' => 'write',
44+
'contextlevel' => CONTEXT_COURSE,
45+
'archetypes' => array(
46+
'editingteacher' => CAP_ALLOW,
47+
'manager' => CAP_ALLOW,
48+
)
49+
),
50+
51+
/* Voluntarily unenrol self from ilb ead course - watch out for data loss. */
52+
'enrol/ilbead:unenrolself' => array(
53+
'captype' => 'write',
54+
'contextlevel' => CONTEXT_COURSE,
55+
'archetypes' => array(
56+
'student' => CAP_ALLOW,
57+
)
58+
),
59+
60+
/* Unenrol anybody from course (including self) - watch out for data loss. */
61+
'enrol/ilbead:unenrol' => array(
62+
'captype' => 'write',
63+
'contextlevel' => CONTEXT_COURSE,
64+
'archetypes' => array(
65+
'editingteacher' => CAP_ALLOW,
66+
'manager' => CAP_ALLOW,
67+
)
68+
),
69+
70+
);

enrol/ilbead/db/install.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
* Self enrol plugin installation script
19+
*
20+
* @package enrol_ilbead
21+
* @copyright 2010 Petr Skoda {@link http://skodak.org}
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
defined('MOODLE_INTERNAL') || die();
25+
26+
function xmldb_enrol_ilbead_install() {
27+
global $CFG, $DB;
28+
29+
}

enrol/ilbead/db/messages.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
* Defines message providers for self ilb ead enrolments.
19+
*
20+
* @package enrol_ilbead
21+
* @copyright 2012 Petr Skoda {@link http://skodak.org}
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
$messageproviders = array (
26+
27+
'expiry_notification' => array(),
28+
29+
);

enrol/ilbead/db/upgrade.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
* This file keeps track of upgrades to the self ilb ead enrolment plugin
19+
*
20+
* @package enrol_ilbead
21+
* @copyright 2012 Petr Skoda {@link http://skodak.org
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
defined('MOODLE_INTERNAL') || die();
26+
27+
function xmldb_enrol_ilbead_upgrade($oldversion) {
28+
global $CFG, $DB, $OUTPUT;
29+
30+
$dbman = $DB->get_manager();
31+
32+
// Moodle v2.3.0 release upgrade line
33+
// Put any upgrade step following this
34+
35+
if ($oldversion < 2012101400) {
36+
// Set default expiry threshold to 1 day.
37+
$DB->execute("UPDATE {enrol} SET expirythreshold = 86400 WHERE enrol = 'ilbead' AND expirythreshold = 0");
38+
upgrade_plugin_savepoint(true, 2012101400, 'enrol', 'ilbead');
39+
}
40+
41+
if ($oldversion < 2012120600) {
42+
// Enable new self ilb ead enrolments everywhere.
43+
$DB->execute("UPDATE {enrol} SET customint6 = 1 WHERE enrol = 'ilbead'");
44+
upgrade_plugin_savepoint(true, 2012120600, 'enrol', 'ilbead');
45+
}
46+
47+
48+
// Moodle v2.4.0 release upgrade line
49+
// Put any upgrade step following this
50+
51+
52+
// Moodle v2.5.0 release upgrade line.
53+
// Put any upgrade step following this.
54+
if ($oldversion < 2013050101) {
55+
// Set customint1 (group enrolment key) to 0 if it was not set (null).
56+
$DB->execute("UPDATE {enrol} SET customint1 = 0 WHERE enrol = 'ilbead' AND customint1 IS NULL");
57+
upgrade_plugin_savepoint(true, 2013050101, 'enrol', 'ilbead');
58+
}
59+
60+
61+
return true;
62+
}
63+
64+

0 commit comments

Comments
 (0)