Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RED7114 display only public groups in GDPR tab #54

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CRM/Gdpr/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function run() {
$isGdprAdmin = CRM_Core_Permission::check('administer GDPR');
$this->assign('isGdprAdmin', $isGdprAdmin);

CRM_Core_Resources::singleton()->addStyleFile('uk.co.vedaconsulting.gdpr', 'css/gdpr.css');

parent::run();
}
Expand Down
4 changes: 3 additions & 1 deletion CRM/Gdpr/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function getallGroupSubscription($contactId) {
}

$groupSubscriptions = array();
$sql = "SELECT c.sort_name, g.title, s.date, s.id, s.contact_id, s.group_id, s.status FROM
$sql = "SELECT c.sort_name, g.title, s.date, s.id, s.contact_id, s.group_id, s.status, g.is_active, CASE WHEN g.visibility = 'Public Pages' THEN 1 ELSE 0 END as is_public FROM
civicrm_subscription_history s
INNER JOIN civicrm_contact c ON s.contact_id = c.id
INNER JOIN civicrm_group g ON g.id = s.group_id
Expand All @@ -113,6 +113,8 @@ public static function getallGroupSubscription($contactId) {
'date' => $resource->date,
'title' => $resource->title,
'status' => $resource->status,
'is_active' => $resource->is_active,
'is_public' => $resource->is_public,
);
}

Expand Down
7 changes: 7 additions & 0 deletions css/gdpr.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ form#EventInfo .custom-group-Event_terms_and_conditions {

.crm-gdpr-dashboard-settings-form-block div#help ul li {
background-image: unset;
}

.crm-grouo-subscription-list-form-block .in_active_groups td{
color: red;
}
.crm-grouo-subscription-list-form-block .list_public_group_div {
padding: 10px 5px 10px 10px;
}
18 changes: 17 additions & 1 deletion templates/CRM/Gdpr/Page/Tab.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<h3>{ts}Group Subscription Log{/ts}</h3>

<div class="crm-block crm-form-block crm-grouo-subscription-list-form-block">
<div class="list_public_group_div">
<input type="checkbox" name="display_public_group" id="display_public_group" value="1">
<label for="display_public_group"> List only public groups</label>
</div>
<div>
<table class="selector row-highlight" id="GroupSubscriptionListTable">
<thead class="sticky">
Expand All @@ -49,7 +53,7 @@
</thead>
<tbody>
{foreach from=$groupSubscriptions key=id item=groupSubscription}
<tr>
<tr class="{if !$groupSubscription.is_public} display_all_groups {/if} {if !$groupSubscription.is_active} in_active_groups {/if}">
<td>{$groupSubscription.title}</td>
<td>{$groupSubscription.status}</td>
<td>{$groupSubscription.date}</td>
Expand All @@ -66,6 +70,18 @@ cj(document).ready( function() {
cj('#GroupSubscriptionListTable').DataTable({
"order": [[ 2, "desc" ]],
});

cj('#display_public_group').prop('checked', true);
cj('#GroupSubscriptionListTable .display_all_groups').hide();

cj('#display_public_group').click(function(){
if (cj(this).prop('checked')) {
cj('#GroupSubscriptionListTable .display_all_groups').hide();
}
else{
cj('#GroupSubscriptionListTable .display_all_groups').show();
}
});
});
</script>
{/literal}
Expand Down