From 24ac05a9d76675d018d5de5a794d186dadac6fe3 Mon Sep 17 00:00:00 2001 From: Kordan Date: Tue, 20 Feb 2018 13:38:01 +0100 Subject: [PATCH] major editing --- classes/observer.php | 57 +++--- db/access.php | 9 + db/events.php | 4 +- db/upgrade.php | 6 +- edit.php | 146 --------------- edit_form.php | 120 ------------ lang/en/enrol_notificationeabc.php | 84 ++++----- lang/es/enrol_notificationeabc.php | 53 +++--- lib.php | 290 +++++++++++++++++++---------- settings.php | 78 +++----- version.php | 2 +- 11 files changed, 321 insertions(+), 528 deletions(-) delete mode 100644 edit.php delete mode 100644 edit_form.php diff --git a/classes/observer.php b/classes/observer.php index 86c2f64..712f8d9 100644 --- a/classes/observer.php +++ b/classes/observer.php @@ -43,7 +43,7 @@ class enrol_notificationeabc_observer * hook enrol event * @param \core\event\user_enrolment_deleted $event */ - public static function user_unenroled(\core\event\user_enrolment_deleted $event) { + public static function user_unenrolled(\core\event\user_enrolment_deleted $event) { global $DB; // Validate status plugin. @@ -61,8 +61,8 @@ public static function user_unenroled(\core\event\user_enrolment_deleted $event) $notificationeabc = new enrol_notificationeabc_plugin(); - $activeglobal = $notificationeabc->get_config('activarglobalunenrolalert'); - $activeunenrolalert = $notificationeabc->get_config('activeunenrolalert'); + $activeglobal = $notificationeabc->get_config('globalunenrolalert'); + $unenrolalert = $notificationeabc->get_config('unenrolalert'); $enrol = $DB->get_record('enrol', array('enrol' => 'notificationeabc', 'courseid' => $event->courseid)); @@ -76,14 +76,11 @@ public static function user_unenroled(\core\event\user_enrolment_deleted $event) $instanceenabled = true; } } - if (!empty($enrol) && $instanceenabled) { - $activeunenrolalert = $enrol->customint4; - } - if ($activeglobal == 1 && $activeunenrolalert == 1) { - $notificationeabc->enviarmail($user, $course, 2); - } else if (!empty($enrol) && !empty($activeunenrolalert) && $instanceenabled) { - $notificationeabc->enviarmail($user, $course, 2); + if ($activeglobal == 1 && $unenrolalert == 1) { + $notificationeabc->send_email($user, $course, 2); + } else if (!empty($enrol) && !empty($unenrolalert) && $instanceenabled) { + $notificationeabc->send_email($user, $course, 2); } } } @@ -110,8 +107,8 @@ public static function user_updated(\core\event\user_enrolment_updated $event) { $notificationeabc = new enrol_notificationeabc_plugin(); - $activeglobal = $notificationeabc->get_config('activarglobalenrolupdated'); - $activeenrolupdatedalert = $notificationeabc->get_config('activeenrolupdatedalert'); + $activeglobal = $notificationeabc->get_config('globalenrolupdatealert'); + $enrolupdatealert = $notificationeabc->get_config('enrolupdatealert'); // Plugin instance in course. $enrol = $DB->get_record('enrol', array('enrol' => 'notificationeabc', 'courseid' => $event->courseid)); @@ -126,14 +123,11 @@ public static function user_updated(\core\event\user_enrolment_updated $event) { $instanceenabled = true; } } - if (!empty($enrol) && $instanceenabled) { - $activeenrolupdatedalert = $enrol->customint5; - } - if ($activeglobal == 1 && $activeenrolupdatedalert == 1) { - $notificationeabc->enviarmail($user, $course, 3); - } else if (!empty($enrol) && !empty($activeenrolupdatedalert) && $instanceenabled) { - $notificationeabc->enviarmail($user, $course, 3); + if ($activeglobal == 1 && $enrolupdatealert == 1) { + $notificationeabc->send_email($user, $course, 3); + } else if (!empty($enrol) && !empty($enrolupdatealert) && $instanceenabled) { + $notificationeabc->send_email($user, $course, 3); } } } @@ -142,7 +136,7 @@ public static function user_updated(\core\event\user_enrolment_updated $event) { * hook enrolment event * @param \core\event\user_enrolment_created $event */ - public static function user_enroled(\core\event\user_enrolment_created $event) { + public static function user_enrolled(\core\event\user_enrolment_created $event) { global $DB; // Validate plugin status in system context. @@ -154,21 +148,20 @@ public static function user_enroled(\core\event\user_enrolment_created $event) { $enabled = true; } } + if ($enabled) { $user = $DB->get_record('user', array('id' => $event->relateduserid)); $course = $DB->get_record('course', array('id' => $event->courseid)); $notificationeabc = new enrol_notificationeabc_plugin(); - $activeglobal = $notificationeabc->get_config('activarglobal'); - $activeenrolalert = $notificationeabc->get_config('activeenrolalert'); + $activeglobal = $notificationeabc->get_config('globalenrolalert'); + $enrolalert = $notificationeabc->get_config('enrolalert'); $enrol = $DB->get_record('enrol', array('enrol' => 'notificationeabc', 'courseid' => $event->courseid)); - /* - * check the instance status - * status = 0 enabled and status = 1 disabled - */ + // Check the instance status. + // Legend: status = 0 enabled; status = 1 disabled. $instanceenabled = false; if (!empty($enrol)) { if (!$enrol->status) { @@ -176,14 +169,10 @@ public static function user_enroled(\core\event\user_enrolment_created $event) { } } - if (!empty($enrol) && $instanceenabled) { - $activeenrolalert = $enrol->customint3; - } - - if ($activeglobal == 1 && $activeenrolalert == 1) { - $notificationeabc->enviarmail($user, $course, 1); - } else if (!empty($enrol) && !empty($activeenrolalert) && $instanceenabled) { - $notificationeabc->enviarmail($user, $course, 1); + if ($activeglobal == 1 && $enrolalert == 1) { + $notificationeabc->send_email($user, $course, 1); + } else if (!empty($enrol) && !empty($enrolalert) && $instanceenabled) { + $notificationeabc->send_email($user, $course, 1); } } } diff --git a/db/access.php b/db/access.php index f0fd586..3fce13a 100644 --- a/db/access.php +++ b/db/access.php @@ -38,4 +38,13 @@ 'manager' => CAP_ALLOW, ) ), + 'enrol/notificationeabc:config' => array( + + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'manager' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + ) + ), ); diff --git a/db/events.php b/db/events.php index 36d006e..2b78e32 100644 --- a/db/events.php +++ b/db/events.php @@ -31,12 +31,12 @@ array( 'eventname' => '\core\event\user_enrolment_deleted', - 'callback' => 'enrol_notificationeabc_observer::user_unenroled', + 'callback' => 'enrol_notificationeabc_observer::user_unenrolled', ), array( 'eventname' => '\core\event\user_enrolment_created', - 'callback' => 'enrol_notificationeabc_observer::user_enroled', + 'callback' => 'enrol_notificationeabc_observer::user_enrolled', ), array( diff --git a/db/upgrade.php b/db/upgrade.php index 52d8f51..3058abc 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -28,12 +28,12 @@ defined('MOODLE_INTERNAL') || die(); /** - * Upgrade script + * Upgrade script * @param int $oldversion * @return bool */ function xmldb_enrol_notificationeabc_upgrade($oldversion) { - global $CFG, $DB; - $dbman = $DB->get_manager(); + global $DB; + // $dbman = $DB->get_manager(); return true; } diff --git a/edit.php b/edit.php deleted file mode 100644 index aab3b4c..0000000 --- a/edit.php +++ /dev/null @@ -1,146 +0,0 @@ -. - -/** - * Notificationeabc enrolment plugin. - * - * This plugin notifies users when an event occurs on their enrolments (enrol, unenrol, update enrolment) - * - * @package enrol_notificationeabc - * @copyright 2017 e-ABC Learning - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @author Osvaldo Arriola - */ - - -require('../../config.php'); -require_once('edit_form.php'); - -$courseid = required_param('courseid', PARAM_INT); -$instanceid = optional_param('id', 0, PARAM_INT); - -$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); -$context = context_course::instance($course->id, MUST_EXIST); - -require_login($course); -require_capability('enrol/notificationeabc:manage', $context); - -$PAGE->set_url('/enrol/notificationeabc/edit.php', array('courseid' => $course->id, 'id' => $instanceid)); -$PAGE->set_pagelayout('admin'); - -$return = new moodle_url('/enrol/instances.php', array('id' => $course->id)); -if (!enrol_is_enabled('notificationeabc')) { - redirect($return); -} - -/** @var enrol_notificationeabc_plugin $plugin */ -$plugin = enrol_get_plugin('notificationeabc'); - -if ($instanceid) { - $instance = $DB->get_record('enrol', - array( - 'courseid' => $course->id, - 'enrol' => 'notificationeabc', - 'id' => $instanceid - ), '*', MUST_EXIST); - -} else { - require_capability('moodle/course:enrolconfig', $context); - // No instance yet, we have to add new instance. - navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id' => $course->id))); - - $instance = (object)$plugin->get_instance_defaults(); - $instance->id = null; - $instance->courseid = $course->id; - $instance->status = ENROL_INSTANCE_ENABLED; // Do not use default for automatically created instances here. -} - - -$mform = new enrol_notificationeabc_edit_form(null, array($instance, $plugin, $context)); - -if ($mform->is_cancelled()) { - redirect($return); - -} else if ($data = $mform->get_data()) { - if ($instance->id) { - $reset = ($instance->status != $data->status); - - $instance->status = $data->status; - $instance->name = $data->name; - $instance->customint1 = $data->customint1; - if (isset($data->customint2)) { - $instance->customint2 = $data->customint2; - } else { - $instance->customint2 = 0; - } - - if (isset($data->customint3)) { - $instance->customint3 = $data->customint3; - } else { - $instance->customint3 = 0; - } - - if (isset($data->customint4)) { - $instance->customint4 = $data->customint4; - } else { - $instance->customint4 = 0; - } - - if (isset($data->customint5)) { - $instance->customint5 = $data->customint5; - } else { - $instance->customint5 = 0; - } - - $instance->customtext1 = $data->customtext1['text']; - $instance->customtext2 = $data->customtext2['text']; - $instance->customtext3 = $data->customtext3['text']; - $instance->customchar1 = $data->customchar1; - $instance->customchar2 = $data->customchar2; - $instance->timemodified = time(); - $DB->update_record('enrol', $instance); - - if ($reset) { - $context->mark_dirty(); - } - - } else { - $fields = array( - 'status' => $data->status, - 'name' => $data->name, - 'customint1' => $data->customint1, - 'customint2' => $data->customint2, - 'customint3' => $data->customint3, - 'customint4' => $data->customint4, - 'customint5' => $data->customint5, - 'customtext1' => $data->customtext1['text'], - 'customtext2' => $data->customtext2['text'], - 'customtext3' => $data->customtext3['text'], - 'customchar1' => $data->customchar1, - 'customchar2' => $data->customchar2); - $plugin->add_instance($course, $fields); - } - - redirect($return); -} - -$PAGE->set_heading($course->fullname); -$PAGE->set_title(get_string('pluginname', 'enrol_notificationeabc')); - -echo $OUTPUT->header(); -echo $OUTPUT->heading(get_string('pluginname', 'enrol_notificationeabc')); -$mform->display(); -echo $OUTPUT->footer(); \ No newline at end of file diff --git a/edit_form.php b/edit_form.php deleted file mode 100644 index 3f75793..0000000 --- a/edit_form.php +++ /dev/null @@ -1,120 +0,0 @@ -. - -/** - * Notificationeabc enrolment plugin. - * - * This plugin notifies users when an event occurs on their enrolments (enrol, unenrol, update enrolment) - * - * @package enrol_notificationeabc - * @copyright 2017 e-ABC Learning - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @author Osvaldo Arriola - */ - -defined('MOODLE_INTERNAL') || die(); - -require_once($CFG->libdir . '/formslib.php'); - -/** - * Edit form class - * - * @package enrol_notificationeabc - * @copyright 2016 e-ABC Learning - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class enrol_notificationeabc_edit_form extends moodleform -{ - /** - * Main definition - */ - public function definition() { - - $mform = $this->_form; - - list($instance, $plugin, $context) = $this->_customdata; - - $mform->addElement('header', 'header', get_string('pluginname', 'enrol_notificationeabc')); - $mform->addElement('text', 'name', get_string('custominstancename', 'enrol')); - - $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), - ENROL_INSTANCE_DISABLED => get_string('no')); - $mform->addElement('select', 'status', get_string('status', 'enrol_notificationeabc'), $options); - - // Enrol notifications. - $mform->addElement('advcheckbox', 'customint3', get_string('activeenrolalert', 'enrol_notificationeabc')); - $mform->addHelpButton('customint3', 'activeenrolalert', 'enrol_notificationeabc'); - - $mform->addElement('editor', 'customtext1', get_string('location', 'enrol_notificationeabc'), null); - $mform->setType('customtext1', PARAM_RAW); - $mform->addHelpButton('customtext1', 'location', 'enrol_notificationeabc'); - - // Unenrol notifications. - $mform->addElement('advcheckbox', 'customint4', get_string('activeunenrolalert', 'enrol_notificationeabc')); - $mform->addHelpButton('customint4', 'activeunenrolalert', 'enrol_notificationeabc'); - - $mform->addElement('editor', 'customtext2', get_string('unenrolmessage', 'enrol_notificationeabc'), null); - $mform->setType('customtext2', PARAM_RAW); - $mform->addHelpButton('customtext2', 'unenrolmessage', 'enrol_notificationeabc'); - - // Update enrolment notifications. - $mform->addElement('advcheckbox', 'customint5', get_string('activeenrolupdatedalert', 'enrol_notificationeabc')); - $mform->addHelpButton('customint5', 'activeenrolupdatedalert', 'enrol_notificationeabc'); - - $mform->addElement('editor', 'customtext3', get_string('updatedenrolmessage', 'enrol_notificationeabc'), null); - $mform->setType('customtext3', PARAM_RAW); - $mform->addHelpButton('customtext3', 'updatedenrolmessage', 'enrol_notificationeabc'); - - // Email y nombre del remitente. - $mform->addElement('text', 'customchar1', get_string('emailsender', 'enrol_notificationeabc')); - $mform->addHelpButton('customchar1', 'emailsender', 'enrol_notificationeabc'); - - $mform->addElement('text', 'customchar2', get_string('namesender', 'enrol_notificationeabc')); - $mform->addHelpButton('customchar2', 'namesender', 'enrol_notificationeabc'); - - $this->add_action_buttons(true, ($instance->id ? null : get_string('addinstance', 'enrol'))); - - if (!empty($instance->courseid)) { - $mform->addElement('hidden', 'courseid', $instance->courseid); - $mform->setType('courseid', PARAM_INT); - } - - if (!empty($instance->id)) { - $mform->addElement('hidden', 'id', $instance->id); - $mform->setType('id', PARAM_INT); - } - - if (!empty($instance)) { - $mform->setDefault('customtext1', array('text' => $instance->customtext1)); - $mform->setDefault('customtext2', array('text' => $instance->customtext2)); - $mform->setDefault('customtext3', array('text' => $instance->customtext3)); - $mform->setDefault('customchar1', $instance->customchar1); - $mform->setDefault('customchar2', $instance->customchar2); - $mform->setDefault('customint3', $instance->customint3); - $mform->setDefault('customint4', $instance->customint4); - $mform->setDefault('customint5', $instance->customint5); - if (!empty($instance->name)) { - $mform->setDefault('name', $instance->name); - } else { - $mform->setDefault('name', 'notificationeabc'); - } - } - $this->set_data($instance); - - } - - -} diff --git a/lang/en/enrol_notificationeabc.php b/lang/en/enrol_notificationeabc.php index e8e0d2c..0671073 100644 --- a/lang/en/enrol_notificationeabc.php +++ b/lang/en/enrol_notificationeabc.php @@ -25,63 +25,63 @@ * @author Osvaldo Arriola */ -$string['filelockedmail'] = 'You has been enroled in {$a->fullname} ({$a->url})'; -$string['location'] = 'Message'; -$string['messageprovider:notificationeabc_enrolment'] = 'Enrol notification messages'; -$string['notificationeabc:manage'] = 'Manage notificationeabc'; -$string['pluginname'] = 'Enrol Notification'; -$string['pluginname_desc'] = 'Enrol notifications via mail'; -$string['location_help'] = 'Personalize the message that users will come to be enrolled. This field accepts the following markers which then will be replaced by the corresponding values ​​dynamically +$string['activar_help'] = 'When activated will be verified by the immediate execution of cron later, users who were enrolled for the period specified above'; +$string['activar'] = 'Enable initial verification'; +$string['failsend'] = 'WARNING: it has no been able to notify the {$a->username} user about his enrollment in the {$a->coursename} course'."\n"; +$string['fecha_help'] = 'Place the period for which you want to perform the first virificación'; +$string['fecha'] = 'Period for verification of users enrolled courses'; +$string['messageprovider:notificationeabc_enrolment'] = 'Enrol email notification messages'; +$string['notificationeabc:config'] = 'Configure email notificationeabc instances'; +$string['notificationeabc:manage'] = 'Manage email notificationeabc'; +$string['pluginname'] = 'Enrol notification'; +$string['status'] = 'Active email notification'; +$string['subject'] = 'Enrolment email notification'; +$string['succefullsend'] = 'The user {$a->username} has been notified about his enrollment in the {$a->coursename} course'."\n"; + +// Enrol notifications. +$string['enrolalert'] = 'Enable enrol message'; +$string['enrolalert_help'] = 'Enable enrol message'; +$string['globalenrolalert'] = 'Enable global enrol message'; +$string['globalenrolalert_help'] = 'Enable site wide enrol message'; +$string['enrolmessage'] = 'Custom enrol message'; +$string['enrolmessage_help'] = 'Personalize the message that users will come to be enrolled. This field accepts the following markers which then will be replaced by the corresponding values ​​dynamically
 {COURSENAME} = course fullname
 {USERNAME} = username
-{NOMBRE} = firstname
-{APELLIDO} = lastname
+{FIRSTNAME} = firstname
+{LASTNAME} = lastname
 {URL} = course url
 
'; -$string['fecha_help'] = 'Place the period for which you want to perform the first virificación'; -$string['fecha'] = 'Period for verification of users enrolled courses'; -$string['activar'] = 'Enable initial verification'; -$string['activar_help'] = 'When activated will be verified by the immediate execution of cron later, users who were enrolled for the period specified above'; -$string['activarglobal'] = 'Active global'; -$string['activarglobal_help'] = 'Active enrol notification for all site'; -$string['emailsender'] = 'Email sender '; -$string['emailsender_help'] = 'By default set to take the email user support '; -$string['namesender'] = 'Name sender '; -$string['namesender_help'] = 'By default it takes the name set to the user support'; -$string['status'] = 'Active enrol notification'; -$string['subject'] = 'Enrolment notification'; -$string['activeenrolalert'] = 'Active enrol alert'; -$string['activeenrolalert_help'] = 'Active enrol alert'; +$string['enrolmessagedefault'] = 'You have been enrolled in {$a->fullname} ({$a->url})'; + // Unenrol notifications. -$string['activeunenrolalert'] = 'Active unenrol notifications'; -$string['activeunenrolalert_help'] = 'Active unenrol alert'; -$string['activarglobalunenrolalert'] = 'Active global'; -$string['activarglobalunenrolalert_help'] = 'Active enrol notifications for all site'; -$string['unenrolmessage'] = 'Custom Message'; +$string['unenrolalert'] = 'Enable unenrol message'; +$string['unenrolalert_help'] = 'Enable unenrol message'; +$string['globalunenrolalert'] = 'Enable global unenrol message'; +$string['globalunenrolalert_help'] = 'Site wide unenrol message'; +$string['unenrolmessage'] = 'Custom unenrol message'; $string['unenrolmessage_help'] = 'Personalize the message that users will come to be unenrolled. This field accepts the following markers which then will be replaced by the corresponding values ​​dynamically
 {COURSENAME} = course fullname
 {USERNAME} = username
-{NOMBRE} = firstname
-{APELLIDO} = lastname
+{FIRSTNAME} = firstname
+{LASTNAME} = lastname
 {URL} = course url
 
'; -$string['unenrolmessagedefault'] = 'You has been unenrolled from {$a->fullname} ({$a->url})'; +$string['unenrolmessagedefault'] = 'You have been unenrolled from {$a->fullname} ({$a->url})'; + // Update enrol notifications. -$string['activeenrolupdatedalert'] = 'Active update enrol notifications'; -$string['activeenrolupdatedalert_help'] = 'Active update enrol notifications'; -$string['activarglobalenrolupdated'] = 'Active global'; -$string['activarglobalenrolupdated_help'] = 'Active enrol updated notifications for all site'; -$string['updatedenrolmessage'] = 'Custom message'; -$string['updatedenrolmessage_help'] = 'Personalize the message that users will come to be updated. This field accepts the following markers which then will be replaced by the corresponding values ​​dynamically +$string['enrolupdatealert'] = 'Enable enrol update message'; +$string['enrolupdatealert_help'] = 'Enable enrol update message'; +$string['globalenrolupdatealert'] = 'Enable global enrol update message'; +$string['globalenrolupdatealert_help'] = 'Site wide enrol update message'; +$string['enrolupdatemessage'] = 'Custom enrol update message'; +$string['enrolupdatemessage_help'] = 'Personalize the message that users will come to be updated. This field accepts the following markers which then will be replaced by the corresponding values ​​dynamically
 {COURSENAME} = course fullname
 {USERNAME} = username
-{NOMBRE} = firstname
-{APELLIDO} = lastname
+{FIRSTNAME} = firstname
+{LASTNAME} = lastname
 {URL} = course url
 
'; -$string['updatedenrolmessagedefault'] = 'Your enrolment from {$a->fullname} has been updated ({$a->url})'; -$string['succefullsend'] = 'The user {$a->username} has been notified about his enrollment in the {$a->coursename} course'."\n"; -$string['failsend'] = 'WARNING: it has no been able to notify the {$a->username} user about his enrollment in the {$a->coursename} course'."\n"; \ No newline at end of file +$string['enrolupdatemessagedefault'] = 'Your enrolment to {$a->fullname} has been updated ({$a->url})'; diff --git a/lang/es/enrol_notificationeabc.php b/lang/es/enrol_notificationeabc.php index a185d74..6d184d2 100644 --- a/lang/es/enrol_notificationeabc.php +++ b/lang/es/enrol_notificationeabc.php @@ -25,63 +25,58 @@ * @author Osvaldo Arriola */ -$string['filelockedmail'] = 'Ud ha sido matriculado en el curso {$a->fullname} ({$a->url})'; -$string['location'] = 'Mensaje personalizado'; +$string['enrolmessagedefault'] = 'Ud ha sido matriculado en el curso {$a->fullname} ({$a->url})'; +$string['enrolmessage'] = 'Mensaje personalizado'; $string['messageprovider:notificationeabc_enrolment'] = 'Enrol notification messages'; $string['notificationeabc:manage'] = 'Gestionar notificaciones de matriculación'; $string['pluginname'] = 'Notificación de Matriculación'; -$string['pluginname_desc'] = 'Notificación de matriculaciones a cursos via mail'; -$string['location_help'] = 'Personalice el mensaje que le llegará a los usuarios al ser matriculados. Este campo acepta los siguientes marcadores que luego seran reemplazados dinámicamente por los valores correspondientes +$string['enrolmessage_help'] = 'Personalice el mensaje que le llegará a los usuarios al ser matriculados. Este campo acepta los siguientes marcadores que luego seran reemplazados dinámicamente por los valores correspondientes
 {COURSENAME} = Nombre completo del curso
 {USERNAME} = Nombre de usuario
-{NOMBRE} = Nombre
-{APELLIDO} = Apellido
+{FIRSTNAME} = Nombre
+{LASTNAME} = Apellido
 {URL} = Url del curso
 
'; $string['fecha_help'] = 'Coloque el periodo por el cual desea que se realice la virificación inicial de usuarios matriculados'; $string['fecha'] = 'Período para realizar la verificación de usuarios que se matricularon a cursos'; $string['activar'] = 'Activar verificación inicial'; $string['activar_help'] = 'Al activarse se verificará, mediante la ejecucion del cron inmediata posterior, los usuarios que fueron matriculados en el periodo establecido arriba'; -$string['activarglobal'] = 'Activar para todo el sitio'; -$string['activarglobal_help'] = 'Activa la notificacion de matriculacion para todo los cursos'; -$string['emailsender'] = 'Email del remitente '; -$string['emailsender_help'] = 'Por defecto toma el email configurado como el usuario de soporte '; -$string['namesender'] = 'Nombre del remitente '; -$string['namesender_help'] = 'Por defecto toma el nombre configurado como el usuario de soporte '; +$string['globalenrolalert'] = 'Activar para todo el sitio'; +$string['globalenrolalert_help'] = 'Activa la notificacion de matriculacion para todo los cursos'; $string['status'] = 'Activar notification de matriculación'; $string['subject'] = 'Notificación de Matriculación'; -$string['activeenrolalert'] = 'Activar aviso de matriculación'; -$string['activeenrolalert_help'] = 'Activar aviso de matriculación'; +$string['enrolalert'] = 'Activar aviso de matriculación'; +$string['enrolalert_help'] = 'Activar aviso de matriculación'; // Aviso de desmatriculacion. -$string['activeunenrolalert'] = 'Activar aviso de desmatriculacion'; -$string['activeunenrolalert_help'] = 'Activar aviso de desmatriculacion'; -$string['activarglobalunenrolalert'] = 'Activar para todo el sitio'; -$string['activarglobalunenrolalert_help'] = 'Activar la notificacion de desmatriculacion para todo el sitio'; +$string['unenrolalert'] = 'Activar aviso de desmatriculacion'; +$string['unenrolalert_help'] = 'Activar aviso de desmatriculacion'; +$string['globalunenrolalert'] = 'Activar para todo el sitio'; +$string['globalunenrolalert_help'] = 'Activar la notificacion de desmatriculacion para todo el sitio'; $string['unenrolmessage'] = 'Mensaje personalizado'; $string['unenrolmessage_help'] = 'Personalice el mensaje que le llegará a los usuarios al ser desmatriculados. Este campo acepta los siguientes marcadores que luego seran reemplazados dinámicamente por los valores correspondientes
 {COURSENAME} = Nombre completo del curso
 {USERNAME} = Nombre de usuario
-{NOMBRE} = Nombre
-{APELLIDO} = Apellido
+{FIRSTNAME} = Nombre
+{LASTNAME} = Apellido
 {URL} = Url del curso
 
'; $string['unenrolmessagedefault'] = 'Ud ha sido desmatriculado del curso {$a->fullname} ({$a->url})'; // Aviso de actualizacion de matriculacion. -$string['activeenrolupdatedalert'] = 'Activar aviso de actualizacion de matriculacion'; -$string['activeenrolupdatedalert_help'] = 'Activar aviso de actualizacion de matriculacion'; -$string['activarglobalenrolupdated'] = 'Activar para todo el sitio'; -$string['activarglobalenrolupdated_help'] = 'Activar la notificacion de actualizacion de matriculacion para todo el sitio'; -$string['updatedenrolmessage'] = 'Mensaje personalizado'; -$string['updatedenrolmessage_help'] = 'Personalice el mensaje que le llegará a los usuarios al realizar alguna actualizacion en su matriculacion. Este campo acepta los siguientes marcadores que luego seran reemplazados dinámicamente por los valores correspondientes +$string['enrolupdatealert'] = 'Activar aviso de actualizacion de matriculacion'; +$string['enrolupdatealert_help'] = 'Activar aviso de actualizacion de matriculacion'; +$string['globalenrolupdatealert'] = 'Activar para todo el sitio'; +$string['globalenrolupdatealert_help'] = 'Activar la notificacion de actualizacion de matriculacion para todo el sitio'; +$string['enrolupdatemessage'] = 'Mensaje personalizado'; +$string['enrolupdatemessage_help'] = 'Personalice el mensaje que le llegará a los usuarios al realizar alguna actualizacion en su matriculacion. Este campo acepta los siguientes marcadores que luego seran reemplazados dinámicamente por los valores correspondientes
 {COURSENAME} = Nombre completo del curso
 {USERNAME} = Nombre de usuario
-{NOMBRE} = Nombre
-{APELLIDO} = Apellido
+{FIRSTNAME} = Nombre
+{LASTNAME} = Apellido
 {URL} = Url del curso
 
'; -$string['updatedenrolmessagedefault'] = 'Su matriculacion en el curso {$a->fullname} ha sido actualizada ({$a->url})'; +$string['enrolupdatemessagedefault'] = 'Su matriculacion en el curso {$a->fullname} ha sido actualizada ({$a->url})'; $string['succefullsend'] = 'Se notifico al usuario {$a->username} sobre su matriculación en el curso {$a->coursename}'. "\n"; $string['failsend'] = 'ATENCION: No se pudo notificar al usuario {$a->username} sobre su matriculación en el curso {$a->coursename}'."\n"; \ No newline at end of file diff --git a/lib.php b/lib.php index 0e68872..dd5b52b 100644 --- a/lib.php +++ b/lib.php @@ -45,111 +45,78 @@ class enrol_notificationeabc_plugin extends enrol_plugin // Funcion que envia las notificaciones a los usuarios. /** - * Send mail method - * @param stdClass $user instancia usuario - * @param stdClass $course instancia curso - * @param int $type aviso matriculacion, actualizacion o desmatriculacion + * Send mail method + * @param stdClass $user user instance + * @param stdClass $course course instance + * @param int $type notice enrollment, update or unenrollment * @return bool */ - public function enviarmail(stdClass $user, stdClass $course, $type) { - global $CFG, $DB, $COURSE; + public function send_email(stdClass $user, stdClass $course, $type) { + global $CFG, $DB; $course->url = $CFG->wwwroot . '/course/view.php?id=' . $course->id; $enrol = $DB->get_record('enrol', array('enrol' => 'notificationeabc', 'courseid' => $course->id, 'status' => 0)); - $activeglobalenrol = $this->get_config('activarglobal'); - $activarglobalunenrolalert = $this->get_config('activarglobalunenrolalert'); - $activarglobalenrolupdated = $this->get_config('activarglobalenrolupdated'); - $mensajeenrol = $this->get_config('location'); - $plainmensajeenrol = strip_tags($mensajeenrol); - $mensajeunenrol = $this->get_config('unenrolmessage'); - $plainmensajeunenrol = strip_tags($mensajeunenrol); - $mensajeupdateenrol = $this->get_config('updatedenrolmessage'); - $plainmensajeupdateenrol = strip_tags($mensajeupdateenrol); + + $pluginconfig = get_config('enrol_notificationeabc'); + $enrolalert = $pluginconfig->enrolalert; + $globalenrolalert = $pluginconfig->globalenrolalert; + + $unenrolalert = $pluginconfig->unenrolalert; + $globalunenrolalert = $pluginconfig->globalunenrolalert; + + $enrolupdatealert = $pluginconfig->enrolupdatealert; + $globalenrolupdatealert = $pluginconfig->globalenrolupdatealert; + + if (!$enrolmessage = $enrol->customtext1) { // Corse level. + if (!$enrolmessage = $pluginconfig->enrolmessage) { // Plugin level. + $enrolmessage = get_string('enrolmessagedefault', 'enrol_notificationeabc', $course); + } + } + if (!$unenrolmessage = $enrol->customtext2) { // Corse level. + if (!$unenrolmessage = $pluginconfig->unenrolmessage) { // Plugin level. + $unenrolmessage = get_string('unenrolmessagedefault', 'enrol_notificationeabc', $course); + } + } + if (!$enrolupdatemessage = $enrol->customtext3) { // Corse level. + if (!$enrolupdatemessage = $pluginconfig->enrolupdatemessage) { // Plugin level. + $enrolupdatemessage = get_string('enrolupdatemessagedefault', 'enrol_notificationeabc', $course); + } + } switch ((int)$type) { case 1: - // Si no se configuro un mensaje personalizado se envia uno por defecto basico. - if (!empty($enrol) && !empty($enrol->customtext1)) { - $texto = strip_tags($enrol->customtext1); - if (!empty($texto)) { - $mensaje = $this->process_mensaje($enrol->customtext1, $user, $course); - } else { - $mensaje = get_string("filelockedmail", "enrol_notificationeabc", $course); - } - - } else if (!empty($activeglobalenrol) && !empty($plainmensajeenrol)) { - $mensaje = $this->process_mensaje($mensajeenrol, $user, $course); - } else { - $mensaje = get_string("filelockedmail", "enrol_notificationeabc", $course); + if (!empty($enrolalert) || !empty($globalenrolalert)) { + $message = $this->get_message($enrolmessage, $user, $course); } break; case 2: - - if (!empty($enrol) && !empty($enrol->customtext2)) { - $texto = strip_tags($enrol->customtext2); - if (!empty($texto)) { - $mensaje = $this->process_mensaje($enrol->customtext2, $user, $course); - } else { - $mensaje = get_string("unenrolmessagedefault", "enrol_notificationeabc", $course); - } - - } else if (!empty($activarglobalunenrolalert) && !empty($plainmensajeunenrol)) { - $mensaje = $this->process_mensaje($mensajeunenrol, $user, $course); - } else { - $mensaje = get_string("unenrolmessagedefault", "enrol_notificationeabc", $course); + if (!empty($unenrolalert) || !empty($globalunenrolalert)) { + $message = $this->get_message($unenrolmessage, $user, $course); } break; case 3: - - if (!empty($enrol) && !empty($enrol->customtext3)) { - $texto = strip_tags($enrol->customtext3); - if (!empty($texto)) { - $mensaje = $this->process_mensaje($enrol->customtext3, $user, $course); - } else { - $mensaje = get_string("updatedenrolmessagedefault", "enrol_notificationeabc", $course); - } - - } else if (!empty($activarglobalenrolupdated) && !empty($plainmensajeupdateenrol)) { - $mensaje = $this->process_mensaje($mensajeupdateenrol, $user, $course); - } else { - $mensaje = get_string("updatedenrolmessagedefault", "enrol_notificationeabc", $course); + if (!empty($enrolupdatealert) || !empty($globalenrolupdatealert)) { + $message = $this->get_message($enrolupdatemessage, $user, $course); } break; - default: break; } - $soporte = core_user::get_support_user(); - - $sender = get_admin(); - - if (!empty($enrol) && !empty($enrol->customchar1)) { - $sender->email = $enrol->customchar1; - } else { - $sender->email = $soporte->email; - } - - if (!empty($enrol) && !empty($enrol->customchar2)) { - $sender->firstname = $enrol->customchar2; - } else { - $sender->firstname = $soporte->firstname; - } - - $sender->lastname = $soporte->lastname; + $supportuser = \core_user::get_support_user(); $eventdata = new \core\message\message(); $eventdata->courseid = $course->id; $eventdata->modulename = 'moodle'; $eventdata->component = 'enrol_notificationeabc'; $eventdata->name = 'notificationeabc_enrolment'; - $eventdata->userfrom = $sender; + $eventdata->userfrom = $supportuser; $eventdata->userto = $user->id; $eventdata->subject = get_string('subject', 'enrol_notificationeabc'); $eventdata->fullmessage = ''; $eventdata->fullmessageformat = FORMAT_HTML; - $eventdata->fullmessagehtml = $mensaje; + $eventdata->fullmessagehtml = $message; $eventdata->smallmessage = ''; $strdata = new stdClass(); $strdata->username = $user->username; @@ -166,20 +133,22 @@ public function enviarmail(stdClass $user, stdClass $course, $type) { // Procesa el mensaje para aceptar marcadores. /** * Proccess message method - * @param String $mensaje el mensaje en bruto - * @param stdClass $user instancia usuario - * @param stdClass $course instancia curso - * @return String el mensaje procesado + * @param String $message the raw message + * @param stdClass $user user instance + * @param stdClass $course course instance + * @return String the processed message */ - public function process_mensaje($mensaje, stdClass $user, stdClass $course) { + public function get_message($message, stdClass $user, stdClass $course) { global $CFG; - $m = $mensaje; + + $m = $message; $url = new moodle_url($CFG->wwwroot . '/course/view.php', array('id' => $course->id)); $m = str_replace('{COURSENAME}', $course->fullname, $m); $m = str_replace('{USERNAME}', $user->username, $m); - $m = str_replace('{NOMBRE}', $user->firstname, $m); - $m = str_replace('{APELLIDO}', $user->lastname, $m); + $m = str_replace('{FIRSTNAME}', $user->firstname, $m); + $m = str_replace('{LASTNAME}', $user->lastname, $m); $m = str_replace('{URL}', $url, $m); + return $m; } @@ -191,12 +160,14 @@ public function process_mensaje($mensaje, stdClass $user, stdClass $course) { */ public function get_newinstance_link($courseid) { global $DB; + $numenrol = $DB->count_records('enrol', array('courseid' => $courseid, 'enrol' => 'notificationeabc')); $context = context_course::instance($courseid, MUST_EXIST); if (!has_capability('enrol/notificationeabc:manage', $context) or $numenrol >= 1) { return null; } + return new moodle_url('/enrol/notificationeabc/edit.php', array('courseid' => $courseid)); } @@ -208,17 +179,13 @@ public function get_newinstance_link($courseid) { public function get_instance_defaults() { $fields = array(); - $fields['customtext1'] = $this->get_config('location'); - $fields['customtext2'] = $this->get_config('unenrolmessage'); - $fields['customtext3'] = $this->get_config('updatedenrolmessage'); + $fields['enrolmessage'] = $this->get_config('enrolmessage'); + $fields['unenrolmessage'] = $this->get_config('unenrolmessage'); + $fields['enrolupdatemessage'] = $this->get_config('enrolupdatemessage'); $fields['status'] = 1; - $fields['customint1'] = 0; - $fields['customint2'] = 0; - $fields['customint3'] = $this->get_config('activeenrolalert'); - $fields['customint4'] = $this->get_config('activeunenrolalert'); - $fields['customint5'] = $this->get_config('activeenrolupdatedalert'); - $fields['customchar1'] = $this->get_config('emailsender'); - $fields['customchar2'] = $this->get_config('namesender'); + $fields['enrolalert'] = $this->get_config('enrolalert'); + $fields['unenrolalert'] = $this->get_config('unenrolalert'); + $fields['enrolupdatealert'] = $this->get_config('enrolupdatealert'); return $fields; } @@ -232,32 +199,49 @@ public function get_instance_defaults() { public function get_action_icons(stdClass $instance) { global $OUTPUT; - if ($instance->enrol !== 'notificationeabc') { - throw new coding_exception('invalid enrol instance!'); - } $context = context_course::instance($instance->courseid); $icons = array(); if (has_capability('enrol/notificationeabc:manage', $context)) { $editlink = new moodle_url( - "/enrol/notificationeabc/edit.php", - array('courseid' => $instance->courseid, 'id' => $instance->id) + '/enrol/editinstance.php', + array('courseid' => $instance->courseid, 'id' => $instance->id, 'type' => 'notificationeabc') ); $icons[] = $OUTPUT->action_icon( $editlink, - new pix_icon( - 'i/edit', - get_string('edit'), - 'core', - array('class' => 'icon') - ) + new pix_icon( 't/edit', get_string('edit'), 'core', array('class' => 'icon iconsmall')) ); } return $icons; } + /** + * Is it possible to delete enrol instance via standard UI? + * + * @param object $instance + * @return bool + */ + public function can_delete_instance($instance) { + $context = context_course::instance($instance->courseid); + if (!has_capability('enrol/notificationeabc:manage', $context)) { + return false; + } + + return true; + } + + /** + * Is it possible to hide/show enrol instance via standard UI? + * + * @param stdClass $instance + * @return bool + */ + public function can_hide_show_instance($instance) { + $context = context_course::instance($instance->courseid); + return has_capability('enrol/notificationeabc:config', $context); + } /** * get info icons method @@ -270,5 +254,105 @@ public function get_info_icons(array $instances) { return $icons; } + /** + * We are a good plugin and don't invent our own UI/validation code path. + * + * @return boolean + */ + public function use_standard_editing_ui() { + return true; + } + + /** + * Return an array of valid options for the status. + * + * @return array + */ + protected function get_status_options() { + $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), + ENROL_INSTANCE_DISABLED => get_string('no')); + return $options; + } + + /** + * Add elements to the edit instance form. + * + * @param stdClass $instance + * @param MoodleQuickForm $mform + * @param context $context + * @return bool + */ + public function edit_instance_form($instance, MoodleQuickForm $mform, $context) { + + $textareaparams = array('rows' => 8, 'cols' => 60); + + $mform->addElement('text', 'name', get_string('custominstancename', 'enrol')); + $mform->setType('name', PARAM_RAW); + $mform->setDefault('name', get_string('pluginname', 'enrol_notificationeabc')); + + $options = $this->get_status_options(); + $mform->addElement('select', 'status', get_string('status', 'enrol_notificationeabc'), $options); + $mform->setDefault('status', $this->get_config('status')); + + // Enrol notifications -> 'enrolalert'. + $mform->addElement('advcheckbox', 'customint1', get_string('enrolalert', 'enrol_notificationeabc')); + $mform->addHelpButton('customint1', 'enrolalert', 'enrol_notificationeabc'); + $mform->setDefault('customint1', $this->get_config('enrolalert')); + + // Enrol notifications -> 'enrolmessage' + $mform->addElement('textarea', 'customtext1', get_string('enrolmessage', 'enrol_notificationeabc'), $textareaparams); + $mform->addHelpButton('customtext1', 'enrolmessage', 'enrol_notificationeabc'); + $mform->setType('customtext1', PARAM_RAW); + $mform->setDefault('customtext1', $this->get_config('enrolmessage')); + + // Unenrol notifications -> 'unenrolalert'. + $mform->addElement('advcheckbox', 'customint2', get_string('unenrolalert', 'enrol_notificationeabc')); + $mform->addHelpButton('customint2', 'unenrolalert', 'enrol_notificationeabc'); + $mform->setDefault('customint2', $this->get_config('unenrolalert')); + + // Unenrol notifications -> 'unenrolmessage'. + $mform->addElement('textarea', 'customtext2', get_string('unenrolmessage', 'enrol_notificationeabc'), $textareaparams); + $mform->addHelpButton('customtext2', 'unenrolmessage', 'enrol_notificationeabc'); + $mform->setType('customtext2', PARAM_RAW); + $mform->setDefault('customtext2', $this->get_config('unenrolmessage')); + + // Update enrolment notifications -> 'enrolupdatealert'. + $mform->addElement('advcheckbox', 'customint3', get_string('enrolupdatealert', 'enrol_notificationeabc')); + $mform->addHelpButton('customint3', 'enrolupdatealert', 'enrol_notificationeabc'); + $mform->setDefault('customint3', $this->get_config('enrolupdatealert')); + + // Update enrolment -> 'enrolupdatemessage'. + $mform->addElement('textarea', 'customtext3', get_string('enrolupdatemessage', 'enrol_notificationeabc'), $textareaparams); + $mform->addHelpButton('customtext3', 'enrolupdatemessage', 'enrol_notificationeabc'); + $mform->setType('customtext3', PARAM_RAW); + $mform->setDefault('customtext3', $this->get_config('enrolupdatemessage')); + + if (enrol_accessing_via_instance($instance)) { + $warntext = get_string('instanceeditselfwarningtext', 'core_enrol'); + $mform->addElement('static', 'selfwarn', get_string('instanceeditselfwarning', 'core_enrol'), $warntext); + } + } + + /** + * Perform custom validation of the data used to edit the instance. + * + * @param array $data array of ("fieldname"=>value) of submitted data + * @param array $files array of uploaded files "element_name"=>tmp_file_path + * @param object $instance The instance loaded from the DB + * @param context $context The context of the instance we are editing + * @return array of "element_name"=>"error_description" if there are errors, + * or an empty array if everything is OK. + * @return void + */ + public function edit_instance_validation($data, $files, $instance, $context) { + $errors = array(); + $validstatus = array_keys($this->get_status_options()); + $tovalidate = array('status' => $validstatus); + + $typeerrors = $this->validate_param_types($data, $tovalidate); + $errors = array_merge($errors, $typeerrors); + + return $errors; + } } // End of class. diff --git a/settings.php b/settings.php index 4d2c738..cf3ad3d 100644 --- a/settings.php +++ b/settings.php @@ -34,82 +34,64 @@ // Enrol notification. $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activeenrolalert', - get_string('activeenrolalert', 'enrol_notificationeabc'), - get_string('activeenrolalert_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/enrolalert', + get_string('enrolalert', 'enrol_notificationeabc'), + get_string('enrolalert_help', 'enrol_notificationeabc'), '', '1') ); $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activarglobal', - get_string('activarglobal', 'enrol_notificationeabc'), - get_string('activarglobal_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/globalenrolalert', + get_string('globalenrolalert', 'enrol_notificationeabc'), + get_string('globalenrolalert_help', 'enrol_notificationeabc'), '') ); - $settings->add(new admin_setting_heading( - 'enrol_notificationeabc_settings', - '', - get_string('pluginname_desc', 'enrol_notificationeabc'), - '') - ); - $settings->add(new admin_setting_confightmleditor( - 'enrol_notificationeabc/location', - get_string('location', 'enrol_notificationeabc'), - get_string('location_help', 'enrol_notificationeabc'), - '') + $settings->add(new admin_setting_configtextarea( + 'enrol_notificationeabc/enrolmessage', + get_string('enrolmessage', 'enrol_notificationeabc'), + get_string('enrolmessage_help', 'enrol_notificationeabc'), + null) ); // Unenrol notification. $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activeunenrolalert', - get_string('activeunenrolalert', 'enrol_notificationeabc'), - get_string('activeunenrolalert_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/unenrolalert', + get_string('unenrolalert', 'enrol_notificationeabc'), + get_string('unenrolalert_help', 'enrol_notificationeabc'), '', '1') ); $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activarglobalunenrolalert', - get_string('activarglobalunenrolalert', 'enrol_notificationeabc'), - get_string('activarglobalunenrolalert_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/globalunenrolalert', + get_string('globalunenrolalert', 'enrol_notificationeabc'), + get_string('globalunenrolalert_help', 'enrol_notificationeabc'), '') ); - $settings->add(new admin_setting_confightmleditor( + $settings->add(new admin_setting_configtextarea( 'enrol_notificationeabc/unenrolmessage', get_string('unenrolmessage', 'enrol_notificationeabc'), get_string('unenrolmessage_help', 'enrol_notificationeabc'), - '') + null) ); // Update enrol notification. $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activeenrolupdatedalert', - get_string('activeenrolupdatedalert', 'enrol_notificationeabc'), - get_string('activeenrolupdatedalert_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/enrolupdatealert', + get_string('enrolupdatealert', 'enrol_notificationeabc'), + get_string('enrolupdatealert_help', 'enrol_notificationeabc'), '', '1') ); $settings->add(new admin_setting_configcheckbox( - 'enrol_notificationeabc/activarglobalenrolupdated', - get_string('activarglobalenrolupdated', 'enrol_notificationeabc'), - get_string('activarglobalenrolupdated_help', 'enrol_notificationeabc'), + 'enrol_notificationeabc/globalenrolupdatealert', + get_string('globalenrolupdatealert', 'enrol_notificationeabc'), + get_string('globalenrolupdatealert_help', 'enrol_notificationeabc'), '') ); - $settings->add(new admin_setting_confightmleditor( - 'enrol_notificationeabc/updatedenrolmessage', - get_string('updatedenrolmessage', 'enrol_notificationeabc'), - get_string('updatedenrolmessage_help', 'enrol_notificationeabc'), - '') - ); - $settings->add(new admin_setting_configtext( - 'enrol_notificationeabc/emailsender', - get_string('emailsender', 'enrol_notificationeabc'), - get_string('emailsender_help', 'enrol_notificationeabc'), - '') - ); - $settings->add(new admin_setting_configtext( - 'enrol_notificationeabc/namesender', - get_string('namesender', 'enrol_notificationeabc'), - get_string('namesender_help', 'enrol_notificationeabc'), - '') + $settings->add(new admin_setting_configtextarea( + 'enrol_notificationeabc/enrolupdatemessage', + get_string('enrolupdatemessage', 'enrol_notificationeabc'), + get_string('enrolupdatemessage_help', 'enrol_notificationeabc'), + null) ); } diff --git a/version.php b/version.php index c67dd02..14d0a86 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017111700; +$plugin->version = 2018022200; $plugin->requires = 2016120503; $plugin->component = 'enrol_notificationeabc'; $plugin->maturity = MATURITY_STABLE;