Commit f724afbe authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Bug 1734170: add new admin menu item 'Privacy'

behatnotneeded

Change-Id: I2d0e298b6ec4c249f4b3a1ee2d8d4b2e54193f1d
parent 80072229
<?php
/**
*
* @package mahara
* @subpackage admin
* @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('ADMIN', 1);
define('MENUITEM', 'configsite/privacy');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'privacy');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('privacy', 'admin'));
if (!is_logged_in()) {
throw new AccessDeniedException();
}
$data = '<div class="no-results"> Site settings here </div>';
$smarty = smarty();
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('data', $data);
$smarty->display('admin/site/privacy.tpl');
<?php
/**
*
* @package mahara
* @subpackage admin
* @author Stacey Walker
* @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('INSTITUTIONALADMIN', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('privacy', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionprivacy');
define('MENUITEM', 'manageinstitutions/privacy');
require_once('institution.php');
if (!is_logged_in()) {
throw new AccessDeniedException();
}
$institutionelement = get_institution_selector(false);
if (empty($institutionelement)) {
$smarty = smarty();
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
$institution = param_alphanum('institution', null);
if (!$institution || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
}
else if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
$institutionselector = pieform(array(
'name' => 'usertypeselect',
'class' => 'form-inline',
'elements' => array(
'institution' => $institutionelement,
)
));
$data = '<div class="no-results">' . get_string('noinstitutionprivacy', 'admin') . '</div>'; //privacy data to show
$wwwroot = get_config('wwwroot');
$js = <<< EOF
jQuery(function($) {
function reloadUsers() {
window.location.href = '{$wwwroot}admin/users/institutionprivacy.php?institution='+$('#usertypeselect_institution').val();
}
$('#usertypeselect_institution').on('change', reloadUsers);
});
EOF;
$smarty = smarty();
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('data', $data);
$smarty->assign('institutionselector', $institutionselector);
$smarty->display('admin/users/institutionprivacy.tpl');
......@@ -88,6 +88,8 @@ $string['staticpageinstitutionbad'] = "You can't access and/or edit static pages
$string['usedefault'] = 'Use site default';
$string['usedefaultdescription3'] = 'Use the site\'s default text for the selected page type.';
$string['staticpagesdescription'] = 'Edit the content of static pages in Mahara (Home, Terms and Conditions, etc.)';
$string['institutionprivacypagedescription'] = 'Edit the privacy statement for your institution, which is displayed in addition to the site privacy statement. The version you edited last becomes the current privacy statement automatically. You see the current site privacy statement as reference.';
$string['noinstitutionprivacy'] = 'There is no privacy statement for this institution yet.';
$string['menus'] = 'Menus';
$string['menusdescription'] = 'Manage the links and files within the "Links and resources" and footer menus';
$string['sitefiles'] = 'Site files';
......@@ -499,6 +501,7 @@ $string['savefailed'] = 'Save failed';
$string['sitepageloaded'] = 'Site page loaded';
$string['termsandconditions'] = 'Terms and conditions';
$string['uploadcopyright'] = 'Upload copyright statement';
$string['privacypagedescription'] = 'Edit the privacy statement for the entire site. The version you edited last becomes the current privacy statement automatically.';
// Links and resources menu editor
$string['sitefile'] = 'Site file';
......
......@@ -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 = 2018010700;
$config->version = 2018010800;
$config->series = '18.04';
$config->release = '18.04dev';
$config->minupgradefrom = 2015030409;
......
......@@ -2265,6 +2265,12 @@ function admin_nav() {
'title' => get_string('staticpages', 'admin'),
'weight' => 20
),
'configsite/privacy' => array(
'path' => 'configsite/privacy',
'url' => 'admin/site/privacy.php',
'title' => get_string('privacy', 'admin'),
'weight' => 25,
),
'configsite/sitemenu' => array(
'path' => 'configsite/sitemenu',
'url' => 'admin/site/menu.php',
......@@ -2413,6 +2419,12 @@ function admin_nav() {
'title' => get_string('staticpages', 'admin'),
'weight' => 15
),
'manageinstitutions/privacy' => array(
'path' => 'manageinstitutions/privacy',
'url' => 'admin/users/institutionprivacy.php',
'title' => get_string('privacy', 'admin'),
'weight' => 17
),
'manageinstitutions/institutionusers' => array(
'path' => 'manageinstitutions/institutionusers',
'url' => 'admin/users/institutionusers.php',
......@@ -2631,6 +2643,12 @@ function institutional_admin_nav() {
'title' => get_string('staticpages', 'admin'),
'weight' => 15
),
'manageinstitutions/privacy' => array(
'path' => 'manageinstitutions/privacy',
'url' => 'admin/users/institutionprivacy.php',
'title' => get_string('privacy', 'admin'),
'weight' => 17
),
'manageinstitutions/institutionusers' => array(
'path' => 'manageinstitutions/institutionusers',
'url' => 'admin/users/institutionusers.php',
......
{include file="header.tpl"}
<div class="lead">{str tag="privacypagedescription" section="admin"}</div>
<div class="panel panel-default">
<div id="privacysettingscontainer">
{$data|safe}
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
<div class="lead">{str tag="institutionprivacypagedescription" section="admin"}</div>
<div class="panel panel-default">
<div id="institutionprivacylistcontainer">
{$data|safe}
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
<div class="lead">{str tag="privacypagedescription" section="admin"}</div>
<div class="panel panel-default">
<div id="privacysettingscontainer">
{$data|safe}
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
<div class="lead">{str tag="institutionprivacypagedescription" section="admin"}</div>
<div class="panel panel-default">
<div id="institutionprivacylistcontainer">
{$data|safe}
</div>
</div>
{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