Merge branch 'wip-MDL-62526-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2018-07-04 04:19:12 +02:00
3 changed files with 15 additions and 4 deletions
+2
View File
@@ -111,6 +111,8 @@ $string['nosearch'] = 'Don\'t publish hub or courses';
$string['notregisteredonhub'] = 'Your administrator needs to register this site with Moodle.net before you can share a course.';
$string['operation'] = 'Actions';
$string['participantnumberaverage'] = 'Average number of participants ({$a})';
$string['policyagreed'] = 'Privacy notice and data processing agreement';
$string['policyagreeddesc'] = 'I agree to the <a href="{$a}" target="_blank">Privacy notice and data processing agreement</a> for Moodle.net';
$string['postaladdress'] = 'Postal address';
$string['postaladdress_help'] = 'Postal address of this site, or of the entity represented by this site.';
$string['postsnumber'] = 'Number of posts ({$a})';
+2 -1
View File
@@ -43,7 +43,8 @@ class registration {
/** @var Fields used in a site registration form.
* IMPORTANT: any new fields with non-empty defaults have to be added to CONFIRM_NEW_FIELDS */
const FORM_FIELDS = ['name', 'description', 'contactname', 'contactemail', 'contactphone', 'imageurl', 'privacy', 'street',
'regioncode', 'countrycode', 'geolocation', 'contactable', 'emailalert', 'emailalertemail', 'commnews', 'commnewsemail', 'language'];
'regioncode', 'countrycode', 'geolocation', 'contactable', 'emailalert', 'emailalertemail', 'commnews', 'commnewsemail',
'language', 'policyagreed'];
/** @var List of new FORM_FIELDS or siteinfo fields added indexed by the version when they were added.
* If site was already registered, admin will be promted to confirm new registration data manually. Until registration is manually confirmed,
+11 -3
View File
@@ -64,7 +64,8 @@ class site_registration_form extends \moodleform {
'language' => explode('_', current_language())[0],
'geolocation' => '',
'emailalert' => 1,
'commnews' => 1
'commnews' => 1,
'policyagreed' => 0
]);
@@ -151,6 +152,10 @@ class site_registration_form extends \moodleform {
$mform->addElement('hidden', 'imageurl', ''); // TODO: temporary.
$mform->setType('imageurl', PARAM_URL);
$mform->addElement('checkbox', 'policyagreed', get_string('policyagreed', 'hub'),
get_string('policyagreeddesc', 'hub', HUB_MOODLEORGHUBURL . '/privacy'));
$mform->addRule('policyagreed', $strrequired, 'required', null, 'client');
$mform->addElement('header', 'sitestats', get_string('sendfollowinginfo', 'hub'));
$mform->setExpanded('sitestats', !empty($highlightfields));
$mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $siteinfo['url']);
@@ -182,7 +187,9 @@ class site_registration_form extends \moodleform {
if (empty($siteinfo['commnewsnewemail'])) {
$siteinfo['commnewsemail'] = '';
}
$this->set_data($siteinfo);
// Set data. Always require to check policyagreed even if it was checked earlier.
$this->set_data(['policyagreed' => 0] + $siteinfo);
}
/**
@@ -262,7 +269,8 @@ class site_registration_form extends \moodleform {
if (debugging('', DEBUG_DEVELOPER)) {
// Display debugging message for developers who added fields to the form and forgot to add them to registration::FORM_FIELDS.
$keys = array_diff(array_keys((array)$data), ['returnurl', 'mform_isexpanded_id_sitestats', 'submitbutton', 'update']);
$keys = array_diff(array_keys((array)$data),
['returnurl', 'mform_isexpanded_id_sitestats', 'submitbutton', 'update']);
if ($extrafields = array_diff($keys, registration::FORM_FIELDS)) {
debugging('Found extra fields in the form results: ' . join(', ', $extrafields), DEBUG_DEVELOPER);
}