Browse Source

Format code (code checker)

SABERES_37_STABLE
Johannes Burk 9 years ago
parent
commit
fbb31ec2a0
  1. 2
      apply_form.php
  2. 3
      db/access.php
  3. 16
      edit.php
  4. 2
      edit_form.php
  5. 35
      lang/ca/enrol_apply.php
  6. 28
      lang/de/enrol_apply.php
  7. 32
      lang/en/enrol_apply.php
  8. 28
      lang/en_us/en_us_enrol_apply.php
  9. 41
      lang/es/enrol_apply.php
  10. 29
      lang/it/enrol_apply.php
  11. 43
      lang/pt_br/enrol_apply.php
  12. 29
      lang/zh_cn/enrol_apply.php
  13. 67
      lib.php
  14. 6
      manage.php
  15. 15
      manage_table.php
  16. 24
      renderer.php
  17. 10
      settings.php
  18. 3
      unenrolself.php

2
apply_form.php

@ -56,7 +56,7 @@ class enrol_apply_apply_form extends moodleform {
$mform->addElement('textarea', 'applydescription', get_string('comment', 'enrol_apply'), 'cols="80"'); $mform->addElement('textarea', 'applydescription', get_string('comment', 'enrol_apply'), 'cols="80"');
$mform->setType('applydescription', PARAM_TEXT); $mform->setType('applydescription', PARAM_TEXT);
//user profile // User profile...
$editoroptions = $filemanageroptions = null; $editoroptions = $filemanageroptions = null;
if ($instance->customint1) { if ($instance->customint1) {

3
db/access.php

@ -36,8 +36,7 @@ $capabilities = array(
) )
), ),
/** /* Enrolment approval.
* Enrolment approval.
* If granted on CONTEXT_SYSTEM level it allows approval for all courses * If granted on CONTEXT_SYSTEM level it allows approval for all courses
* at Site Administration -> Courses -> Manage enrolment applications. * at Site Administration -> Courses -> Manage enrolment applications.
*/ */

16
edit.php

