From 0cdc3a790c6061452f9805b12c97dd458968f1ef Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Tue, 11 Mar 2014 17:39:15 -0300 Subject: [PATCH] =?UTF-8?q?Adicionada=20mensagem=20personalizada=20para=20?= =?UTF-8?q?exibir=20no=20form=20de=20matr=C3=ADcula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- edit.php | 3 +++ edit_form.php | 3 +++ lang/en/enrol_ilbead.php | 2 ++ lang/pt_br/enrol_ilbead.php | 4 +++- lib.php | 1 + locallib.php | 6 ++++++ unenrolilbead.php | 1 + 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/edit.php b/edit.php index bd05687..66a99b1 100644 --- a/edit.php +++ b/edit.php @@ -48,6 +48,7 @@ $plugin = enrol_get_plugin('ilbead'); if ($instanceid) { $instance = $DB->get_record('enrol', array('courseid'=>$course->id, 'enrol'=>'ilbead', 'id'=>$instanceid), '*', MUST_EXIST); + $instance->customtext2 = unserialize($instance->customtext2); } else { require_capability('moodle/course:enrolconfig', $context); @@ -102,6 +103,7 @@ if ($mform->is_cancelled()) { $instance->customint7 = $data->customint7; $instance->customint8 = $data->customint8; $instance->customtext1 = $data->customtext1; + $instance->customtext2 = serialize($data->customtext2); $instance->roleid = $data->roleid; $instance->enrolperiod = $data->enrolperiod; $instance->expirynotify = $data->expirynotify; @@ -130,6 +132,7 @@ if ($mform->is_cancelled()) { 'customint7' => $data->customint7, 'customint8' => $data->customint8, 'customtext1' => $data->customtext1, + 'customtext2' => serialize($data->customtext2), 'roleid' => $data->roleid, 'enrolperiod' => $data->enrolperiod, 'expirynotify' => $data->expirynotify, diff --git a/edit_form.php b/edit_form.php index 46dced0..e323f87 100644 --- a/edit_form.php +++ b/edit_form.php @@ -150,6 +150,9 @@ class enrol_ilbead_edit_form extends moodleform { $mform->addElement('textarea', 'customtext1', get_string('customwelcomemessage', 'enrol_ilbead'), array('cols'=>'60', 'rows'=>'8')); $mform->addHelpButton('customtext1', 'customwelcomemessage', 'enrol_ilbead'); + $mform->addElement('editor', 'customtext2', get_string('customenrolmessage', 'enrol_ilbead')); + $mform->addHelpButton('customtext2', 'customenrolmessage', 'enrol_ilbead'); + $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'courseid'); diff --git a/lang/en/enrol_ilbead.php b/lang/en/enrol_ilbead.php index fb1f641..60145ed 100644 --- a/lang/en/enrol_ilbead.php +++ b/lang/en/enrol_ilbead.php @@ -120,3 +120,5 @@ $string['coursename'] = 'Course name'; $string['timestart'] = 'Time start'; $string['timeend'] = 'Expected time end'; $string['maxongoingmessage'] = 'You are already enrolled in {$a} ILB/EAD courses, New enrollments will only be accepted after the completion of at least one of them.'; +$string['customenrolmessage'] = 'Custom enrol message'; +$string['customenrolmessage_help'] = 'A custom message may be displayed at enrol form as plain text or Moodle-auto format, including HTML tags and multi-lang tags.'; diff --git a/lang/pt_br/enrol_ilbead.php b/lang/pt_br/enrol_ilbead.php index bd0ff67..ec6a103 100644 --- a/lang/pt_br/enrol_ilbead.php +++ b/lang/pt_br/enrol_ilbead.php @@ -37,7 +37,7 @@ $string['defaultrole_desc'] = 'Selecione o papel que será atribuído aos usuár $string['enrolenddate'] = 'Data final de inscrição'; $string['enrolenddate_help'] = 'Se habilitado, usuários poderão se inscrever-se apenas até esta data.'; $string['enrolenddaterror'] = 'A data final de inscrição não pode ser anterior à data inicial de inscrição'; -$string['enrolme'] = 'Inscrever-se'; +$string['enrolme'] = 'Matricular-se'; $string['enrolperiod'] = 'Duração da inscrição'; $string['enrolperiod_desc'] = 'A quantidade de tempo que a inscrição será válida. Se for igual a zero, a duração da inscrição será ilimitada.'; $string['enrolperiod_help'] = 'A quantidade de tempo que a inscrição será válida, a partir do momento que o usuário se inscreve. Se desabilitado, a duração da inscrição será ilimitada.'; @@ -120,3 +120,5 @@ $string['coursename'] = 'Nome do curso'; $string['timestart'] = 'Data de início'; $string['timeend'] = 'Data prevista de término'; $string['maxongoingmessage'] = 'Você já está matriculado em {$a} curso(s) sem tutoria, Novas matrículas somente serão aceitas após a conclusão de pelo menos um deles.'; +$string['customenrolmessage'] = 'Mensagem personalizada de matrícula'; +$string['customenrolmessage_help'] = 'Uma mensagem personalizada que pode ser exibida no formulário de inscrição como um texto plano ou no padrão de autoformatação Moodle, incluindo tags HTML e multi-linguagem.'; diff --git a/lib.php b/lib.php index 49812ff..d86b945 100644 --- a/lib.php +++ b/lib.php @@ -501,6 +501,7 @@ class enrol_ilbead_plugin extends enrol_plugin { } $instance = $DB->get_record('enrol', array('id'=>$instanceid, 'enrol'=>$this->get_name()), '*', MUST_EXIST); + $instance->customtext2 = unserialize($instance->customtext2); $context = context_course::instance($instance->courseid); if ($users = get_enrolled_users($context, 'enrol/ilbead:manage')) { diff --git a/locallib.php b/locallib.php index fa1ea3e..96ef0ec 100644 --- a/locallib.php +++ b/locallib.php @@ -52,6 +52,12 @@ class enrol_ilbead_enrol_form extends moodleform { $heading = $plugin->get_instance_name($instance); $mform->addElement('header', 'ilbeadheader', $heading); + if (trim($instance->customtext2) !== '') { + $instance->customtext2 = unserialize($instance->customtext2); + $message = format_text($instance->customtext2['text'], $instance->customtext2['format']); + $mform->addElement('static', 'notice', '', $message); + } + if ($instance->customint3 > 0) { // Max enrol limit specified. $count = $DB->count_records('user_enrolments', array('enrolid'=>$instance->id)); diff --git a/unenrolilbead.php b/unenrolilbead.php index 545a89b..d4a5d10 100644 --- a/unenrolilbead.php +++ b/unenrolilbead.php @@ -28,6 +28,7 @@ $enrolid = required_param('enrolid', PARAM_INT); $confirm = optional_param('confirm', 0, PARAM_BOOL); $instance = $DB->get_record('enrol', array('id'=>$enrolid, 'enrol'=>'ilbead'), '*', MUST_EXIST); +$instance->customtext2 = unserialize($instance->customtext2); $course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST); $context = context_course::instance($course->id, MUST_EXIST);