MDL-71460 hub: Use checkboxes instead of dropdowns
Change the yes/no dropdowns to a checkbox. Defaults to unchecked.
This commit is contained in:
+5
-3
@@ -120,13 +120,12 @@ $string['roleassignmentsnumber'] = 'Number of role assignments ({$a})';
|
||||
$string['search'] = 'Search';
|
||||
$string['sendingsize'] = 'Please wait the course file is uploading ({$a->total}Mb)...';
|
||||
$string['sendfollowinginfo'] = 'More information';
|
||||
$string['sendfollowinginfo_help'] = 'The following information will be sent to contribute to overall statistics only. It will not be made public on any site listing.';
|
||||
$string['sendfollowinginfo_help'] = 'The following information will be sent to Moodle each time your site registration is updated (by default weekly, when the \'Site registration\' scheduled task is run). The information contributes to overall statistics only and will not be made public on any site listing.';
|
||||
$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['sitecommnewsno'] = 'No, I do not wish to receive any emails';
|
||||
$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.';
|
||||
@@ -235,4 +234,7 @@ $string['unpublishcourse'] = 'Stop sharing {$a}';
|
||||
$string['updatesite'] = 'Update registration on {$a}';
|
||||
$string['updatestatus'] = 'Check it now.';
|
||||
$string['unregisterfrom'] = 'Unregister from {$a}';
|
||||
$string['unregisterexplained'] = 'If the site with URL {$a} is registered, then its registration will be removed.';
|
||||
$string['unregisterexplained'] = 'If the site with URL {$a} is registered, then its registration will be removed.';
|
||||
|
||||
// Deprecate since 3.11.
|
||||
$string['sitecommnewsno'] = 'No, I do not wish to receive any emails';
|
||||
|
||||
+1
-1
@@ -1706,7 +1706,6 @@ for important notifications such as security alerts and new releases of Moodle.<
|
||||
<p>If you choose, you can allow your site name, country and URL to be added to the public list of Moodle Sites.</p>
|
||||
<p>All new registrations are verified manually before they are added to the list, but once you are added you can update your registration (and your entry on the public list) at any time by resubmitting this form.</p>';
|
||||
$string['registrationinfotitle'] = 'Registration information';
|
||||
$string['registrationno'] = 'No, I do not wish to receive any emails';
|
||||
$string['registrationsend'] = 'Send registration information to moodle.org';
|
||||
$string['registrationyes'] = 'Yes, notify me of new Moodle releases, security alerts and other important news';
|
||||
$string['reject'] = 'Reject';
|
||||
@@ -2321,3 +2320,4 @@ $string['skypeid'] = 'Skype ID';
|
||||
$string['icqnumber'] = 'ICQ number';
|
||||
$string['msnid'] = 'MSN ID';
|
||||
$string['coursepreferences'] = 'Course preferences';
|
||||
$string['registrationno'] = 'No, I do not wish to receive any emails';
|
||||
|
||||
@@ -63,8 +63,8 @@ class site_registration_form extends \moodleform {
|
||||
'regioncode' => '-', // Not supported yet.
|
||||
'language' => explode('_', current_language())[0],
|
||||
'geolocation' => '',
|
||||
'emailalert' => 1,
|
||||
'commnews' => 1,
|
||||
'emailalert' => 0,
|
||||
'commnews' => 0,
|
||||
'policyagreed' => 0
|
||||
|
||||
]);
|
||||
@@ -138,15 +138,14 @@ class site_registration_form extends \moodleform {
|
||||
$mform->hideIf('contactable', 'privacy', 'eq', registration::HUB_SITENOTPUBLISHED);
|
||||
unset($options);
|
||||
|
||||
$this->add_select_with_email('emailalert', 'siteregistrationemail', [
|
||||
0 => get_string('registrationno'),
|
||||
1 => get_string('registrationyes'),
|
||||
]);
|
||||
$this->add_checkbox_with_email('emailalert', 'siteregistrationemail', false, get_string('registrationyes'));
|
||||
|
||||
$this->add_select_with_email('commnews', 'sitecommnews', [
|
||||
0 => get_string('sitecommnewsno', 'hub'),
|
||||
1 => get_string('sitecommnewsyes', 'hub'),
|
||||
], in_array('commnews', $highlightfields));
|
||||
$this->add_checkbox_with_email(
|
||||
'commnews',
|
||||
'sitecommnews',
|
||||
in_array('commnews', $highlightfields),
|
||||
get_string('sitecommnewsyes', 'hub')
|
||||
);
|
||||
|
||||
// TODO site logo.
|
||||
$mform->addElement('hidden', 'imageurl', ''); // TODO: temporary.
|
||||
@@ -195,12 +194,17 @@ class site_registration_form extends \moodleform {
|
||||
/**
|
||||
* Add yes/no select with additional checkbox allowing to specify another email
|
||||
*
|
||||
* @deprecated since Moodle 3.11 - MDL-71460 The form elements using this have been converted to checkboxes
|
||||
* @todo MDL-71472 - Will be deleted in 4.3
|
||||
* @see \core\hub\site_registration_form::add_checkbox_with_email()
|
||||
* @param string $elementname
|
||||
* @param string $stridentifier
|
||||
* @param array|null $options options for the select element
|
||||
* @param bool $highlight highlight as a new field
|
||||
*/
|
||||
protected function add_select_with_email($elementname, $stridentifier, $options = null, $highlight = false) {
|
||||
debugging('add_select_with_email() is deprecated. Please use add_checkbox_with_email() instead.', DEBUG_DEVELOPER);
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
if ($options === null) {
|
||||
@@ -228,6 +232,38 @@ class site_registration_form extends \moodleform {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add yes/no checkbox with additional checkbox allowing to specify another email
|
||||
*
|
||||
* @param string $elementname
|
||||
* @param string $stridentifier
|
||||
* @param bool $highlight highlight as a new field
|
||||
* @param string $checkboxtext The text to show after the text.
|
||||
*/
|
||||
protected function add_checkbox_with_email($elementname, $stridentifier, $highlight = false, string $checkboxtext = '') {
|
||||
$mform = $this->_form;
|
||||
|
||||
$group = [
|
||||
$mform->createElement('advcheckbox', $elementname, '', $checkboxtext, ['class' => 'pt-2']),
|
||||
$mform->createElement('static', $elementname . 'sep', '', '<br/>'),
|
||||
$mform->createElement('advcheckbox', $elementname . 'newemail', '', get_string('usedifferentemail', 'hub'),
|
||||
['onchange' => "this.form.elements['{$elementname}email'].focus();"]),
|
||||
$mform->createElement('text', $elementname . 'email', get_string('email'))
|
||||
];
|
||||
|
||||
$element = $mform->addElement('group', $elementname . 'group', get_string($stridentifier, 'hub'), $group, '', false);
|
||||
if ($highlight) {
|
||||
$element->setAttributes(['class' => $element->getAttribute('class') . ' needsconfirmation mark']);
|
||||
}
|
||||
$mform->hideif($elementname . 'email', $elementname, 'eq', 0);
|
||||
$mform->hideif($elementname . 'newemail', $elementname, 'eq', 0);
|
||||
$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');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation of the form data
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user