Commit c44c2def authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1750700: combine T&C and privacy footer links into 'Legal' link

behatnotneeded

Change-Id: I667b610e2778f203bac9f3867b9a38b780b66030
parent 49eb1e1c
......@@ -296,7 +296,7 @@ $activeurls = get_config('footercustomlinks');
$activeurls = $activeurls ? unserialize($activeurls) : null;
$footerelements = array();
foreach ($all as $k => $v) {
if ($k == 'termsandconditions' || $k == 'privacystatement') {
if ($k == 'legal') {
$footerelements[$k] = array(
'type' => 'switchbox',
'class' => 'last with-text-input',
......
......@@ -725,6 +725,7 @@ $string['termsandconditions'] = 'Terms and conditions';
$string['privacystatement'] = 'Privacy statement';
$string['about'] = 'About';
$string['contactus'] = 'Contact us';
$string['legal'] = 'Legal';
// my account
$string['account'] = 'Settings';
......
......@@ -12,8 +12,12 @@
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
define('TITLE', get_string('termsandconditions'));
define('TITLE', get_string('legal'));
$sections = array();
//termsandconditions
$termstitle = get_string('termsandconditions');
$termscontent = get_field_sql("
SELECT s.content
FROM {site_content_version} s
......@@ -21,6 +25,28 @@ $termscontent = get_field_sql("
AND s.type = 'termsandconditions'
ORDER BY s.version DESC
LIMIT 1", array('mahara'));
$sections[] = array(
'title' => $termstitle,
'content' => $termscontent,
);
// privacystatement
$privacytitle = get_string('privacystatement');
$privacycontent = get_field_sql("
SELECT s.content
FROM {site_content_version} s
WHERE s.institution = ?
AND s.type = 'privacy'
ORDER BY s.version DESC
LIMIT 1", array('mahara'));
$sections[] = array(
'title' => $privacytitle,
'content' => $privacycontent,
);
$smarty = smarty();
$smarty->assign('page_content', $termscontent);
$smarty->display('sitepage.tpl');
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('sections', $sections);
$smarty->display('sitepagesections.tpl');
......@@ -5730,5 +5730,29 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2018022100) {
log_debug('Combine footer links T&C and Privacy into Legal link');
if ($enabledfooterlinks = get_config('footerlinks')) {
$enabledfooterlinks = unserialize($enabledfooterlinks);
$enablelegal = false;
if (in_array('termsandconditions', $enabledfooterlinks)) {
$key = array_search('termsandconditions', $enabledfooterlinks);
unset($enabledfooterlinks[$key]);
$enablelegal = true;
}
if (in_array('privacystatement', $enabledfooterlinks)) {
$key = array_search('privacystatement', $enabledfooterlinks);
unset($enabledfooterlinks[$key]);
$enablelegal = true;
}
// if T&C or privacy links were shown on the footer, then show legal link
if ($enablelegal) {
$enabledfooterlinks[] = 'legal';
set_config('footerlinks', serialize($enabledfooterlinks));
}
}
}
return $status;
}
......@@ -856,7 +856,7 @@ function core_install_firstcoredata_defaults() {
set_config('anonymouscomments', 1);
set_config('homepageinfo', 1);
set_config('showonlineuserssideblock', 1);
set_config('footerlinks', serialize(array('privacystatement', 'about', 'contactus')));
set_config('footerlinks', serialize(array('legal', 'about', 'contactus')));
set_config('nousernames', 0);
set_config('onlineuserssideblockmaxusers', 10);
set_config('loggedinprofileviewaccess', 1);
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2018021601;
$config->version = 2018022100;
$config->series = '18.04';
$config->release = '18.04dev';
$config->minupgradefrom = 2015030409;
......
......@@ -3094,13 +3094,9 @@ function footer_menu($all=false) {
$wwwroot = get_config('wwwroot');
$menu = array(
'termsandconditions' => array(
'url' => ($USER->is_logged_in() ? $wwwroot . 'account/userprivacy.php' : $wwwroot . 'terms.php'),
'title' => get_string('termsandconditions'),
),
'privacystatement' => array(
'url' => ($USER->is_logged_in() ? $wwwroot . 'account/userprivacy.php' : $wwwroot . 'privacy.php'),
'title' => get_string('privacystatement'),
'legal' => array(
'url' => ($USER->is_logged_in() ? $wwwroot . 'account/userprivacy.php' : $wwwroot . 'legal.php'),
'title' => get_string('legal'),
),
'about' => array(
'url' => $wwwroot . 'about.php',
......
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
define('TITLE', get_string('privacystatement'));
$privacycontent = get_field_sql("
SELECT s.content
FROM {site_content_version} s
WHERE s.institution = ?
AND s.type = 'privacy'
ORDER BY s.version DESC
LIMIT 1", array('mahara'));
$smarty = smarty();
$smarty->assign('page_content', $privacycontent);
$smarty->display('sitepage.tpl');
{include file="header.tpl"}
{foreach from=$sections key=k item=section}
<div class="panel panel-default">
<div class="last form-group collapsible-group">
<fieldset class="pieform-fieldset collapsible">
<legend>
<h4>
<a href="#dropdown{$k}" data-toggle="collapse" aria-expanded="false" aria-controls="dropdown" class="collapsed">
{$section.title}
<span class="icon icon-chevron-down collapse-indicator right pull-right"></span>
</a>
</h4>
</legend>
<div class="fieldset-body collapse in" id="dropdown{$k}">
{$section.content|safe}
</div>
</fieldset>
</div>
</div>
{/foreach}
{include file="footer.tpl"}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment