Commit a0e5430d authored by Maria Sorica's avatar Maria Sorica

Bug 1734188: User agreements report

behatnotneeded

Change-Id: Idb2a48f6e7c9b0c97f4c3b8fd19207964d96442e
parent f7eeee18
<?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('ADMIN', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'legal');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$userid = param_integer('userid', null);
$versionid = param_integer('versionid', null);
$activetab = param_alpha('activetab', null);
$user = get_record('usr', 'id', $userid);
define('SUBSECTIONHEADING', get_string('useragreements', 'admin'));
define('TITLE', display_name($user, null, true));
$usercontent = array();
if ($userid) {
$usercontent = get_records_sql_array("
SELECT s.version, ua.ctime AS agreeddate, s.type, s.content, s.institution, s.id, i.displayname, s2.current, ua.agreed
FROM {usr_agreement} ua
JOIN {site_content_version} s ON s.id = ua.sitecontentid
JOIN {institution} i ON i.name = s.institution
LEFT JOIN (
SELECT MAX(id) AS current, type, institution
FROM {site_content_version}
GROUP BY type, institution) s2 ON s.type = s2.type AND s.id = s2.current AND s.institution = s2.institution
WHERE ua.usr = ?
ORDER BY ua.id DESC", array($userid));
}
$link = get_config('wwwroot') . 'admin/users/statisticsuseragreements.php?userid=' . $userid;
$js = <<< EOF
$(document).ready(function(){
checkActiveTab('$activetab');
})
EOF;
$smarty = smarty(array('privacy'));
$smarty->assign('id', $userid);
$smarty->assign('usercontent', $usercontent);
$smarty->assign('versionid', $versionid);
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('link', $link);
$smarty->assign('activetab', $activetab);
$smarty->display('admin/users/statisticsuseragreements.tpl');
......@@ -15,9 +15,6 @@ function checkActiveTab(activeTab) {
}
function showTab(el) {
var newurl = updateUrlParameter(location.href, 'fs', el.replace("#", ""));
history.pushState(null, null, newurl);
var i;
var x = $(".tab");
for (i = 0; i < x.length; i++) {
......@@ -26,9 +23,13 @@ function showTab(el) {
$(el).removeClass("js-hidden");
$(el + '-text').removeClass("js-hidden");
// Institution Legal: Useful in case an institution has just one type of content (privacy/T&C).
// Institution legal page specific.
if (typeof types != 'undefined') {
// Needed in case an institution has just one type of content (privacy/T&C).
showNoContentAddOne(el);
// Needed to keep the same tab active when user is changing the institutions from the institution selector.
var newurl = updateUrlParameter(location.href, 'fs', el.replace("#", ""));
history.pushState(null, null, newurl);
}
}
......
......@@ -1350,12 +1350,16 @@ $string['privacylastversion'] = 'Privacy statements must have unique version nam
$string['termsandconditionslastversion'] = 'Terms and conditions must have unique version names of up to 15 characters. The latest version for this privacy statement is "%s".';
$string['versionalreadyexist'] = 'A %s version with the name "%s" already exists.';
$string['siteprivacy'] = 'Site privacy statement';
$string['siteprivacyconsentdate'] = 'Site privacy consent reviewed';
$string['sitetermsandconditions'] = 'Site terms and conditions';
$string['sitetermsconsentdate'] = 'Site terms and conditions consent reviewed';
$string['addoneversionlink'] = '<a href="%s">Add one</a> if you need it.';
$string['privacyversionfor'] = 'Privacy statement for version "%s" is as follows:';
$string['termsversionfor'] = 'Terms and conditions for version "%s" is as follows:';
$string['institutionprivacystatement'] = 'Institution privacy statement';
$string['institutiontermsandconditions'] = 'Institution terms and conditions';
$string['institutionprivacyconsentdate'] = 'Institution privacy consent reviewed';
$string['institutiontermsconsentdate'] = 'Institution terms and conditions consent reviewed';
$string['userprivacypagedescription'] = 'Displayed are the current privacy statements and terms and conditions to which you consented.';
$string['lastupdated'] = 'Last updated on';
$string['newprivacy'] = 'Before entering your account, please read the information displayed below.';
......@@ -1377,6 +1381,10 @@ $string['termsandconditionslowcase'] = 'terms and conditions';
$string['hasrefused'] = 'has refused the %s';
$string['privacyandtotheterms'] = 'privacy statement and to the terms and conditions';
$string['privacyandtheterms'] = 'privacy statement and the terms and conditions';
$string['consentdate'] = 'Date of consent / rejection';
$string['useragreements'] = 'User agreements';
$string['userprivacyagreements'] = 'Displayed below are all the privacy statements the user has agreed to.';
$string['usertermsagreements'] = 'Displayed below are all the terms and conditions the user has agreed to.';
// pending user account deletions
$string['approveuserdeletionfor'] = 'Approve user account deletion for %s %s <%s>';
......@@ -1395,3 +1403,4 @@ $string['pendingdeletionspagedescription'] = '<p>On this page you can see users
<p>On approving the deletion of an account, all personal content from that account will be deleted permanently. The person who made the request will be notified via email once their account has been deleted.</p>';
$string['userdeletiondeniedsuccessful'] = 'Request denied successfully.';
$string['userdeletiondeniedunsuccessful'] = 'The attempted user account deletion denial failed.';
$string['consented'] = 'Consented';
\ No newline at end of file
......@@ -285,6 +285,24 @@ $string['reportdescpageactivity'] = '<ul>
</ul><p>Displayed are pages that were modified during the reporting time frame.</p>';
$string['allothers'] = 'All others';
$string['reportuseragreement'] = 'User agreements';
$string['reportdescuseragreement'] = '<ul>
<li>First name</li>
<li>Last name</li>
<li>Display name</li>
<li>Email address</li>
<li>Username</li>
<li>Site privacy statement</li>
<li>Site privacy consent reviewed</li>
<li>Site terms and conditions</li>
<li>Site terms and conditions consent reviewed</li>
<li>Institution privacy statement</li>
<li>Institution privacy consent reviewed</li>
<li>Institution terms and conditions</li>
<li>Institution terms and conditions consent reviewed</li>
<li>Institution</li>
</ul><p>Displayed are the people who accepted or rejected privacy statements or terms and conditions during the selected time frame.</p>';
// Last activities reported on in the "User activity" report
$string['blockinstancecommit'] = 'Add a block to a page';
$string['addfriend'] = 'Add a friend';
......@@ -388,6 +406,7 @@ $string['usersmasqueradingreports'] = 'Masquerading sessions';
$string['usersaccesslistreports'] = 'Portfolio access';
$string['usersuseractivityreports'] = 'User activity';
$string['usersuserdetailsreports'] = 'User details';
$string['usersuseragreementreports'] = 'User agreements';
$string['groupsreports'] = 'Groups overview';
$string['contentreports'] = 'Content overview';
$string['peoplereports'] = 'People overview';
......
This diff is collapsed.
{include file="header.tpl"}
{if $id !== null && !empty($usercontent)}
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#privacy" id="privacylink" role="tab" data-toggle="tab" aria-expanded="true" onclick="showTab('#privacy')">
{str tag="privacy" section="admin"}
</a>
</li>
<li role="presentation">
<a href="#termsandconditions" id="termsandconditionslink" role="tab" data-toggle="tab" aria-expanded="false" onclick="showTab('#termsandconditions')">
{str tag="termsandconditions" section="admin"}
</a>
</li>
</ul>
<br>
<div id="privacy-text" class="lead tab">{str tag="userprivacyagreements" section="admin"}</div>
<div id="termsandconditions-text" class="lead tab js-hidden">{str tag="usertermsagreements" section="admin"}</div>
<div class="panel panel-default view-container">
<div class="table-responsive">
<table id="adminstitutionslist" class="fullwidth table table-striped">
<thead>
<tr>
<th>{str tag="institution"}</th>
<th>{str tag="consentdate" section="admin"}</th>
<th>{str tag="consented" section="admin"}</th>
<th>{str tag="version" section="admin"}</th>
<th>{str tag="latest"}</th>
<th><span class="accessible-hidden sr-only">{str tag=edit}</span></th>
</tr>
</thead>
<tbody id="privacy" class="tab">
{foreach from=$usercontent item=content}
{if $content->type == 'privacy'}
<tr>
<td>
{if $content->institution == 'mahara'}{str tag="Site"}{else}{$content->displayname}{/if}
</td>
<td>
{$content->agreeddate|date_format:'%d %b %Y %H:%M'}
</td>
<td>
{if $content->agreed}{str tag="yes"}{else}{str tag="no"}{/if}
</td>
<td>
{$content->version|clean_html|safe}
</td>
<td>
{if $content->current}{str tag="yes"}{else}{str tag="no"}{/if}
</td>
<td>
<div class="btn-group">
<a href="{$link}&activetab=privacy&versionid={$content->id}" title="{str tag=viewversion section='admin' arg1='$content->version'}" class="btn btn-default btn-xs">
<span class="icon icon-eye icon-lg" role="presentation" aria-hidden="true"></span>
</a>
</div>
</td>
</tr>
{if $content->id == $versionid}
<tr>
<td colspan="6">
<div>
{if $content->type == 'privacy'}
{str tag=privacyversionfor section=admin arg1="$content->version"}
{else}
{str tag=termsversionfor section=admin arg1="$content->version"}
{/if}
</div>
{$content->content|clean_html|safe}
</td>
</tr>
{/if}
{/if}
{/foreach}
</tbody>
<tbody id="termsandconditions" class="tab js-hidden">
{foreach from=$usercontent item=content}
{if $content->type == 'termsandconditions'}
<tr>
<td>
{if $content->institution == 'mahara'}{str tag="Site"}{else}{$content->displayname}{/if}
</td>
<td>
{$content->agreeddate|date_format:'%d %b %Y %H:%M'}
</td>
<td>
{if $content->agreed}{str tag="yes"}{else}{str tag="no"}{/if}
</td>
<td>
{$content->version|clean_html|safe}
</td>
<td>
{if $content->current}{str tag="yes"}{else}{str tag="no"}{/if}
</td>
<td>
<div class="btn-group">
<a href="{$link}&activetab=termsandconditions&versionid={$content->id}" title="{str tag=viewversion section='admin' arg1='$content->version'}" class="btn btn-default btn-xs">
<span class="icon icon-eye icon-lg" role="presentation" aria-hidden="true"></span>
</a>
</div>
</td>
</tr>
{if $content->id == $versionid}
<tr>
<td colspan="6">
<div>
{if $content->type == 'termsandconditions'}
{str tag=privacyversionfor section=admin arg1="$content->version"}
{else}
{str tag=termsversionfor section=admin arg1="$content->version"}
{/if}
</div>
{$content->content|clean_html|safe}
</td>
</tr>
{/if}
{/if}
{/foreach}
</tbody>
</table>
</div>
</div>
{/if}
{include file="footer.tpl"}
\ No newline at end of file
{foreach from=$data item=item}
<tr class="{cycle values='r0,r1'}">
{if $columns.rownum}<td>{$offset + $dwoo.foreach.default.iteration}</td>{/if}
{if $columns.firstname}<td><a href="{$item->profileurl}">{$item->firstname}</a></td>{/if}
{if $columns.lastname}<td><a href="{$item->profileurl}">{$item->lastname}</a></td>{/if}
{if $columns.displayname}<td><a href="{$item->profileurl}">{$item->displayname}</a></td>{/if}
{if $columns.email}<td>{$item->email}</td>{/if}
{if $columns.username}<td><a href="{$item->profileurl}">{$item->username}</a></td>{/if}
{if $columns.siteprivacy}<td><a href="{$WWWROOT}admin/users/statisticsuseragreements.php?userid={$item->id}&activetab=privacy&versionid={$item->siteprivacyid}">{$item->siteprivacy}</a></td>{/if}
{if $columns.siteprivacyconsentdate}<td>{$item->siteprivacyconsentdate}</td>{/if}
{if $columns.siteterms}<td><a href="{$WWWROOT}admin/users/statisticsuseragreements.php?userid={$item->id}&activetab=termsandconditions&versionid={$item->sitetermsid}">{$item->siteterms}</a></td>{/if}
{if $columns.sitetermsconsentdate}<td>{$item->sitetermsconsentdate}</td>{/if}
{if $columns.institutionprivacy}<td><a href="{$WWWROOT}admin/users/statisticsuseragreements.php?userid={$item->id}&activetab=privacy&versionid={$item->institutionprivacyid}">{$item->institutionprivacy}</a></td>{/if}
{if $columns.institutionprivacyconsentdate}<td>{$item->institutionprivacyconsentdate}</td>{/if}
{if $columns.institutionterms}<td><a href="{$WWWROOT}admin/users/statisticsuseragreements.php?userid={$item->id}&activetab=termsandconditions&versionid={$item->institutiontermsid}">{$item->institutionterms}</a></td>{/if}
{if $columns.institutiontermsconsentdate}<td>{$item->institutiontermsconsentdate}</td>{/if}
{if $columns.institution}<td>{$item->instname}</td>{/if}
</tr>
{/foreach}
\ No newline at end of file
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