@ -26,9 +26,9 @@ require('../../config.php');
require_once('edit_form.php'); require_once('edit_form.php');
$courseid = required_param('courseid', PARAM_INT); $courseid = required_param('courseid', PARAM_INT);
$instanceid = optional_param('id', 0, PARAM_INT); // instanceid $instanceid = optional_param('id', 0, PARAM_INT);
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST); $course = get_course($courseid);
$context = context_course::instance($course->id, MUST_EXIST); $context = context_course::instance($course->id, MUST_EXIST);
require_login($course); require_login($course);
@ -45,17 +45,23 @@ if (!enrol_is_enabled('apply')) {
$plugin = enrol_get_plugin('apply'); $plugin = enrol_get_plugin('apply');
if ($instanceid) { if ($instanceid) {
$instance = $DB->get_record('enrol', array('courseid'=>$course->id, 'enrol'=>'apply', 'id'=>$instanceid), '*', MUST_EXIST); $instance = $DB->get_record(
'enrol',
array(
'courseid' => $course->id,
'enrol' => 'apply',
'id' => $instanceid),
'*', MUST_EXIST);
} else { } else {
require_capability('moodle/course:enrolconfig', $context); require_capability('moodle/course:enrolconfig', $context);
// no instance yet, we have to add new instance // No instance yet, we have to add new instance.
navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id' => $course->id))); navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id' => $course->id)));
$instance = (object)$plugin->get_instance_defaults(); $instance = (object)$plugin->get_instance_defaults();
$instance->id = null; $instance->id = null;
$instance->courseid = $course->id; $instance->courseid = $course->id;
} }
$mform = new enrol_apply_edit_form(NULL, array($instance, $plugin, $context)); $mform = new enrol_apply_edit_form(null, array($instance, $plugin, $context));
if ($mform->is_cancelled()) { if ($mform->is_cancelled()) {
redirect($return); redirect($return);

2
edit_form.php

@ -28,7 +28,7 @@ require_once($CFG->libdir.'/formslib.php');
class enrol_apply_edit_form extends moodleform { class enrol_apply_edit_form extends moodleform {
function definition() { protected function definition() {
$mform = $this->_form; $mform = $this->_form;
list($instance, $plugin, $context) = $this->_customdata; list($instance, $plugin, $context) = $this->_customdata;

35
lang/ca/enrol_apply.php

@ -1,14 +1,25 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @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. // The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Inscripció prèvia aprovació'; $string['enrolname'] = 'Inscripció prèvia aprovació';
$string['pluginname'] = 'Inscripció prèvia aprovació'; $string['pluginname'] = 'Inscripció prèvia aprovació';
@ -34,9 +45,9 @@ $string['enrolusers'] = 'Inscriure usuaris';
$string['status'] = 'Permet inscripció prèvia aprovació'; $string['status'] = 'Permet inscripció prèvia aprovació';
$string['confirmenrol'] = 'Gestionar sol·licituds'; $string['confirmenrol'] = 'Gestionar sol·licituds';
$string['apply:config'] = 'Configurar instàncies d\'Inscripció prèvia aprovació'; // Needs more insight $string['apply:config'] = 'Configurar instàncies d\'Inscripció prèvia aprovació'; // Needs more insight.
$string['apply:manageapplications'] = 'Gestionar la Inscripció prèvia aprovació'; // Needs more insight $string['apply:manageapplications'] = 'Gestionar la Inscripció prèvia aprovació'; // Needs more insight.
$string['apply:unenrol'] = 'Cancel·lar usuaris del curs'; // Needs more insight $string['apply:unenrol'] = 'Cancel·lar usuaris del curs'; // Needs more insight.
$string['notification'] = '<b>Sol·licitud d\'inscripció enviada correctament</b>. <br/><br/>Rebràs una notificació per correu electrònic un cop estigui confirmada la inscripció.'; $string['notification'] = '<b>Sol·licitud d\'inscripció enviada correctament</b>. <br/><br/>Rebràs una notificació per correu electrònic un cop estigui confirmada la inscripció.';
@ -48,5 +59,3 @@ $string['comment'] = 'Comentari';
$string['applymanage'] = 'Gestionar inscripcions'; $string['applymanage'] = 'Gestionar inscripcions';
$string['status_desc'] = 'Allow course access of internally enrolled users.'; $string['status_desc'] = 'Allow course access of internally enrolled users.';
?>

28
lang/de/enrol_apply.php

@ -1,14 +1,25 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @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. // The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Bestätigung der Kurseinschreibung'; $string['enrolname'] = 'Bestätigung der Kurseinschreibung';
$string['pluginname'] = 'Bestätigung der Kurseinschreibung'; $string['pluginname'] = 'Bestätigung der Kurseinschreibung';
@ -51,4 +62,3 @@ $string['editdescription'] = 'Beschreibung anpassen';
$string['applymanage'] = 'Manage enrolment applications'; $string['applymanage'] = 'Manage enrolment applications';
$string['status_desc'] = 'Kurszugriff für intern eingeschriebene Nutzer/innen erlauben.'; $string['status_desc'] = 'Kurszugriff für intern eingeschriebene Nutzer/innen erlauben.';
?>

32
lang/en/enrol_apply.php

@ -1,14 +1,27 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright emeneo.com ** * @author emeneo.com (http://emeneo.com/)
* @link emeneo.com ** * @author Johannes Burk <johannes.burk@sudile.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **
* *************************************************************************
* ************************************************************************
*/ */
// The name of your plug-in. Displayed on admin menus. // The name of your plug-in. Displayed on admin menus.
$string['enrolname'] = 'Course enrol confirmation'; $string['enrolname'] = 'Course enrol confirmation';
$string['pluginname'] = 'Course enrol confirmation'; $string['pluginname'] = 'Course enrol confirmation';
@ -60,10 +73,8 @@ $string['apply:manageapplications'] = 'Manage apply enrolment';
$string['apply:unenrol'] = 'Cancel users from the course'; $string['apply:unenrol'] = 'Cancel users from the course';
$string['apply:unenrolself'] = 'Cancel self from the course'; $string['apply:unenrolself'] = 'Cancel self from the course';
$string['notification'] = '<b>Enrolment application successfully sent</b>. <br/><br/>You will be informed by email when your enrolment has been confirmed.'; $string['notification'] = '<b>Enrolment application successfully sent</b>. <br/><br/>You will be informed by email when your enrolment has been confirmed.';
$string['mailtoteacher_suject'] = 'New Enrolment request!'; $string['mailtoteacher_suject'] = 'New Enrolment request!';
$string['editdescription'] = 'Textarea description'; $string['editdescription'] = 'Textarea description';
$string['comment'] = 'Comment'; $string['comment'] = 'Comment';
@ -74,4 +85,3 @@ $string['user_profile'] = 'User Profile';
$string['show_standard_user_profile'] = 'Show standard user profile fields on enrolment screen'; $string['show_standard_user_profile'] = 'Show standard user profile fields on enrolment screen';
$string['show_extra_user_profile'] = 'Show extra user profile fields on enrolment screen'; $string['show_extra_user_profile'] = 'Show extra user profile fields on enrolment screen';
?>

28
lang/en_us/en_us_enrol_apply.php

@ -1,14 +1,25 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright emeneo.com **
* @link emeneo.com **
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **
* *************************************************************************
* ************************************************************************
*/ */
// The name of your plug-in. Displayed on admin menus. // The name of your plug-in. Displayed on admin menus.
$string['enrollname'] = 'Course enrollment confirmation'; $string['enrollname'] = 'Course enrollment confirmation';
$string['pluginname'] = 'Course enrollment confirmation'; $string['pluginname'] = 'Course enrollment confirmation';
@ -49,4 +60,3 @@ $string['comment'] = 'Comment';
$string['applymanage'] = 'Manage enrollment applications'; $string['applymanage'] = 'Manage enrollment applications';
$string['status_desc'] = 'Allow course access of internally enrolled users.'; $string['status_desc'] = 'Allow course access of internally enrolled users.';
?>

41
lang/es/enrol_apply.php

@ -1,18 +1,29 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @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. // The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Matrículas solicitadas'; $string['enrolname'] = 'Matrículas solicitadas';
$string['pluginname'] = 'Matrículas solicitadas'; $string['pluginname'] = 'Matrículas solicitadas';
$string['pluginname_desc'] = 'With this plugin users can apply to a course and a teacher have to comfirm before the user gets enroled.'; // needs to be translated $string['pluginname_desc'] = 'With this plugin users can apply to a course and a teacher have to comfirm before the user gets enroled.'; // Needs to be translated.
$string['confirmmailsubject'] = 'Asunto del correo de confirmación'; $string['confirmmailsubject'] = 'Asunto del correo de confirmación';
$string['confirmmailcontent'] = 'Contenido del correo de confirmación'; $string['confirmmailcontent'] = 'Contenido del correo de confirmación';
@ -26,7 +37,7 @@ $string['confirmusers'] = 'Confirmar matrículas';
$string['coursename'] = 'Curso'; $string['coursename'] = 'Curso';
$string['applyuser'] = 'Nombre / Apellido'; $string['applyuser'] = 'Nombre / Apellido';
$string['applyusermail'] = 'Correo electrónico'; $string['applyusermail'] = 'Correo electrónico';
$string['applydate'] = 'Fecha de solicitud'; // Enrol date -> Fecha de matriculación $string['applydate'] = 'Fecha de solicitud'; // Enrol date -> Fecha de matriculación.
$string['btnconfirm'] = 'Confirmar'; $string['btnconfirm'] = 'Confirmar';
$string['btncancel'] = 'Cancelar'; $string['btncancel'] = 'Cancelar';
$string['enrolusers'] = 'Matricular usuarios'; $string['enrolusers'] = 'Matricular usuarios';
@ -34,9 +45,9 @@ $string['enrolusers'] = 'Matricular usuarios';
$string['status'] = 'Aceptar matriculación tras aprobación'; $string['status'] = 'Aceptar matriculación tras aprobación';
$string['confirmenrol'] = 'Gestionar solicitudes'; $string['confirmenrol'] = 'Gestionar solicitudes';
$string['apply:config'] = 'Configurar instancias de matrículas solicitadas'; // Needs more insight $string['apply:config'] = 'Configurar instancias de matrículas solicitadas'; // Needs more insight.
$string['apply:manageapplications'] = 'Gestionar matrículas solicitadas'; // Needs more insight $string['apply:manageapplications'] = 'Gestionar matrículas solicitadas'; // Needs more insight.
$string['apply:unenrol'] = 'Cancelar usuarios del curso'; // Needs more insight $string['apply:unenrol'] = 'Cancelar usuarios del curso'; // Needs more insight.
$string['notification'] = '<b>Solicitud de matriculación enviada correctamente</b>. <br/><br/>Será notificado por correo electrónico en cuanto se confirme su matriculación.'; $string['notification'] = '<b>Solicitud de matriculación enviada correctamente</b>. <br/><br/>Será notificado por correo electrónico en cuanto se confirme su matriculación.';
@ -47,6 +58,4 @@ $string['editdescription'] = 'Descripción del área de texto';
$string['comment'] = 'Comentario'; $string['comment'] = 'Comentario';
$string['applymanage'] = 'Gestionar matrículas'; $string['applymanage'] = 'Gestionar matrículas';
$string['status_desc'] = 'Allow course access of internally enrolled users.'; // needs to be translated $string['status_desc'] = 'Allow course access of internally enrolled users.'; // Needs to be translated.
?>

29
lang/it/enrol_apply.php

@ -1,14 +1,25 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @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. // The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Conferma di iscrizione al corso'; $string['enrolname'] = 'Conferma di iscrizione al corso';
$string['pluginname'] = 'Conferma di iscrizione al corso'; $string['pluginname'] = 'Conferma di iscrizione al corso';
@ -49,5 +60,3 @@ $string['comment'] = 'Commento';
$string['applymanage'] = 'Gestisci richieste di iscrizione'; $string['applymanage'] = 'Gestisci richieste di iscrizione';
$string['status_desc'] = 'Permette l\'accesso al corso agli utenti iscritti internamente.'; $string['status_desc'] = 'Permette l\'accesso al corso agli utenti iscritti internamente.';
?>

43
lang/pt_br/enrol_apply.php

@ -1,18 +1,29 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @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. // The name of your plugin. Displayed on admin menus.
$string['enrolname'] = 'Matrículas solicitadas'; $string['enrolname'] = 'Matrículas solicitadas';
$string['pluginname'] = 'Matrículas solicitadas'; $string['pluginname'] = 'Matrículas solicitadas';
$string['pluginname_desc'] = 'With this plugin users can apply to a course and a teacher have to comfirm before the user gets enroled.'; // needs to be translated $string['pluginname_desc'] = 'With this plugin users can apply to a course and a teacher have to comfirm before the user gets enroled.'; // Needs to be translated.
$string['confirmmailsubject'] = 'Assunto do e-mail de confirmação'; $string['confirmmailsubject'] = 'Assunto do e-mail de confirmação';
$string['confirmmailcontent'] = 'Conteúdo do e-mail de confirmação'; $string['confirmmailcontent'] = 'Conteúdo do e-mail de confirmação';
@ -26,7 +37,7 @@ $string['confirmusers'] = 'Confirmar matrículas';
$string['coursename'] = 'Curso'; $string['coursename'] = 'Curso';
$string['applyuser'] = 'Nome / Sobrenome'; $string['applyuser'] = 'Nome / Sobrenome';
$string['applyusermail'] = 'E-mail'; $string['applyusermail'] = 'E-mail';
$string['applydate'] = 'Data de solicitação'; // Enrol date -> Fecha de matriculación $string['applydate'] = 'Data de solicitação'; // Enrol date -> Fecha de matriculación.
$string['btnconfirm'] = 'Confirmar'; $string['btnconfirm'] = 'Confirmar';
$string['btncancel'] = 'Cancelar'; $string['btncancel'] = 'Cancelar';
$string['enrolusers'] = 'Matricular usuários'; $string['enrolusers'] = 'Matricular usuários';
@ -34,17 +45,15 @@ $string['enrolusers'] = 'Matricular usuários';
$string['status'] = 'Aceitar matrícula após aprovação'; $string['status'] = 'Aceitar matrícula após aprovação';
$string['confirmenrol'] = 'Gerenciar solicitações'; $string['confirmenrol'] = 'Gerenciar solicitações';
$string['apply:config'] = 'Configurar instâncias de matrículas solicitadas'; // Needs more insight $string['apply:config'] = 'Configurar instâncias de matrículas solicitadas'; // Needs more insight.
$string['apply:manageapplications'] = 'Gerenciar matrículas solicitadas'; // Needs more insight $string['apply:manageapplications'] = 'Gerenciar matrículas solicitadas'; // Needs more insight.
$string['apply:unenrol'] = 'Cancelar usuários do curso'; // Needs more insight $string['apply:unenrol'] = 'Cancelar usuários do curso'; // Needs more insight.
$string['notification'] = '<b>Solicitação de matrícula enviada com sucesso</b>. <br/><br/>Você será notificado por e-mail quando a sua matrícula for confirmada.'; $string['notification'] = '<b>Solicitação de matrícula enviada com sucesso</b>. <br/><br/>Você será notificado por e-mail quando a sua matrícula for confirmada.';
$string['sendmailtoteacher'] = 'Enviar e-mail de notificação para professores'; $string['sendmailtoteacher'] = 'Enviar e-mail de notificação para professores';
$string['mailtoteacher_suject'] = 'Nova solicitação de inscrição!'; $string['mailtoteacher_suject'] = 'Nova solicitação de inscrição!';
$string['editdescription'] = 'Descrição'; $string['editdescription'] = 'Descrição';
$string['applymanage'] = 'Manage enrolment applications'; // needs to be translated $string['applymanage'] = 'Manage enrolment applications'; // Needs to be translated.
$string['status_desc'] = 'Allow course access of internally enrolled users.'; // needs to be translated
?> $string['status_desc'] = 'Allow course access of internally enrolled users.'; // Needs to be translated.

29
lang/zh_cn/enrol_apply.php

@ -1,14 +1,25 @@
<?php <?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/>.
/** /**
* ************************************************************************* * @package enrol_apply
* * Apply Enrol ** * @copyright emeneo.com (http://emeneo.com/)
* ************************************************************************* * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright emeneo.com **
* @link emeneo.com **
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **
* *************************************************************************
* ************************************************************************
*/ */
// The name of your plug-in. Displayed on admin menus. // The name of your plug-in. Displayed on admin menus.
$string['enrolname'] = '选课确认'; $string['enrolname'] = '选课确认';
$string['pluginname'] = '选课确认'; $string['pluginname'] = '选课确认';
@ -39,7 +50,6 @@ $string['apply:manageapplications'] = '管理选课申请';
$string['apply:unenrol'] = '从课程中取消用户的选课'; $string['apply:unenrol'] = '从课程中取消用户的选课';
$string['apply:unenrolself'] = '从课程中取消自身的选课'; $string['apply:unenrolself'] = '从课程中取消自身的选课';
$string['notification'] = '<b>选课申请已发送成功</b><br/><br/>申请通过后您会收到邮件通知。'; $string['notification'] = '<b>选课申请已发送成功</b><br/><br/>申请通过后您会收到邮件通知。';
$string['sendmailtoteacher'] = '向教师发送邮件通知'; $string['sendmailtoteacher'] = '向教师发送邮件通知';
@ -50,4 +60,3 @@ $string['comment'] = '评论';
$string['applymanage'] = '管理选课申请'; $string['applymanage'] = '管理选课申请';
$string['status_desc'] = '允许内部选课的用户进入课程'; $string['status_desc'] = '允许内部选课的用户进入课程';
?>

67
lib.php

@ -26,6 +26,7 @@
define('ENROL_APPLY_USER_WAIT', 2); define('ENROL_APPLY_USER_WAIT', 2);
class enrol_apply_plugin extends enrol_plugin { class enrol_apply_plugin extends enrol_plugin {
/** /**
* Add new instance of enrol plugin with default settings. * Add new instance of enrol plugin with default settings.
* @param object $course * @param object $course
@ -51,7 +52,7 @@ class enrol_apply_plugin extends enrol_plugin {
$context = context_course::instance($courseid, MUST_EXIST); $context = context_course::instance($courseid, MUST_EXIST);
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/apply:config', $context)) { if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/apply:config', $context)) {
return NULL; return null;
} }
return new moodle_url('/enrol/apply/edit.php', array('courseid' => $courseid)); return new moodle_url('/enrol/apply/edit.php', array('courseid' => $courseid));
} }
@ -60,7 +61,7 @@ class enrol_apply_plugin extends enrol_plugin {
global $CFG, $OUTPUT, $SESSION, $USER, $DB; global $CFG, $OUTPUT, $SESSION, $USER, $DB;
if (isguestuser()) { if (isguestuser()) {
// can not enrol guest!! // Can not enrol guest!
return null; return null;
} }
if ($DB->record_exists('user_enrolments', array('userid' => $USER->id, 'enrolid' => $instance->id))) { if ($DB->record_exists('user_enrolments', array('userid' => $USER->id, 'enrolid' => $instance->id))) {
@ -69,7 +70,7 @@ class enrol_apply_plugin extends enrol_plugin {
require_once("$CFG->dirroot/enrol/apply/apply_form.php"); require_once("$CFG->dirroot/enrol/apply/apply_form.php");
$form = new enrol_apply_apply_form(NULL, $instance); $form = new enrol_apply_apply_form(null, $instance);
if ($data = $form->get_data()) { if ($data = $form->get_data()) {
// Only process when form submission is for this instance (multi instance support). // Only process when form submission is for this instance (multi instance support).
@ -79,7 +80,12 @@ class enrol_apply_plugin extends enrol_plugin {
$roleid = $instance->roleid; $roleid = $instance->roleid;
$this->enrol_user($instance, $USER->id, $roleid, $timestart, $timeend, ENROL_USER_SUSPENDED); $this->enrol_user($instance, $USER->id, $roleid, $timestart, $timeend, ENROL_USER_SUSPENDED);
$userenrolment = $DB->get_record('user_enrolments', array('userid' => $USER->id, 'enrolid' => $instance->id), 'id', MUST_EXIST); $userenrolment = $DB->get_record(
'user_enrolments',
array(
'userid' => $USER->id,
'enrolid' => $instance->id),
'id', MUST_EXIST);
$applicationinfo = new stdClass(); $applicationinfo = new stdClass();
$applicationinfo->userenrolmentid = $userenrolment->id; $applicationinfo->userenrolmentid = $userenrolment->id;
$applicationinfo->comment = $data->applydescription; $applicationinfo->comment = $data->applydescription;
@ -108,12 +114,20 @@ class enrol_apply_plugin extends enrol_plugin {
if (has_capability('enrol/apply:config', $context)) { if (has_capability('enrol/apply:config', $context)) {
$editlink = new moodle_url("/enrol/apply/edit.php", array('courseid' => $instance->courseid, 'id' => $instance->id)); $editlink = new moodle_url("/enrol/apply/edit.php", array('courseid' => $instance->courseid, 'id' => $instance->id));
$icons[] = $OUTPUT->action_icon($editlink, new pix_icon('t/edit', get_string('edit'), 'core', array('class' => 'iconsmall'))); $icons[] = $OUTPUT->action_icon($editlink, new pix_icon(
't/edit',
get_string('edit'),
'core',
array('class' => 'iconsmall')));
} }
if (has_capability('enrol/apply:manageapplications', $context)) { if (has_capability('enrol/apply:manageapplications', $context)) {
$managelink = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id)); $managelink = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id));
$icons[] = $OUTPUT->action_icon($managelink, new pix_icon('i/users', get_string('confirmenrol', 'enrol_apply'), 'core', array('class'=>'iconsmall'))); $icons[] = $OUTPUT->action_icon($managelink, new pix_icon(
'i/users',
get_string('confirmenrol', 'enrol_apply'),
'core',
array('class' => 'iconsmall')));
} }
return $icons; return $icons;
@ -121,7 +135,6 @@ class enrol_apply_plugin extends enrol_plugin {
/** /**
* Is it possible to hide/show enrol instance via standard UI? * Is it possible to hide/show enrol instance via standard UI?
*
* @param stdClass $instance * @param stdClass $instance
* @return bool * @return bool
*/ */
@ -136,13 +149,11 @@ class enrol_apply_plugin extends enrol_plugin {
* @param stdClass $instance * @param stdClass $instance
* @return bool * @return bool
*/ */
public function can_delete_instance($instance) { public function can_delete_instance($instance) {
$context = context_course::instance($instance->courseid); $context = context_course::instance($instance->courseid);
return has_capability('enrol/apply:config', $context); return has_capability('enrol/apply:config', $context);
} }
/** /**
* Sets up navigation entries. * Sets up navigation entries.
* *
@ -195,10 +206,9 @@ class enrol_apply_plugin extends enrol_plugin {
return $fields; return $fields;
} }
function confirmEnrolment($enrols){ public function confirm_enrolment($enrols) {
global $DB; global $DB;
foreach ($enrols as $enrol) { foreach ($enrols as $enrol) {
// $userenrolment = $DB->get_record('user_enrolments', array('id' => $enrol), '*', MUST_EXIST);
$userenrolment = $DB->get_record_select( $userenrolment = $DB->get_record_select(
'user_enrolments', 'user_enrolments',
'id = :id AND (status = :enrolusersuspended OR status = :enrolapplyuserwait)', 'id = :id AND (status = :enrolusersuspended OR status = :enrolapplyuserwait)',
@ -226,10 +236,13 @@ class enrol_apply_plugin extends enrol_plugin {
} }
} }
function waitEnrolment($enrols){ public function wait_enrolment($enrols) {
global $DB; global $DB;
foreach ($enrols as $enrol) { foreach ($enrols as $enrol) {
$userenrolment = $DB->get_record('user_enrolments', array('id' => $enrol, 'status' => ENROL_USER_SUSPENDED), '*', IGNORE_MISSING); $userenrolment = $DB->get_record(
'user_enrolments',
array('id' => $enrol, 'status' => ENROL_USER_SUSPENDED),
'*', IGNORE_MISSING);
if ($userenrolment != null) { if ($userenrolment != null) {
$instance = $DB->get_record('enrol', array('id' => $userenrolment->enrolid, 'enrol' => 'apply'), '*', MUST_EXIST); $instance = $DB->get_record('enrol', array('id' => $userenrolment->enrolid, 'enrol' => 'apply'), '*', MUST_EXIST);
@ -249,7 +262,7 @@ class enrol_apply_plugin extends enrol_plugin {
} }
} }
function cancelEnrolment($enrols){ public function cancel_enrolment($enrols) {
global $DB; global $DB;
foreach ($enrols as $enrol) { foreach ($enrols as $enrol) {
$userenrolment = $DB->get_record_select( $userenrolment = $DB->get_record_select(
@ -279,19 +292,19 @@ class enrol_apply_plugin extends enrol_plugin {
} }
} }
function send_mail_to_applicant($instance, $userid, $subject, $body) { private function send_mail_to_applicant($instance, $userid, $subject, $body) {
global $DB; global $DB;
global $CFG; global $CFG;
$course = get_course($instance->courseid); $course = get_course($instance->courseid);
$user = core_user::get_user($userid); $user = core_user::get_user($userid);
$body = $this->updateMailContent($body, $course, $user); $body = $this->update_mail_content($body, $course, $user);
$contact = core_user::get_support_user(); $contact = core_user::get_support_user();
email_to_user($user, $contact, $subject, html_to_text($body), $body); email_to_user($user, $contact, $subject, html_to_text($body), $body);
} }
function send_application_notification($instance, $userid, $data) { private function send_application_notification($instance, $userid, $data) {
global $CFG, $PAGE; global $CFG, $PAGE;
$renderer = $PAGE->get_renderer('enrol_apply'); $renderer = $PAGE->get_renderer('enrol_apply');
@ -323,7 +336,13 @@ class enrol_apply_plugin extends enrol_plugin {
$teachers = get_role_users($editingteacherrole->id, $context); $teachers = get_role_users($editingteacherrole->id, $context);
$manageurl = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id)); $manageurl = new moodle_url("/enrol/apply/manage.php", array('id' => $instance->id));
$body = $renderer->application_notification_mail_body($course, $user, $manageurl, $data->applydescription, $standarduserfields, $extrauserfields); $body = $renderer->application_notification_mail_body(
$course,
$user,
$manageurl,
$data->applydescription,
$standarduserfields,
$extrauserfields);
foreach ($teachers as $teacher) { foreach ($teachers as $teacher) {
email_to_user($teacher, $contact, get_string('mailtoteacher_suject', 'enrol_apply'), html_to_text($body), $body); email_to_user($teacher, $contact, get_string('mailtoteacher_suject', 'enrol_apply'), html_to_text($body), $body);
} }
@ -337,21 +356,27 @@ class enrol_apply_plugin extends enrol_plugin {
$managers = get_role_users($managerrole->id, $context); $managers = get_role_users($managerrole->id, $context);
$manageurl = new moodle_url('/enrol/apply/manage.php'); $manageurl = new moodle_url('/enrol/apply/manage.php');
$body = $renderer->application_notification_mail_body($course, $user, $manageurl, $data->applydescription, $standarduserfields, $extrauserfields); $body = $renderer->application_notification_mail_body(
$course,
$user,
$manageurl,
$data->applydescription,
$standarduserfields,
$extrauserfields);
foreach ($managers as $manager) { foreach ($managers as $manager) {
email_to_user($manager, $contact, get_string('mailtoteacher_suject', 'enrol_apply'), html_to_text($body), $body); email_to_user($manager, $contact, get_string('mailtoteacher_suject', 'enrol_apply'), html_to_text($body), $body);
} }
} }
} }
function updateMailContent($content, $course, $user) { private function update_mail_content($content, $course, $user) {
$replace = array( $replace = array(
'firstname' => $user->firstname, 'firstname' => $user->firstname,
'content' => format_string($course->fullname), 'content' => format_string($course->fullname),
'lastname' => $user->lastname, 'lastname' => $user->lastname,
'username' => $user->username); 'username' => $user->username);
foreach ($replace as $key => $val) { foreach ($replace as $key => $val) {
$content = str_replace("{".$key."}",$val,$content); $content = str_replace('{' . $key . '}', $val, $content);
} }
return $content; return $content;
} }

6
manage.php

@ -60,11 +60,11 @@ $PAGE->requires->css('/enrol/apply/style.css');
if ($userenrolments != null) { if ($userenrolments != null) {
$enrolapply = enrol_get_plugin('apply'); $enrolapply = enrol_get_plugin('apply');
if (optional_param('confirm', false, PARAM_BOOL)) { if (optional_param('confirm', false, PARAM_BOOL)) {
$enrolapply->confirmEnrolment($userenrolments); $enrolapply->confirm_enrolment($userenrolments);
} else if (optional_param('wait', false, PARAM_BOOL)) { } else if (optional_param('wait', false, PARAM_BOOL)) {
$enrolapply->waitEnrolment($userenrolments); $enrolapply->wait_enrolment($userenrolments);
} else if (optional_param('cancel', false, PARAM_BOOL)) { } else if (optional_param('cancel', false, PARAM_BOOL)) {
$enrolapply->cancelEnrolment($userenrolments); $enrolapply->cancel_enrolment($userenrolments);
} }
redirect($manageurl); redirect($manageurl);
} }

15
manage_table.php

@ -46,12 +46,13 @@ class enrol_apply_manage_table extends table_sql {
} }
$this->set_sql( $this->set_sql(
'ue.id AS userenrolmentid, ue.userid, ue.status AS enrolstatus, ue.timecreated AS applydate, ai.comment AS applycomment, u.*, c.fullname as course', 'ue.id AS userenrolmentid, ue.userid, ue.status AS enrolstatus, ue.timecreated AS applydate,
ai.comment AS applycomment, u.*, c.fullname as course',
"{user_enrolments} AS ue "{user_enrolments} AS ue
LEFT JOIN {enrol_apply_applicationinfo} AS ai ON ai.userenrolmentid = ue.id LEFT JOIN {enrol_apply_applicationinfo} ai ON ai.userenrolmentid = ue.id
JOIN {user} AS u ON u.id = ue.userid JOIN {user} u ON u.id = ue.userid
JOIN {enrol} AS e ON e.id = ue.enrolid JOIN {enrol} e ON e.id = ue.enrolid
JOIN {course} AS c ON c.id = e.courseid", JOIN {course} c ON c.id = e.courseid",
$sqlwhere, $sqlwhere,
$sqlparams); $sqlparams);
} }
@ -61,7 +62,7 @@ class enrol_apply_manage_table extends table_sql {
* @param $row array the data for this row. Note (Johannes): this is actually an object with all sql columns. * @param $row array the data for this row. Note (Johannes): this is actually an object with all sql columns.
* @return string added to the class="" attribute of the tr. * @return string added to the class="" attribute of the tr.
*/ */
function get_row_class($row) { public function get_row_class($row) {
if ($row->enrolstatus == 2) { if ($row->enrolstatus == 2) {
return 'enrol_apply_waitinglist_highlight'; return 'enrol_apply_waitinglist_highlight';
} }
@ -73,7 +74,7 @@ class enrol_apply_manage_table extends table_sql {
} }
public function col_fullname($row) { public function col_fullname($row) {
// $row contains all user fields, see sql query. // The $row variable contains all user fields, see sql query.
global $OUTPUT; global $OUTPUT;
$col = $OUTPUT->user_picture($row, array('popup' => true)); $col = $OUTPUT->user_picture($row, array('popup' => true));
$col .= fullname($row); $col .= fullname($row);

24
renderer.php

@ -41,15 +41,27 @@ class enrol_apply_renderer extends plugin_renderer_base {
} }
public function manage_form($table, $manageurl) { public function manage_form($table, $manageurl) {
echo html_writer::start_tag('form', array('id' => 'enrol_apply_manage_form', 'method' => 'post', 'action' => $manageurl->out())); echo html_writer::start_tag('form', array(
'id' => 'enrol_apply_manage_form',
'method' => 'post',
'action' => $manageurl->out()));
$this->manage_table($table); $this->manage_table($table);
echo html_writer::start_tag('p', array('align' => 'center')); echo html_writer::start_tag('p', array('align' => 'center'));
echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'confirm', 'value' => get_string('btnconfirm', 'enrol_apply'))); echo html_writer::empty_tag('input', array(
echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'wait', 'value' => get_string('btnwait', 'enrol_apply'))); 'type' => 'submit',
echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('btncancel', 'enrol_apply'))); 'name' => 'confirm',
'value' => get_string('btnconfirm', 'enrol_apply')));
echo html_writer::empty_tag('input', array(
'type' => 'submit',
'name' => 'wait',
'value' => get_string('btnwait', 'enrol_apply')));
echo html_writer::empty_tag('input', array(
'type' => 'submit',
'name' => 'cancel',
'value' => get_string('btncancel', 'enrol_apply')));
echo html_writer::end_tag('p'); echo html_writer::end_tag('p');
echo html_writer::end_tag('form'); echo html_writer::end_tag('form');
@ -78,7 +90,9 @@ class enrol_apply_renderer extends plugin_renderer_base {
$table->out(50, true); $table->out(50, true);
} }
public function application_notification_mail_body($course, $user, $manageurl, $applydescription, $standarduserfields = null, $extrauserfields = null) { public function application_notification_mail_body(
$course, $user, $manageurl, $applydescription, $standarduserfields = null, $extrauserfields = null) {
$body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>'; $body = '<p>'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'</p>';
$body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$user->firstname.' '.$user->lastname.'</p>'; $body .= '<p>'. get_string('applyuser', 'enrol_apply') .': '.$user->firstname.' '.$user->lastname.'</p>';
$body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>'; $body .= '<p>'. get_string('comment', 'enrol_apply') .': '.$applydescription.'</p>';

10
settings.php

@ -28,7 +28,7 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_heading('enrol_apply_enrolname', '', get_string('pluginname_desc', 'enrol_apply'))); $settings->add(new admin_setting_heading('enrol_apply_enrolname', '', get_string('pluginname_desc', 'enrol_apply')));
// Confirm mail settings. // Confirm mail settings...
$settings->add(new admin_setting_heading( $settings->add(new admin_setting_heading(
'enrol_apply_confirmmail', 'enrol_apply_confirmmail',
get_string('confirmmail_heading', 'enrol_apply'), get_string('confirmmail_heading', 'enrol_apply'),
@ -66,7 +66,7 @@ if ($ADMIN->fulltree) {
null, null,
PARAM_RAW)); PARAM_RAW));
// Cancel mail settings // Cancel mail settings...
$settings->add(new admin_setting_heading( $settings->add(new admin_setting_heading(
'enrol_apply_cancelmail', 'enrol_apply_cancelmail',
get_string('cancelmail_heading', 'enrol_apply'), get_string('cancelmail_heading', 'enrol_apply'),
@ -85,7 +85,7 @@ if ($ADMIN->fulltree) {
null, null,
PARAM_RAW)); PARAM_RAW));
// Notification settings. // Notification settings...
$settings->add(new admin_setting_heading( $settings->add(new admin_setting_heading(
'enrol_apply_notify', 'enrol_apply_notify',
get_string('notify_heading', 'enrol_apply'), get_string('notify_heading', 'enrol_apply'),
@ -101,7 +101,7 @@ if ($ADMIN->fulltree) {
'', '',
0)); 0));
// Enrol instance defaults. // Enrol instance defaults...
$settings->add(new admin_setting_heading('enrol_manual_defaults', $settings->add(new admin_setting_heading('enrol_manual_defaults',
get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin'))); get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin')));
@ -132,7 +132,7 @@ if ($ADMIN->fulltree) {
} }
} }
if ($hassiteconfig) { // needs this condition or there is error on login page if ($hassiteconfig) { // Needs this condition or there is error on login page.
$ADMIN->add('courses', new admin_externalpage('enrol_apply', $ADMIN->add('courses', new admin_externalpage('enrol_apply',
get_string('applymanage', 'enrol_apply'), get_string('applymanage', 'enrol_apply'),
new moodle_url('/enrol/apply/manage.php'))); new moodle_url('/enrol/apply/manage.php')));

3
unenrolself.php

@ -59,6 +59,7 @@ if ($confirm and confirm_sesskey()) {
echo $OUTPUT->header(); echo $OUTPUT->header();
$yesurl = new moodle_url($PAGE->url, array('confirm' => 1, 'sesskey' => sesskey())); $yesurl = new moodle_url($PAGE->url, array('confirm' => 1, 'sesskey' => sesskey()));
$nourl = new moodle_url('/course/view.php', array('id' => $course->id)); $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 // I leave the unenrolselfconfirm message because it fits perfectly.
$message = get_string('unenrolselfconfirm', 'enrol_self', format_string($course->fullname));
echo $OUTPUT->confirm($message, $yesurl, $nourl); echo $OUTPUT->confirm($message, $yesurl, $nourl);
echo $OUTPUT->footer(); echo $OUTPUT->footer();

Loading…
Cancel
Save