Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
CCLE-4304 - Open source Site invitation
Browse files Browse the repository at this point in the history
* Fixing Moodle 2.5 specific form logic.
* Reworked version numbers so that they are aligned with the UCLA specific branch.
* Fixed form warnings.
  • Loading branch information
rlorenzo committed Oct 31, 2013
1 parent 588ebee commit 344da7b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
12 changes: 6 additions & 6 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function xmldb_enrol_invitation_upgrade($oldversion) {

// Add roleid, timeexpiration, added foreign keys and indexes and fixed
// some default values.
if ($oldversion < 2013062500) {
if ($oldversion < 2013030100) {
$table = new xmldb_table('enrol_invitation');

// Add fields.
Expand Down Expand Up @@ -163,12 +163,12 @@ function xmldb_enrol_invitation_upgrade($oldversion) {
}

// Invitation savepoint reached.
upgrade_plugin_savepoint(true, 2013062500, 'enrol', 'invitation');
upgrade_plugin_savepoint(true, 2013030100, 'enrol', 'invitation');
}

// Rename creatorid to inviterid & add subject, message, notify_inviter,
// show_from_email columns.
if ($oldversion < 2013062501) {
if ($oldversion < 2013030101) {
$table = new xmldb_table('enrol_invitation');

// 1) Rename creatorid to inviterid.
Expand Down Expand Up @@ -201,11 +201,11 @@ function xmldb_enrol_invitation_upgrade($oldversion) {
}

// Invitation savepoint reached.
upgrade_plugin_savepoint(true, 2013062501, 'enrol', 'invitation');
upgrade_plugin_savepoint(true, 2013030101, 'enrol', 'invitation');
}

// Fix role_assignments to include enrol_invitation.
if ($oldversion < 2013062502) {
if ($oldversion < 2013030102) {
/**
* Go through each accepted invite and look for an entry in
* role_assignments with component set to "" and userid, roleid, and
Expand Down Expand Up @@ -256,7 +256,7 @@ function xmldb_enrol_invitation_upgrade($oldversion) {
}

// Invitation savepoint reached.
upgrade_plugin_savepoint(true, 2013062502, 'enrol', 'invitation');
upgrade_plugin_savepoint(true, 2013030102, 'enrol', 'invitation');
}

return true;
Expand Down
3 changes: 3 additions & 0 deletions edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ public function definition() {
$mform->addElement('header', 'header', get_string('pluginname', 'enrol_invitation'));

$mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
$mform->setType('name', PARAM_TEXT);

$options = array(ENROL_INSTANCE_ENABLED => get_string('yes'),
ENROL_INSTANCE_DISABLED => get_string('no'));
$mform->addElement('select', 'status', get_string('status', 'enrol_invitation'), $options);
$mform->setDefault('status', $plugin->get_config('status'));
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'courseid');
$mform->setType('courseid', PARAM_INT);

$this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol')));

Expand Down
6 changes: 4 additions & 2 deletions invitation_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public function definition() {
global $CFG, $DB, $USER;
$mform = & $this->_form;

// Get rid of "Collapse all".
$mform->setDisableShortforms(true);
// Get rid of "Collapse all" in Moodle 2.5+.
if (method_exists($mform, 'setDisableShortforms')) {
$mform->setDisableShortforms(true);
}

// Add some hidden fields.
$course = $this->_customdata['course'];
Expand Down
6 changes: 3 additions & 3 deletions lang/en/enrol_invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
{$a->userfullname} ({$a->useremail}) has accepted your invitation to access {$a->coursefullname} as a "{$a->rolename}". You can verify the status of this invitation by viewing either:
* the participant list for : {$a->courseenrolledusersurl}
* your site invitation history: {$a->invitehistoryurl}
* Participant list: {$a->courseenrolledusersurl}
* Invitation history: {$a->invitehistoryurl}
{$a->sitename}
-------------
Expand Down Expand Up @@ -120,7 +120,7 @@
$string['email_clarification'] = 'You may specify multiple email addresses by separating
them with semi-colons, commas, spaces, or new lines';
$string['subject'] = 'Subject';
$string['status'] = 'Allow site invitations';
$string['status'] = 'Allow invitations';
$string['status_desc'] = 'Allow users to invite people to enroll into a course by default.';
$string['unenrol'] = 'Unenroll user';
$string['unenroluser'] = 'Do you really want to unenroll "{$a->user}" from course "{$a->course}"?';
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2013062500;
$plugin->requires = 2011070100; // Requires Moodle 2.1 or later.
$plugin->version = 2013030102;
$plugin->requires = 2011120500; // Requires Moodle 2.2 or later
$plugin->maturity = MATURITY_RC;

0 comments on commit 344da7b

Please sign in to comment.