Commit 12016c00 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1978425: Create categories for the registered data



For displaying better in Admin home -> Register

Also move the html generation out to a .tpl file

Change-Id: I3f908ebe610548f7dfea155bfd59c94a74845779
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent c819851b
Loading
Loading
Loading
Loading
+15 −40
Original line number Diff line number Diff line
@@ -20,50 +20,25 @@ require(dirname(dirname(__FILE__)).'/init.php');
require(get_config('libroot') . 'registration.php');
define('TITLE', get_string('Registration', 'admin'));

// This runs register_site in registration.php, which is what displays the form and the button for emails.
if (!get_config('registration_lastsent')
    || get_config('new_registration_policy')) {
    $register = register_site();
    if (get_config('new_registration_policy')) {
        $registration_update = get_string('newregistrationpolicyinfo', 'admin');
    }
}
else {
    $registered = register_site(true);
    $firstregistered = (get_config('registration_firstsent'));
    // The $firstregistered might be false if site registered before we kept this info. Otherwise format as date.
// This runs register_site in lib/registration.php, which is what displays the form.

$registration_update = get_config('new_registration_policy') ? get_string('newregistrationpolicyinfo1', 'admin') : '';
$registerinfo = register_site();

// See if the site is currently registered
$isregistered = get_config('registration_sendweeklyupdates');
// The $firstregistered might be false if site registered before we began to keep this information.
$firstregistered = get_config('registration_firstsent');
if ($firstregistered) {
    $firstregistered = format_date($firstregistered);
}
}

$smarty = smarty();

setpageicon($smarty, 'icon-star');

if (isset($register)) {
    $smarty->assign('register', $register);
}
else if (isset($registered)) {
    $smarty->assign('registered', $registered);
$smarty->assign('registrationupdate', $registration_update);
$smarty->assign('isregistered', $isregistered);
$smarty->assign('registerinfo', $registerinfo);
$smarty->assign('firstregistered', $firstregistered);
}

$js = <<<EOF
jQuery(function($) {
    function update_weeklyupdates_options() {
        var showweeklyupdates = $('#register_registeryesno').prop('checked');
        if (showweeklyupdates) {
            $('#register_sendweeklyupdates_container').removeClass('hidden');
        }
        else {
            $('#register_sendweeklyupdates_container').addClass('hidden');
        }
    }
    $('#register_registeryesno').on('click', update_weeklyupdates_options);
    update_weeklyupdates_options();
});
EOF;

$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->display('admin/registersite.tpl');
+13 −12
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ $string['cliinstallingmahara'] = 'Installing Mahara';
$string['versionnumber'] = 'Version: %s';
$string['plugintype'] = 'Plugin: %s';
$string['updateeventlogconfigoption'] = 'The value for $cfg->eventloglevel may need to be updated from "masq" to "masquerade" in your config.php file.';
$string['registrationisoptout'] = 'Anonymous registration data is now opt-out';

