Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Privacy API support - wip.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Apr 10, 2018
1 parent e3ff48c commit 468d274
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 371 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
New in 3.4.1.1
==============
- NEW: Privacy API support. Requires Moodle 2017111302.00 3.4.2 (Build: 20180319)+. Analytics removed until such a time as their use with GDPR is clearer.

New in 3.4.1.0
==============
- FIX: Issue #850: Flip main content and blocks, RTL mode.
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ above to discuss your requirements.

Required version of Moodle
==========================
This version works with Moodle 3.4 version 2017111300.00 (Build: 20171113) and above within the 3.4 branch until the
This version works with Moodle 3.4.2 version 2017111302.00 (Build: 20180319) and above within the 3.4 branch until the
next release.

Please ensure that your hardware and software complies with 'Requirements' in 'Installing Moodle' on
Expand Down
29 changes: 18 additions & 11 deletions layout/tiles/analytics.php → classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@
* Essential is a clean and customizable theme.
*
* @package theme_essential
* @copyright 2016 Gareth J Barnard
* @copyright 2014 Gareth J Barnard, David Bezemer
* @copyright 2013 Julian Ridden
* @copyright 2018 Gareth J Barnard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
namespace theme_essential\privacy;

if (\theme_essential\toolbox::get_setting('analyticsenabled')) {
$analytics = \theme_essential\toolbox::get_setting('analytics');
if ($analytics === "piwik") {
require_once(\theme_essential\toolbox::get_tile_file('piwik'));
} else if ($analytics === "guniversal") {
require_once(\theme_essential\toolbox::get_tile_file('guniversal'));
defined('MOODLE_INTERNAL') || die();

/**
* The Essential theme does not store any user data.
*/
class provider implements \core_privacy\local\metadata\null_provider {

/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:nop';
}
}
}
55 changes: 55 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Essential is a clean and customizable theme.
*
* @package theme_essential
* @copyright 2018 Gareth J Barnard
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

function xmldb_theme_essential_upgrade($oldversion = 0) {

global $DB;
$dbman = $DB->get_manager();
$result = true;

if ($oldversion < 2017102903) {

$table = new xmldb_table('config_plugins');
if ($dbman->table_exists($table) == true) {
$conditions = array('plugin' => 'theme_essential', 'name' => 'populateme');
$settings = array('analyticsenabled', 'analytics', 'analyticssiteid', 'analyticsimagetrack', 'analyticssiteurl',
'analyticsuseuserid', 'analyticstrackingid', 'analyticstrackadmin', 'analyticscleanurl');
foreach ($settings as $setting) {
$conditions['name'] = $setting;
$DB->delete_records('config_plugins', $conditions);
}
}

upgrade_plugin_savepoint(true, 2017102903, 'theme', 'essential');
}

// Automatic 'Purge all caches'....
if ($oldversion < 2118041000) {
purge_all_caches();
}

return $result;
}
26 changes: 3 additions & 23 deletions lang/en/theme_essential.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,29 +865,6 @@
$string['ipadretinaicon'] = 'iPad Icon (Retina)';
$string['ipadretinaicondesc'] = 'Icon should be a PNG files sized 144px by 144px.';

