Browse Source

Merge pull request #1 from emeneo/master

update
develop_fields
Flotter Totte 10 years ago
parent
commit
31a486374f
  1. 9
      db/access.php
  2. 5
      lang/en/enrol_apply.php
  3. 54
      lang/it/enrol_apply.php
  4. 61
      unenrolself.php

9
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,
)
),
);

5
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.<br>{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.<br>{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'] = '<b>Enrollment Application successfully sent</b>. <br/><br/>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.';

54
lang/it/enrol_apply.php

@ -0,0 +1,54 @@
<?php
/**
* *************************************************************************
* * Apply Enrol **
* *************************************************************************
* @copyright emeneo.com **
* @link emeneo.com **
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **
* *************************************************************************
* ************************************************************************
*/
// The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Conferma di iscrizione al corso';
$string['pluginname'] = 'Conferma di iscrizione al corso';
$string['pluginname_desc'] = 'Con questo plugin gli utenti possono far richiesta di iscriversi al corso e verranno inseriti solo previa conferma da parte del docente';
$string['confirmmailsubject'] = 'Oggetto mail di conferma';
$string['confirmmailcontent'] = 'Contenuto mail di conferma';
$string['cancelmailsubject'] = 'Oggetto mail di cancellazione';
$string['cancelmailcontent'] = 'Contenuto mail di cancellazione';
$string['confirmmailcontent_desc'] = 'Potete usare questi marks nella mail.<br>{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.<br>{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'] = '<b>Richiesta di iscrizione al corso correttamente inviata</b>. <br/><br/>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.';
?>

61
unenrolself.php

@ -0,0 +1,61 @@
<?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/>.
/**
* 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();
Loading…
Cancel
Save