Skip to content

Commit eefea03

Browse files
authored
Merge pull request #905 from tomudding/feature/past-subscriptions-login
Hide external subscribers from public view on archived activities
2 parents 7738c6d + d402165 commit eefea03

File tree

2 files changed

+40
-37
lines changed

2 files changed

+40
-37
lines changed

module/Activity/src/Activity/Controller/ActivityController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function viewAction()
5757
&& $signupService->isSignedUp($translatedActivity, $identity->getMember());
5858
}
5959
$subscriptionDeadLinePassed = $activity->getSubscriptionDeadline() < new \DateTime();
60+
$isArchived = $activity->getEndTime() < new \DateTime();
6061
$result = [
6162
'activity' => $translatedActivity,
6263
'signupOpen' => $activity->getCanSignUp() &&
@@ -72,6 +73,7 @@ public function viewAction()
7273
'fields' => $fields,
7374
'memberSignups' => $signupService->getNumberOfSubscribedMembers($activity),
7475
'subscriptionDeadLinePassed' => $subscriptionDeadLinePassed,
76+
'isArchived' => $isArchived,
7577
];
7678

7779
//Retrieve and clear the request status from the session, if it exists.

module/Activity/view/activity/activity/view.phtml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -211,44 +211,45 @@ $this->headTitle($this->translate('Activities')); ?>
211211
</td>
212212
</tr>
213213
<?php endif; ?>
214-
<?php foreach ($activity->getSignUps() as $signup): ?>
215-
216-
<?php if (($signup instanceof Activity\Model\ExternalActivitySignup) || $this->acl('activity_acl')->isAllowed('activitySignup', 'view')): ?>
217-
<tr>
218-
<td><?= $this->acl('activity_acl')->isAllowed('activitySignup', 'view') || $activity->getDisplaySubscribedNumber() ? $i : '' ?></td>
219-
<td><?= $this->escapeHtml($signup->getFullName()) ?></td>
220-
<?php foreach ($fields as $field): ?>
221-
<?php foreach ($signup->getFieldValues() as $fieldValue): ?>
222-
<?php if ($fieldValue->getField()->getId() === $field->getId()): ?>
223-
<td>
224-
<?php
225-
switch ($field->getType()) {
226-
case 0:
227-
echo $this->escapeHtml($fieldValue->getValue());
228-
break;
229-
case 1:
230-
echo $this->translate($fieldValue->getValue());
231-
break;
232-
case 2:
233-
echo $fieldValue->getValue();
234-
break;
235-
case 3:
236-
if ($lang === 'nl') {
237-
echo $fieldValue->getOption()->getValue();
238-
} else {
239-
echo $fieldValue->getOption()->getValueEn();
240-
}
241-
break;
242-
}
243-
?>
244-
</td>
245-
<?php endif; ?>
214+
<?php if (!$isArchived || $this->acl('activity_acl')->isAllowed('activitySignup', 'view')): ?>
215+
<?php foreach ($activity->getSignUps() as $signup): ?>
216+
<?php if (($signup instanceof Activity\Model\ExternalActivitySignup) || $this->acl('activity_acl')->isAllowed('activitySignup', 'view')): ?>
217+
<tr>
218+
<td><?= $this->acl('activity_acl')->isAllowed('activitySignup', 'view') || $activity->getDisplaySubscribedNumber() ? $i : '' ?></td>
219+
<td><?= $this->escapeHtml($signup->getFullName()) ?></td>
220+
<?php foreach ($fields as $field): ?>
221+
<?php foreach ($signup->getFieldValues() as $fieldValue): ?>
222+
<?php if ($fieldValue->getField()->getId() === $field->getId()): ?>
223+
<td>
224+
<?php
225+
switch ($field->getType()) {
226+
case 0:
227+
echo $this->escapeHtml($fieldValue->getValue());
228+
break;
229+
case 1:
230+
echo $this->translate($fieldValue->getValue());
231+
break;
232+
case 2:
233+
echo $fieldValue->getValue();
234+
break;
235+
case 3:
236+
if ($lang === 'nl') {
237+
echo $fieldValue->getOption()->getValue();
238+
} else {
239+
echo $fieldValue->getOption()->getValueEn();
240+
}
241+
break;
242+
}
243+
?>
244+
</td>
245+
<?php endif; ?>
246+
<?php endforeach; ?>
246247
<?php endforeach; ?>
247-
<?php endforeach; ?>
248-
</tr>
249-
<?php $i = $i + 1; ?>
250-
<?php endif; ?>
251-
<?php endforeach; ?>
248+
</tr>
249+
<?php $i = $i + 1; ?>
250+
<?php endif; ?>
251+
<?php endforeach; ?>
252+
<?php endif; ?>
252253
</tbody>
253254
</table>
254255
</div>

0 commit comments

Comments
 (0)