// Analytics.
$string['analytics'] = 'Analytics';
$string['analyticsheadingsub'] = 'Powerful analytics for Moodle';
$string['analyticsdesc'] = 'Choose the type of analytics you want to insert and save to enable the other options.';
$string['analyticssiteid'] = 'Site ID';
$string['analyticssiteiddesc'] = 'Enter your Site ID';
$string['analyticstrackingid'] = 'Site ID';
$string['analyticstrackingiddesc'] = 'Enter your Tracking ID';
$string['analyticssiteurl'] = 'Analytics URL';
$string['analyticssiteurldesc'] = 'Enter your "Piwik Analytics" URL without http(s) or a trailing slash. For example "mysite.com/analytics".';
$string['analyticsenabled'] = 'Enabled';
$string['analyticsenableddesc'] = 'Enable analytics for Moodle';
$string['analyticsimagetrack'] = 'Image tracking';
$string['analyticscleanurl'] = 'Clean URLs';
$string['analyticscleanurldesc'] = 'Generate clean URL for in advanced tracking';
$string['analyticsimagetrackdesc'] = 'Enable Image Tracking for browsers with JavaScript disabled.';
$string['analyticstrackadmin'] = 'Tracking Admins';
$string['analyticstrackadmindesc'] = 'Enable tracking of Admin users (not recommended)';
$string['analyticsuseuserid'] = 'User ID';
$string['analyticsuseuseriddesc'] = 'Enable use of User ID in tracking.';
$string['analyticspiwik'] = 'Piwik';
$string['analyticsguniversal'] = 'Google Universal Analytics';

// Properties.
$string['properties'] = 'Properties';
$string['propertiessub'] = 'The properties';
Expand Down Expand Up @@ -963,3 +940,6 @@
$string['asconfigintlower'] = '{$a->value} is less than the lower range limit of {$a->lower}';
$string['asconfigintupper'] = '{$a->value} is greater than the upper range limit of {$a->upper}';
$string['asconfigintnan'] = '{$a->value} is not a number';

// Privacy.
$string['privacy:nop'] = 'The Essential theme stores lots of settings that pertain to its configuration. None of the settings are related to a specific user. It is your responsibilty to ensure that no user data is entered in any of the free text fields. Setting a setting will result in that action being logged within the core Moodle logging system against the user whom changed it, this is outside of the themes control, please see the core logging system for privacy compliance for this. The analytics settings and associated data in the database have been removed until this area is more understood from a legal perspective, as it was possible to request that userid\'s were recorded. Please examine the code carefully to be sure that it complies with your interpretation of your privacy laws. I am not a lawyer and my analysis is based on my interpretation. If you have any doubt then remove the theme forthwith.';
3 changes: 0 additions & 3 deletions layout/embedded.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google web fonts -->
<?php require_once(\theme_essential\toolbox::get_tile_file('fonts')); ?>
<!-- Start Analytics -->
<?php require_once(\theme_essential\toolbox::get_tile_file('analytics')); ?>
<!-- End Analytics -->
</head>

<body <?php echo $OUTPUT->body_attributes(); ?>>
Expand Down
3 changes: 0 additions & 3 deletions layout/popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google web fonts -->
<?php require_once(\theme_essential\toolbox::get_tile_file('fonts')); ?>
<!-- Start Analytics -->
<?php require_once(\theme_essential\toolbox::get_tile_file('analytics')); ?>
<!-- End Analytics -->
</head>

<body <?php echo $OUTPUT->body_attributes($bodyclasses); ?>>
Expand Down
3 changes: 0 additions & 3 deletions layout/secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google web fonts -->
<?php require_once(\theme_essential\toolbox::get_tile_file('fonts')); ?>
<!-- Start Analytics -->
<?php require_once(\theme_essential\toolbox::get_tile_file('analytics')); ?>
<!-- End Analytics -->
</head>

<body <?php echo $OUTPUT->body_attributes($bodyclasses); ?>>
Expand Down
101 changes: 0 additions & 101 deletions layout/tiles/guniversal.php

This file was deleted.

3 changes: 0 additions & 3 deletions layout/tiles/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
<?php require_once(\theme_essential\toolbox::get_tile_file('fonts')); ?>
<!-- iOS Homescreen Icons -->
<?php require_once(\theme_essential\toolbox::get_tile_file('iosicons')); ?>
<!-- Start Analytics -->
<?php require_once(\theme_essential\toolbox::get_tile_file('analytics')); ?>
<!-- End Analytics -->
</head>

<body <?php echo $OUTPUT->body_attributes($bodyclasses); ?>>
Expand Down
Loading

0 comments on commit 468d274

Please sign in to comment.