// CLI upgrade script
$string['cli_upgrade_description'] = 'Upgrade the Mahara database and data to the version of Mahara installed.';
@@ -286,31 +287,31 @@ $string['filemissingdesc'] = 'File %s%s is missing from server';
// Register your Mahara
$string['Field'] = 'Field';
$string['Value'] = 'Value';
$string['dataincluded'] = 'Data included';
$string['datathathavebeensent'] = 'Data that has been sent';
$string['sendweeklyupdates'] = 'Send weekly updates';
$string['sendweeklyupdatesdescription'] = 'Allow your site to send weekly updates to <a href="https://mahara.org/">mahara.org</a> with some statistics about your site.';
$string['newregistrationpolicyinfo'] = '<p>We have updated our registration data policy to require registered sites to provide weekly updates of their data. Please follow the link below to confirm or remove your registration.</p>';
$string['registerwithmahara'] = 'Register with mahara.org';
$string['registerwithmaharadescription'] = 'Once your site is registered with the Mahara project, you cannot unregister it.';
$string['newregistrationpolicyinfo1'] = '<ul><li>We have updated our registration data policy to require sites to opt out of providing weekly updates of anonymous data to gain better insight into how Mahara is used.</li><li>We have altered what anonymous data we collect.</li></ul>';
$string['registerwithmahara1'] = 'Opt out from the data collection';
$string['registerwithmaharadescription1'] = 'You can opt out from sending anonymised data to the Mahara project for your site. We encourage you to keep your site registered though to assist the Mahara project team in the product development.';
$string['Register'] = 'Register';
$string['Registration'] = 'Registration';
$string['registrationcancelled'] = 'You can choose to register at any time by going to the <a href="%sadmin/registersite.php">site registration page</a>.';
$string['registrationfailedtrylater'] = 'Registration failed with error code %s. Please try again later.';
$string['registrationoptoutsuccessful'] = 'Registration opt-out successful - no more data will be sent.';
$string['registrationsuccessfulthanksforregistering'] = 'Registration successful - thanks for registering.';
$string['registermaharasite'] = 'Site registration';
$string['registeryoursitesummary'] = '
<p>Registering your Mahara site with <a href="https://mahara.org/">mahara.org</a> helps us to get a picture of the Mahara installations around the world.</p>';
$string['registeryourmaharasitedetail'] = '
<p>You can register your Mahara site with the Mahara project. Registration is free and helps us get a picture of the Mahara installations around the world.</p>
<p>If you decide to send weekly updates, you can see the information that will be sent to the Mahara project. Nothing that can personally identify any person on your site will be sent.</p>';
$string['registeryourmaharasitedetail1'] = '
<p>Sites are registered with the Mahara project automatically. Registration is free and helps us get a picture of the Mahara installations around the world and how they are used.</p>
<p>The Mahara project does not collect personal nor person-identifiable data. Most data is collected in aggregated form to allow the project to identify trends. Below you can see what data is collected and sent on a weekly basis.</p>
<p>If you have any questions for the data collection, please <a href="mailto:info@mahara.org?subject=Site registration data collection">get in touch</a>.</p>';
$string['sendingweeklyupdates1'] = 'You are sending weekly updates.';
$string['notsendingweeklyupdates'] = 'You are not sending weekly updates.';
$string['siteisregisteredsince'] = 'Your site has been registered with <a href="https://mahara.org/">mahara.org</a> since %s.';
$string['siteisregistered'] = 'Your site is registered with <a href="https://mahara.org/">mahara.org</a>.';
$string['siteregistrationpolicy'] = '<p>To ensure our statistics show accurately how Mahara is being used, registration now includes sending us weekly updates. Please review and confirm your registration by clicking &quot;Save&quot; below.</p>';
$string['siteisregisteredsince1'] = 'Your site has been registered with <a href="https://mahara.org/">mahara.org</a> since %s.';
$string['sitenotregistered'] = 'Currently, your site is not registered with the Mahara project. Opt in below to help us learn more about your usage.';
$string['siteisregistered1'] = 'Your site is registered with <a href="https://mahara.org/">mahara.org</a> and is sending weekly data.';
$string['siteregistrationpolicy1'] = 'The registration policy has changed in the following ways';
$string['startsendingdata'] = 'Your site is sending weekly updates to <a href="https://mahara.org/">mahara.org</a>';
$string['stoppedsendingdata'] = 'The weekly updates have been stopped';

// Close site
$string['Close'] = 'Close';
+141 −183

File changed.

Preview size limit exceeded, changes collapsed.

+12 −0
Original line number Diff line number Diff line
@@ -2470,6 +2470,18 @@ function xmldb_core_upgrade($oldversion=0) {
            set_config('eventloglevel', 'masquerade');
            log_warn(get_string('updateeventlogconfigoption', 'admin'), true, false);
        }
        log_warn(get_string('registrationisoptout', 'admin'), true, false);
        set_config('new_registration_policy', true);
        if (!get_config('registration_sendweeklyupdates')) {
            require_once('registration.php');
            list($status, $message) = register_again(true);
            if ($status == 'error') {
                log_warn($message, true, false);
            }
            else {
                log_info($message);
            }
        }
    }

    return $status;
+1 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ $manual_link_map = array(
    "" => "", // default - means go to manual homepage
    "adminhome|home" => "administration/overview.html#admin-home",
    "adminhome|registersite" => "administration/overview.html#register-your-mahara-site",
    "adminhome|config|productionmode" => "administration/config_php.html#productionmode-enable-or-disable-production-mode",
    "blocktype|blocks" => "blocks/blocks.html",
    "configextensions|cleanurls" => "administration/extensions.html#clean-urls",
    "configextensions|filters" => "administration/extensions.html#html-filters",
Loading