diff --git a/CHANGES.txt b/CHANGES.txt index da5cc41b..a5608ef8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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. diff --git a/README.txt b/README.txt index 2b0752b7..c2b7f673 100644 --- a/README.txt +++ b/README.txt @@ -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 diff --git a/layout/tiles/analytics.php b/classes/privacy/provider.php similarity index 62% rename from layout/tiles/analytics.php rename to classes/privacy/provider.php index 2f50306c..347cf359 100644 --- a/layout/tiles/analytics.php +++ b/classes/privacy/provider.php @@ -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'; } -} \ No newline at end of file +} diff --git a/db/upgrade.php b/db/upgrade.php new file mode 100644 index 00000000..a20c59c6 --- /dev/null +++ b/db/upgrade.php @@ -0,0 +1,55 @@ +. + +/** + * 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; +} \ No newline at end of file diff --git a/lang/en/theme_essential.php b/lang/en/theme_essential.php index 26a4e2a0..4bc6159d 100644 --- a/lang/en/theme_essential.php +++ b/lang/en/theme_essential.php @@ -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'; @@ -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.'; diff --git a/layout/embedded.php b/layout/embedded.php index 90faf220..eebadbc4 100644 --- a/layout/embedded.php +++ b/layout/embedded.php @@ -40,9 +40,6 @@ - - - body_attributes(); ?>> diff --git a/layout/popup.php b/layout/popup.php index 9608a235..c5cb6f19 100644 --- a/layout/popup.php +++ b/layout/popup.php @@ -41,9 +41,6 @@ - - - body_attributes($bodyclasses); ?>> diff --git a/layout/secure.php b/layout/secure.php index a9483bf9..678e8761 100644 --- a/layout/secure.php +++ b/layout/secure.php @@ -41,9 +41,6 @@ - - - body_attributes($bodyclasses); ?>> diff --git a/layout/tiles/guniversal.php b/layout/tiles/guniversal.php deleted file mode 100644 index 051cfad5..00000000 --- a/layout/tiles/guniversal.php +++ /dev/null @@ -1,101 +0,0 @@ -. - -/** - * Essential is a clean and customizable theme. - * - * Analytics - * - * This module provides extensive analytics on a platform of choice, - * currently support Google Analytics and Piwik - * - * @package theme_essential - * @copyright 2016 Gareth J Barnard - * @copyright 2014 David Bezemer , www.davidbezemer.nl - * @author David Bezemer , Bas Brands , Gavin Henrick - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die; - -function analytics_trackurl() { - global $DB, $PAGE; - $pageinfo = get_context_info_array($PAGE->context->id); - $trackurl = "'/"; - - // Adds course category name. - if (isset($pageinfo[1]->category)) { - if ($category = $DB->get_record('course_categories', array('id' => $pageinfo[1]->category))) { - $cats = explode("/", $category->path); - foreach (array_filter($cats) as $cat) { - if ($categorydepth = $DB->get_record("course_categories", array("id" => $cat))) { - $trackurl .= urlencode($categorydepth->name) . '/'; - } - } - } - } - - // Adds course full name. - if (isset($pageinfo[1]->fullname)) { - if (isset($pageinfo[2]->name)) { - $trackurl .= urlencode($pageinfo[1]->fullname) . '/'; - } else if ($PAGE->user_is_editing()) { - $trackurl .= urlencode($pageinfo[1]->fullname) . '/' . get_string('edit'); - } else { - $trackurl .= urlencode($pageinfo[1]->fullname) . '/' . get_string('view'); - } - } - - // Adds activity name. - if (isset($pageinfo[2]->name)) { - $trackurl .= urlencode($pageinfo[2]->modname) . '/' . urlencode($pageinfo[2]->name); - } - - $trackurl .= "'"; - return $trackurl; -} - -function insert_analytics_tracking() { - global $PAGE; - $trackingid = \theme_essential\toolbox::get_setting('analyticstrackingid'); - $trackadmin = \theme_essential\toolbox::get_setting('analyticstrackadmin'); - $cleanurl = \theme_essential\toolbox::get_setting('analyticscleanurl'); - $tracking = ''; - - if ($cleanurl) { - $addition = "{'hitType' : 'pageview', - 'page' : " . analytics_trackurl() . ", - 'title' : '" . addslashes($PAGE->heading) . "' - }"; - } else { - $addition = "'pageview'"; - } - - if (!is_siteadmin() || $trackadmin) { - $tracking = " - "; - } - return $tracking; -} - -echo insert_analytics_tracking(); \ No newline at end of file diff --git a/layout/tiles/header.php b/layout/tiles/header.php index 47074806..97d135d2 100755 --- a/layout/tiles/header.php +++ b/layout/tiles/header.php @@ -43,9 +43,6 @@ - - - body_attributes($bodyclasses); ?>> diff --git a/layout/tiles/piwik.php b/layout/tiles/piwik.php deleted file mode 100644 index dcbf38eb..00000000 --- a/layout/tiles/piwik.php +++ /dev/null @@ -1,136 +0,0 @@ -. - -/** - * Essential is a clean and customizable theme. - * - * Analytics - * - * This module provides extensive analytics on a platform of choice, - * currently support Google Analytics and Piwik. - * - * @package theme_essential - * @copyright 2016 Gareth J Barnard - * @copyright 2014 David Bezemer , www.davidbezemer.nl - * @author David Bezemer , Bas Brands , Gavin Henrick - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die; - -function theme_essential_analytics_trackurl() { - global $DB, $PAGE; - $pageinfo = get_context_info_array($PAGE->context->id); - // Adds page title. - $trackurl = "'"; - - if ((isset($pageinfo[1]->category)) || (isset($pageinfo[1]->fullname)) || (isset($pageinfo[2]->name))) { - // Adds course category name. - if (isset($pageinfo[1]->category)) { - if ($category = $DB->get_record('course_categories', array('id' => $pageinfo[1]->category))) { - $cats = explode("/", $category->path); - foreach (array_filter($cats) as $cat) { - if ($categorydepth = $DB->get_record("course_categories", array("id" => $cat))) { - $trackurl .= $categorydepth->name . '/'; - } - } - } - } - - // Adds course full name. - if (isset($pageinfo[1]->fullname)) { - if (isset($pageinfo[2]->name)) { - $trackurl .= $pageinfo[1]->fullname . '/'; - } else if ($PAGE->user_is_editing()) { - $trackurl .= $pageinfo[1]->fullname . '/' . get_string('edit'); - } else { - $trackurl .= $pageinfo[1]->fullname . '/' . get_string('view'); - } - } - - // Adds activity name. - if (isset($pageinfo[2]->name)) { - $trackurl .= $pageinfo[2]->modname . '/' . $pageinfo[2]->name; - } - } else { - $trackurl .= $PAGE->title; - } - - $trackurl .= "'"; - return $trackurl; -} - -function theme_essential_insert_analytics_tracking() { - $siteurl = \theme_essential\toolbox::get_setting('analyticssiteurl'); - $tracking = ''; - - if (!empty($siteurl)) { - $imagetrack = \theme_essential\toolbox::get_setting('analyticsimagetrack'); - $siteid = \theme_essential\toolbox::get_setting('analyticssiteid'); - $trackadmin = \theme_essential\toolbox::get_setting('analyticstrackadmin'); - $useuserid = \theme_essential\toolbox::get_setting('analyticsuseuserid'); - $cleanurl = \theme_essential\toolbox::get_setting('analyticscleanurl'); - - if ($imagetrack) { - $addition = ''; - } else { - $addition = ''; - } - - if ($useuserid) { - global $USER; - if ($USER->id) { - $userid = "".PHP_EOL."_paq.push(['setUserId', '".$USER->id."']);"; - } else { - $userid = ""; - } - } else { - $userid = ""; - } - - if ($cleanurl) { - $doctitle = "".PHP_EOL."_paq.push(['setDocumentTitle', " . theme_essential_analytics_trackurl() . "]);"; - } else { - $doctitle = ""; - } - - if (!is_siteadmin() || $trackadmin) { - $tracking = " -".$addition; - } - } - return $tracking; -} - -echo theme_essential_insert_analytics_tracking(); \ No newline at end of file diff --git a/settings.php b/settings.php index 5a32f151..12935c7d 100644 --- a/settings.php +++ b/settings.php @@ -2679,89 +2679,6 @@ } $ADMIN->add('theme_essential', $essentialsettingscategoryicon); -// Analytics settings. -$essentialsettingsanalytics = new admin_settingpage('theme_essential_analytics', get_string('analytics', 'theme_essential')); -if ($ADMIN->fulltree) { - $essentialsettingsanalytics->add(new admin_setting_heading('theme_essential_analytics', - get_string('analyticsheadingsub', 'theme_essential'), - format_text(get_string('analyticsdesc', 'theme_essential'), FORMAT_MARKDOWN))); - - $name = 'theme_essential/analyticsenabled'; - $title = get_string('analyticsenabled', 'theme_essential'); - $description = get_string('analyticsenableddesc', 'theme_essential'); - $default = true; - $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); - $essentialsettingsanalytics->add($setting); - - $name = 'theme_essential/analytics'; - $title = get_string('analytics', 'theme_essential'); - $description = get_string('analyticsdesc', 'theme_essential'); - $guniversal = get_string('analyticsguniversal', 'theme_essential'); - $piwik = get_string('analyticspiwik', 'theme_essential'); - $default = 'piwik'; - $choices = array( - 'piwik' => $piwik, - 'guniversal' => $guniversal - ); - $setting = new essential_admin_setting_configselect($name, $title, $description, $default, $choices); - $essentialsettingsanalytics->add($setting); - - if (get_config('theme_essential', 'analytics') === 'piwik') { - $name = 'theme_essential/analyticssiteid'; - $title = get_string('analyticssiteid', 'theme_essential'); - $description = get_string('analyticssiteiddesc', 'theme_essential'); - $default = '1'; - $setting = new admin_setting_configtext($name, $title, $description, $default); - $essentialsettingsanalytics->add($setting); - - $name = 'theme_essential/analyticsimagetrack'; - $title = get_string('analyticsimagetrack', 'theme_essential'); - $description = get_string('analyticsimagetrackdesc', 'theme_essential'); - $default = true; - $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); - $essentialsettingsanalytics->add($setting); - - $name = 'theme_essential/analyticssiteurl'; - $title = get_string('analyticssiteurl', 'theme_essential'); - $description = get_string('analyticssiteurldesc', 'theme_essential'); - $default = ''; - $setting = new admin_setting_configtext($name, $title, $description, $default); - $essentialsettingsanalytics->add($setting); - - $name = 'theme_essential/analyticsuseuserid'; - $title = get_string('analyticsuseuserid', 'theme_essential'); - $description = get_string('analyticsuseuseriddesc', 'theme_essential'); - $default = false; - $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); - $essentialsettingsanalytics->add($setting); - } else if (get_config('theme_essential', 'analytics') === 'guniversal') { - $name = 'theme_essential/analyticstrackingid'; - $title = get_string('analyticstrackingid', 'theme_essential'); - $description = get_string('analyticstrackingiddesc', 'theme_essential'); - $default = 'UA-XXXXXXXX-X'; - $setting = new admin_setting_configtext($name, $title, $description, $default); - $essentialsettingsanalytics->add($setting); - } - - $name = 'theme_essential/analyticstrackadmin'; - $title = get_string('analyticstrackadmin', 'theme_essential'); - $description = get_string('analyticstrackadmindesc', 'theme_essential'); - $default = false; - $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); - $essentialsettingsanalytics->add($setting); - - $name = 'theme_essential/analyticscleanurl'; - $title = get_string('analyticscleanurl', 'theme_essential'); - $description = get_string('analyticscleanurldesc', 'theme_essential'); - $default = true; - $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); - $essentialsettingsanalytics->add($setting); - - $essentialsettingsanalytics->add($essentialreadme); - $essentialsettingsanalytics->add($essentialadvert); -} -$ADMIN->add('theme_essential', $essentialsettingsanalytics); - // Properties. $essentialsettingsprops = new admin_settingpage('theme_essential_props', get_string('properties', 'theme_essential')); if ($ADMIN->fulltree) { diff --git a/version.php b/version.php index 9607cbd5..f9c5165c 100644 --- a/version.php +++ b/version.php @@ -28,10 +28,10 @@ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2017102902; // YYYYMMDDVV. -$plugin->maturity = MATURITY_STABLE; // This version's maturity level. -$plugin->release = '3.4.1.0 (Build: 2017102902)'; -$plugin->requires = 2017111300.00; // 3.4 (Build: 20171113). +$plugin->version = 2017102903; // YYYYMMDDVV. +$plugin->maturity = MATURITY_BETA; // This version's maturity level. +$plugin->release = '3.4.1.1 (Build: 2017102903)'; +$plugin->requires = 2017111302.00; // 3.4.2 (Build: 20180319). $plugin->component = 'theme_essential'; $plugin->dependencies = array( 'theme_bootstrapbase' => 2017051500