diff --git a/db/access.php b/db/access.php
index 7cff7c6..e5bc9e5 100644
--- a/db/access.php
+++ b/db/access.php
@@ -44,6 +44,7 @@ $capabilities = array(
)
),
+ //is this still necessary?
'enrol/apply:unenrolapply' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -61,6 +62,14 @@ $capabilities = array(
)
),
+ 'enrol/apply:unenrolself' => array(
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_COURSE,
+ 'archetypes' => array(
+ 'student' => CAP_ALLOW,
+ )
+ ),
+
);
diff --git a/lang/en/enrol_apply.php b/lang/en/enrol_apply.php
index a269b09..b1b752a 100644
--- a/lang/en/enrol_apply.php
+++ b/lang/en/enrol_apply.php
@@ -17,7 +17,7 @@ $string['pluginname_desc'] = 'With this plugin users can apply to a course and a
$string['confirmmailsubject'] = 'Confirm mail subject';
$string['confirmmailcontent'] = 'Confirm mail content';
$string['cancelmailsubject'] = 'Cancel mail subject';
-$string['cancelmailcontent'] = 'Cancel mail sontent';
+$string['cancelmailcontent'] = 'Cancel mail content';
$string['confirmmailcontent_desc'] = 'Please use special marks designated email content replaced.
{firstname}:Registration name; {content}:Course name;{lastname}:The last name of the user;{username}:Registration name';
$string['cancelmailcontent_desc'] = 'Please use special marks designated email content replaced.
{firstname}:Registration name; {content}:Course name;{lastname}:The last name of the user;{username}:Registration name';
@@ -37,7 +37,8 @@ $string['confirmenrol'] = 'Manage application';
$string['apply:config'] = 'Configure apply enrol instances';
$string['apply:manage'] = 'Manage apply enrolment';
$string['apply:unenrol'] = 'Cancel users from course';
-$string['apply:unenrolapply'] = 'Cancel self from the course';
+$string['apply:unenrolapply'] = 'Cancel self from the course'; // is this necessary now?
+$string['apply:unenrolself'] = 'Cancel self from the course';
$string['notification'] = 'Enrollment Application successfully sent.
You will be informed by email as soon as your enrollment has been confirmed. If you want to enroll to other courses, please click "course catalogue" in the top menu.';
diff --git a/lang/it/enrol_apply.php b/lang/it/enrol_apply.php
new file mode 100644
index 0000000..055dd51
--- /dev/null
+++ b/lang/it/enrol_apply.php
@@ -0,0 +1,54 @@
+{firstname}:Nome dell\'utente iscritto; {content}:Nome del corso;{lastname}:Cognome dell\'utente;{username}:Nome di registrazione';
+$string['cancelmailcontent_desc'] = 'Potete usare questi marks nella mail.
{firstname}:Nome dell\'utente iscritto; {content}:Nome del corso;{lastname}:Cognome dell\'utente;{username}:Nome di registrazione';
+
+$string['confirmusers'] = 'Conferma dell\'iscrizione';
+
+$string['coursename'] = 'Corso';
+$string['applyuser'] = 'Nome / Cognome';
+$string['applyusermail'] = 'Email';
+$string['applydate'] = 'Data di iscrizione';
+$string['btnconfirm'] = 'Conferma';
+$string['btncancel'] = 'Cancella';
+$string['enrolusers'] = 'Iscrivi utenti';
+
+$string['status'] = 'Permetti la conferma di iscrizione al corso';
+$string['confirmenrol'] = 'Gestisci l\'applicazione';
+
+$string['apply:config'] = 'Configura le istanze del plugin';
+$string['apply:manage'] = 'Gestisci le richieste di iscrizione';
+$string['apply:unenrol'] = 'Cancella gli utenti dal corso';
+$string['apply:unenrolapply'] = 'Permetti all\'utente di disiscriversi dal corso'; // is this necessary now?
+$string['apply:unenrolself'] = 'Permetti all\'utente di disiscriversi dal corso';
+
+$string['notification'] = 'Richiesta di iscrizione al corso correttamente inviata.
Verrai informato via email appena la tua richiesta di iscrizione viene confermata. Se vuoi iscriverti ad altri corsi, premi sul "catalogo dei corsi" sul top menu.';
+
+$string['sendmailtoteacher'] = 'Manda email di notifica agli insegnanti';
+$string['sendmailtomanager'] = 'Manda email di notifica agli amministratori';
+$string['mailtoteacher_suject'] = 'Nuova richiesta di iscrizione!';
+$string['editdescription'] = 'Descrizione area di testo';
+$string['comment'] = 'Commento';
+$string['applymanage'] = 'Gestisci richieste di iscrizione';
+
+$string['status_desc'] = 'Permette l\'accesso al corso agli utenti iscritti internamente.';
+
+?>
\ No newline at end of file
diff --git a/unenrolself.php b/unenrolself.php
new file mode 100644
index 0000000..9130f56
--- /dev/null
+++ b/unenrolself.php
@@ -0,0 +1,61 @@
+.
+
+/**
+ * Self enrolment plugin - support for user self unenrolment.
+ *
+ * @package enrol_self
+ * @copyright 2010 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require('../../config.php');
+
+$enrolid = required_param('enrolid', PARAM_INT);
+$confirm = optional_param('confirm', 0, PARAM_BOOL);
+
+$instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'apply'), '*', MUST_EXIST);
+$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
+$context = context_course::instance($course->id, MUST_EXIST);
+
+require_login();
+if (!is_enrolled($context)) {
+ redirect(new moodle_url('/'));
+}
+require_login($course);
+
+$plugin = enrol_get_plugin('apply');
+
+// Security defined inside following function.
+if (!$plugin->get_unenrolself_link($instance)) {
+ redirect(new moodle_url('/course/view.php', array('id'=>$course->id)));
+}
+
+$PAGE->set_url('/enrol/apply/unenrolself.php', array('enrolid'=>$instance->id));
+$PAGE->set_title($plugin->get_instance_name($instance));
+
+if ($confirm and confirm_sesskey()) {
+ $plugin->unenrol_user($instance, $USER->id);
+ add_to_log($course->id, 'course', 'unenrol', '../enrol/users.php?id='.$course->id, $course->id); //TODO: there should be userid somewhere!
+ redirect(new moodle_url('/index.php'));
+}
+
+echo $OUTPUT->header();
+$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
+$nourl = new moodle_url('/course/view.php', array('id'=>$course->id));
+$message = get_string('unenrolselfconfirm', 'enrol_self', format_string($course->fullname)); //I leave the unenrolselfconfirm message because it fits perfectly
+echo $OUTPUT->confirm($message, $yesurl, $nourl);
+echo $OUTPUT->footer();