Skip to content

Commit

Permalink
MDL-60108 registration: Simplify, add commnews and separate emails
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Oct 17, 2017
1 parent 9a316f3 commit af925a5
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 106 deletions.
10 changes: 1 addition & 9 deletions admin/registration/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ class core_register_renderer extends plugin_renderer_base {
* @return string
*/
public function moodleorg_registration_message() {
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
get_string('statsmoodleorg', 'admin'),
array('target' => '_blank'));

$moodleorgregmsg = get_string('registermoodleorg', 'admin');
$items = array(get_string('registermoodleorgli1', 'admin'),
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
$moodleorgregmsg .= html_writer::alist($items);
return $moodleorgregmsg;
return format_text(get_string('registermoodlenet', 'admin'), FORMAT_MARKDOWN, ['noclean' => true]);
}
}
9 changes: 9 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,15 @@
$string['recaptchaprivatekey'] = 'ReCAPTCHA secret key';
$string['recaptchapublickey'] = 'ReCAPTCHA site key';
$string['register'] = 'Register your site';
$string['registermoodlenet'] = 'We\'d love to stay in touch for important things for your Moodle site!
By registering,
* You are contributing to our collective knowledge about the users of Moodle which helps us improve Moodle and all our community services
* You’ll be one of the first to find out about important notifications such as security alerts and new Moodle releases.
* You can access and activate mobile push notifications from your Moodle site through our free [Moodle Mobile app](https://download.moodle.org/mobile/)
* Optionally, your site can be included as a proud member and supporter of the Moodle community on the [list of registered sites](https://moodle.net/stats).
';
$string['registermoodleorg'] = 'When you register your site';
$string['registermoodleorgli1'] = 'You are added to a low-volume mailing list for important notifications such as security alerts and new releases of Moodle.';
$string['registermoodleorgli2'] = 'Statistics about your site will be added to the {$a} of the worldwide Moodle community.';
Expand Down
2 changes: 2 additions & 0 deletions lang/en/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,5 @@ moodleorghubname,core_admin
hubs,core_admin
quickdownloadcalendar,core_calendar
ical,core_calendar
privacy,core_hub
privacy_help,core_hub
37 changes: 22 additions & 15 deletions lang/en/hub.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@
$string['postaladdress_help'] = 'Postal address of this site, or of the entity represented by this site.';
$string['postsnumber'] = 'Number of posts ({$a})';
$string['previousregistrationdeleted'] = 'The previous registration has been deleted from {$a}. You can restart the registration process. Thank you.';
$string['privacy'] = 'Privacy';
$string['privacy_help'] = 'The hub may want to display a list of registered sites. If it does then you can choose whether or not you want to appear on that list.';
$string['publicationinfo'] = 'Course publication information';
$string['publishcourse'] = 'Publish {$a}';
$string['publishcourseon'] = 'Publish on {$a}';
Expand Down Expand Up @@ -152,30 +150,36 @@
$string['sharepublication_help'] = 'Uploading this course to a community server will enable people to download it and install it on their own Moodle sites.';
$string['siteadmin'] = 'Administrator';
$string['siteadmin_help'] = 'The full name of the site administrator.';
$string['sitecommnews'] = 'Updates about Moodle news and features';
$string['sitecommnews_help'] = 'You have the option of subscribing to our low volume email list including a newsletter about happenings in the Moodle community. ';
$string['sitecommnewsno'] = 'No, I do not want to receive any email from Moodle HQ';
$string['sitecommnewsyes'] = 'Yes please, include me in Moodle’s regular e-newsletter updates';
$string['sitecountry'] = 'Country';
$string['sitecountry_help'] = 'The country your organisation is in.';
$string['sitecountry_help'] = 'The country your organisation or institution is located in.';
$string['sitedesc'] = 'Description';
$string['sitedesc_help'] = 'This description of your site may be shown in the site listing. Please use plain text only.';
$string['sitedesc_help'] = 'Provide some information about how you are using Moodle.';
$string['sitegeolocation'] = 'Geolocation';
$string['sitegeolocation_help'] = 'In future we may provide location-based searching in the hubs. If you want to specify the location for your site use a latitude/longitude value here (eg: -31.947884,115.871285). One way to find this is to use Google Maps.';
$string['siteemail'] = 'Email address';
$string['siteemail_help'] = 'You need to provide an email address so the hub administrator can contact you if necessary. This will not be used for any other purpose. It is recommended to enter a email address related to a position (example: [email protected]) and not directly to a person.';
$string['siteemail'] = 'Admin email address';
$string['siteemail_help'] = 'An email address is necessary so that Moodle HQ can contact you if required. It may also be used for other purposes as you allow below. We recommend a generic email address related to a position (eg.: [email protected]), not a personal address.';
$string['sitelang'] = 'Language';
$string['sitelang_help'] = 'Your site language will be displayed on the site listing.';
$string['sitelang_help'] = 'What is the main language used on your Moodle site?';
$string['sitename'] = 'Name';
$string['sitename_help'] = 'The name of the site will be shown on the site listing if the hub allows that.';
$string['sitephone'] = 'Phone';
$string['sitephone_help'] = 'Your phone number will only be seen by the hub administrator.';
$string['siteprivacy'] = 'Privacy';
$string['siteprivacynotpublished'] = 'Please do not publish this site';
$string['siteprivacypublished'] = 'Publish the site name only';
$string['siteprivacylinked'] = 'Publish the site name with a link';
$string['siteregistrationcontact'] = 'Contact form';
$string['siteregistrationcontact_help'] = 'If you allow it, other people may be able to contact you via a contact form on the hub. They will never be able to see your email address.';
$string['siteregistrationemail'] = 'Email notifications';
$string['siteregistrationemail_help'] = 'If you enable this the hub administrator may email you to inform you of important news like security issues.';
$string['siteprivacy'] = 'Site listing';
$string['siteprivacy_help'] = 'You can choose to have your site listed publicly in the list of registered sites, with or without a link to your site.';
$string['siteprivacynotpublished'] = 'Do not list my site';
$string['siteprivacypublished'] = 'Only display my site name';
$string['siteprivacylinked'] = 'Display my site name with the link';
$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.';
$string['siteregistrationemail'] = 'Notifications about important security and technical issues.';
$string['siteregistrationemail_help'] = 'You have the option of subscribing to our low volume email list for important news (on security issues or new releases).';
$string['siteregistrationupdated'] = 'Site registration updated';
$string['siterelease'] = 'Moodle release';
$string['sitereleasenum'] = 'Moodle release ({$a})';
$string['siterelease_help'] = 'Moodle release number of this site.';
$string['siteurl'] = 'Site URL';
$string['siteurl_help'] = 'The URL is the address of this site. If privacy settings allow people to see site addresses then this is the URL that will be used.';
Expand All @@ -200,6 +204,7 @@
$string['update'] = 'Update';
$string['updatesite'] = 'Update registration on {$a}';
$string['updatestatus'] = 'Check it now.';
$string['usedifferentemail'] = 'Use different email';
$string['urlalreadyregistered'] = 'Your site seems to be already registered on Moodle.net, which means something has gone wrong. Please contact the Moodle.net administrator to reset your registration so you can try again.';
$string['usersnumber'] = 'Number of users ({$a})';
$string['wrongtoken'] = 'The registration failed for some unknown reason (network?). Please try again.';
Expand Down Expand Up @@ -240,6 +245,8 @@
$string['notregisteredonmoodleorg'] = 'Your administrator needs to register this site with moodle.org.';
$string['orenterprivatehub'] = 'Alternatively, enter a private hub URL:';
$string['prioritise'] = 'Prioritise';
$string['privacy'] = 'Privacy';
$string['privacy_help'] = 'The hub may want to display a list of registered sites. If it does then you can choose whether or not you want to appear on that list.';
$string['private'] = 'Private';
$string['privatehuburl'] = 'Private hub URL';
$string['publichub'] = 'Public hub';
Expand Down
8 changes: 4 additions & 4 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,8 @@
$string['refreshingevents'] = 'Refreshing events';
$string['registration'] = 'Moodle registration';
$string['registrationcontact'] = 'Contact from the public';
$string['registrationcontactno'] = 'No, I do not want a contact form in the site listing';
$string['registrationcontactyes'] = 'Yes, provide a form for prospective Moodlers to contact me';
$string['registrationcontactno'] = 'No, I do not want to be contacted by other people';
$string['registrationcontactyes'] = 'Yes, provide a form for other Moodlers to contact me';
$string['registrationemail'] = 'Email notifications';
$string['registrationinfo'] = '<p>This page allows you to register your Moodle site with moodle.org. Registration is free.
The main benefit of registering is that you will be added to a low-volume mailing list
Expand All @@ -1567,9 +1567,9 @@
<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 want to receive email';
$string['registrationno'] = 'No, I do not want to receive any email from Moodle HQ';
$string['registrationsend'] = 'Send registration information to moodle.org';
$string['registrationyes'] = 'Yes, please notify me about important issues';
$string['registrationyes'] = 'Yes, notify me about important news (e.g. security issues or releases) ';
$string['reject'] = 'Reject';
$string['rejectdots'] = 'Reject...';
$string['reload'] = 'Reload';
Expand Down
47 changes: 45 additions & 2 deletions lib/classes/hub/registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use moodle_url;
use context_system;
use stdClass;
use html_writer;

/**
* Methods to use when publishing and searching courses on moodle.net
Expand All @@ -41,7 +42,7 @@ class registration {

/** @var Fields used in a site registration form */
const FORM_FIELDS = ['name', 'description', 'contactname', 'contactemail', 'contactphone', 'imageurl', 'privacy', 'street',
'regioncode', 'countrycode', 'geolocation', 'contactable', 'emailalert', 'language'];
'regioncode', 'countrycode', 'geolocation', 'contactable', 'emailalert', 'emailalertemail', 'commnews', 'commnewsemail', 'language'];

/** @var Site privacy: not displayed */
const HUB_SITENOTPUBLISHED = 'notdisplayed';
Expand Down Expand Up @@ -162,7 +163,6 @@ public static function get_site_info($defaults = []) {
$siteinfo['modulenumberaverage'] = average_number_of_courses_modules();

// Version and url.
$siteinfo['moodleversion'] = $CFG->version;
$siteinfo['moodlerelease'] = $CFG->release;
$siteinfo['url'] = $CFG->wwwroot;

Expand All @@ -185,6 +185,49 @@ public static function get_site_info($defaults = []) {
return $siteinfo;
}

/**
* Human-readable summary of data that will be sent to moodle.net
*
* @param array $siteinfo result of get_site_info()
* @return string
*/
public static function get_stats_summary($siteinfo) {
$summary = html_writer::tag('p', get_string('sendfollowinginfo_help', 'hub')) .
html_writer::start_tag('ul');

$mobileservicesenabled = $siteinfo['mobileservicesenabled'] ? get_string('yes') : get_string('no');
$mobilenotificationsenabled = $siteinfo['mobilenotificationsenabled'] ? get_string('yes') : get_string('no');
$moodlerelease = $siteinfo['moodlerelease'];
if (preg_match('/^(\d+\.\d.*?)[\. ]/', $moodlerelease, $matches)) {
$moodlerelease = $matches[1];
}
$senddata = [
'moodlerelease' => get_string('sitereleasenum', 'hub', $moodlerelease),
'courses' => get_string('coursesnumber', 'hub', $siteinfo['courses']),
'users' => get_string('usersnumber', 'hub', $siteinfo['users']),
'enrolments' => get_string('roleassignmentsnumber', 'hub', $siteinfo['enrolments']),
'posts' => get_string('postsnumber', 'hub', $siteinfo['posts']),
'questions' => get_string('questionsnumber', 'hub', $siteinfo['questions']),
'resources' => get_string('resourcesnumber', 'hub', $siteinfo['resources']),
'badges' => get_string('badgesnumber', 'hub', $siteinfo['badges']),
'issuedbadges' => get_string('issuedbadgesnumber', 'hub', $siteinfo['issuedbadges']),
'participantnumberaverage' => get_string('participantnumberaverage', 'hub',
format_float($siteinfo['participantnumberaverage'], 2)),
'modulenumberaverage' => get_string('modulenumberaverage', 'hub',
format_float($siteinfo['modulenumberaverage'], 2)),
'mobileservicesenabled' => get_string('mobileservicesenabled', 'hub', $mobileservicesenabled),
'mobilenotificationsenabled' => get_string('mobilenotificationsenabled', 'hub', $mobilenotificationsenabled),
'registereduserdevices' => get_string('registereduserdevices', 'hub', $siteinfo['registereduserdevices']),
'registeredactiveuserdevices' => get_string('registeredactiveuserdevices', 'hub', $siteinfo['registeredactiveuserdevices']),
];

foreach ($senddata as $key => $str) {
$summary .= html_writer::tag('li', $str, ['class' => 'site' . $key]);
}
$summary .= html_writer::end_tag('ul');
return $summary;
}

/**
* Save registration info locally so it can be retrieved when registration needs to be updated
*
Expand Down
Loading

0 comments on commit af925a5

Please sign in to comment.