This commit is contained in:
Huong Nguyen 2025-01-14 09:10:01 +07:00
commit 61911e21d1
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
3 changed files with 30 additions and 9 deletions

View File

@ -145,3 +145,6 @@ errordeletingquestionsfromcategory,core_question
importantupdates_content,core_admin
importantupdates_title,core_admin
advancedelement,core_form
sitecommnews,core_hub
sitecommnews_help,core_hub
sitecommnewsyes,core_hub

View File

@ -64,6 +64,8 @@ $string['errorotherhubsnotsupported'] = 'This page can no longer be used for reg
$string['errorws'] = '{$a}';
$string['errorwstokenreset'] = '{$a}. Registration token on this site has been reset. You can now register your site again.';
$string['errorregistrationupdate'] = 'An error occurred during registration update ({$a})';
$string['experttipsandinsights'] = 'Expert tips and insights';
$string['experttipsandinsightsdesc'] = 'Yes, sign me up for exclusive tips, strategies, and insights from Moodle experts and Certified Partners. Update your preferences or unsubscribe anytime, and view our <a href="{$a}" target="_blank">Privacy Policy</a> for more information.';
$string['geolocation'] = 'Geolocation';
$string['geolocation_help'] = 'In future we may provide location-based searching. If you want to specify the location for your course use a latitude/longitude value here (eg: -31.947884,115.871285). One way to find this is to use Google Maps.';
$string['imageurl'] = 'Image URL';
@ -130,9 +132,6 @@ $string['sendfollowinginfo_help'] = 'The following information will be sent to M
$string['sent'] = '...finished';
$string['siteadmin'] = 'Administrator';
$string['siteadmin_help'] = 'The full name of the site administrator.';
$string['sitecommnews'] = 'Moodle newsletter';
$string['sitecommnews_help'] = 'You have the option of subscribing to our Moodle newsletter. You may unsubscribe at any time.';
$string['sitecommnewsyes'] = 'Yes, I would like to receive the Moodle newsletter';
$string['sitecountry'] = 'Country';
$string['sitecountry_help'] = 'The country your organisation or institution is located in.';
$string['sitedesc'] = 'Description';
@ -204,3 +203,8 @@ $string['sitecommnewsno'] = 'No, I do not wish to receive any emails';
$string['registerwithmoodleorginfoapp'] = 'About the Moodle app';
$string['siteregistrationcontact'] = 'Display contact form';
$string['siteregistrationcontact_help'] = 'If you allow it, other people in our Moodle community (who need a login account) can contact you via a form on our Moodle community site. However, they will never be able to see your email address.';
// Deprecated since 5.0.
$string['sitecommnews'] = 'Moodle newsletter';
$string['sitecommnews_help'] = 'You have the option of subscribing to our Moodle newsletter. You may unsubscribe at any time.';
$string['sitecommnewsyes'] = 'Yes, I would like to receive the Moodle newsletter';

View File

@ -27,6 +27,8 @@ defined('MOODLE_INTERNAL') || die();
use context_course;
use stdClass;
use html_writer;
use moodle_url;
global $CFG;
require_once($CFG->libdir . '/formslib.php');
@ -139,11 +141,14 @@ class site_registration_form extends \moodleform {
$this->add_checkbox_with_email('emailalert', 'siteregistrationemail', false, get_string('registrationyes'));
$privacyurl = new moodle_url('https://moodle.com/privacy-notice/');
$experttipsandinsightsdesc = html_writer::span(get_string('experttipsandinsightsdesc', 'hub', $privacyurl->out()));
$this->add_checkbox_with_email(
'commnews',
'sitecommnews',
in_array('commnews', $highlightfields),
get_string('sitecommnewsyes', 'hub')
elementname: 'commnews',
stridentifier: 'experttipsandinsights',
highlight: in_array('commnews', $highlightfields),
checkboxtext: $experttipsandinsightsdesc,
showhelp: false,
);
// TODO site logo.
@ -210,8 +215,15 @@ class site_registration_form extends \moodleform {
* @param string $stridentifier
* @param bool $highlight highlight as a new field
* @param string $checkboxtext The text to show after the text.
* @param bool $showhelp Show the help icon.
*/
protected function add_checkbox_with_email($elementname, $stridentifier, $highlight = false, string $checkboxtext = '') {
protected function add_checkbox_with_email(
string $elementname,
string $stridentifier,
bool $highlight = false,
string $checkboxtext = '',
bool $showhelp = true,
): void {
$mform = $this->_form;
$group = [
@ -231,7 +243,9 @@ class site_registration_form extends \moodleform {
$mform->hideif($elementname . 'email', $elementname . 'newemail', 'notchecked');
$mform->setType($elementname, PARAM_INT);
$mform->setType($elementname . 'email', PARAM_RAW_TRIMMED); // E-mail will be validated in validation().
$mform->addHelpButton($elementname . 'group', $stridentifier, 'hub');
if ($showhelp) {
$mform->addHelpButton($elementname . 'group', $stridentifier, 'hub');
}
}