Skip to content

Commit

Permalink
fixup! Updated register display
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Feb 25, 2025
1 parent e2d8b5c commit 839dc11
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<li <?php if ($pagetype == "votes"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/votes"><?= gettext('Voting Summary') ?></a></li>
<?php endif; ?>
<?php if (in_array($this_page, ["mp", "msp", "ms"])): ?>
<li <?php if ($pagetype == "recent"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/recent"><?= gettext('Recent Votes') ?></a></li>
<?php endif; ?>
<?php if ($register_interests): ?>
<li <?php if ($pagetype == "register"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/register"><?= gettext('Register of Interests') ?></a></li>
<?php endif; ?>
</ul>
<li <?php if ($pagetype == "recent"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/recent"><?= gettext('Recent Votes') ?></a></li>
<?php endif; ?>
<?php if ($register_interests): ?>
<li <?php if ($pagetype == "register"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/register"><?= gettext('Register of Interests') ?></a></li>
<?php endif; ?>
</ul>
</div>
60 changes: 30 additions & 30 deletions www/includes/easyparliament/templates/html/mp/_register_entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,52 @@

<div class="interest-item" id="<?= $entry->comparable_id ?>">

<?php if (!$entry->details->isEmpty()): ?>
<?php if (!$entry->details->isEmpty()) { ?>

<?php if ($entry->content): ?>
<?php if ($entry->info_type == "subentry"): ?>
<?php if ($entry->content) { ?>
<?php if ($entry->info_type == "subentry") { ?>
<h6 class="interest-summary"><?= htmlspecialchars($entry->content) ?></h6>
<?php else: ?>
<?php } else { ?>
<h4 class="interest-summary"><?= htmlspecialchars($entry->content) ?></h4>
<?php endif; ?>
<?php endif; ?>
<?php }; ?>
<?php }; ?>
<ul class="interest-details-list">
<?php foreach ($entry->details as $detail): ?>
<?php foreach ($entry->details as $detail) { ?>
<?php include '_register_field.php'; ?>
<?php endforeach; ?>
<?php if ($entry->date_registered): ?>
<?php }; ?>

<?php if ($entry->date_registered) { ?>
<li class="registration-date">Registration Date: <?= htmlspecialchars($entry->date_registered) ?></li>
<?php endif; ?>
<?php if ($entry->date_published): ?>
<?php }; ?>
<?php if ($entry->date_published) { ?>
<li class="published-date">Published Date: <?= htmlspecialchars($entry->date_published) ?></li>
<?php endif; ?>
<?php if ($entry->date_updated): ?>
<?php }; ?>
<?php if ($entry->date_updated) { ?>
<li class="last-updated-date">Last Updated Date: <?= htmlspecialchars($entry->date_updated) ?></li>
<?php endif; ?>
<?php }; ?>
</ul>

<?php else: ?>
<?php if ($entry->content): ?>
<?php } else { ?>
<?php if ($entry->content) { ?>
<?php // This is a more mininal style of entry, don't use the header structure, just print the xml content?>
<?php if ($entry->content_format == "xml") : ?>
<?php if ($entry->content_format == "xml") { ?>
<?= $entry->content ?>
<?php else: ?>
<?php } else { ?>
<p class="interest-content"><?= htmlspecialchars($entry->content) ?></p>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php }; ?>
<?php }; ?>
<?php }; ?>

</ul>
<?php if (!$entry->sub_entries->isEmpty()): ?>
<?php if (!$entry->sub_entries->isEmpty()) { ?>
<h5 class="child-item-header">Specific work or payments</h5>
<div class="interest-child-items" id="parent-<?= $entry->comparable_id ?>">
<?php foreach ($entry->sub_entries as $subentry): ?>
<?php $parent_entry = $entry; ?>
<?php $entry = $subentry; ?>
<?php include '_register_entry.php'; ?>
<?php $entry = $parent_entry; ?>
<?php endforeach; ?>
<?php foreach ($entry->sub_entries as $subentry) {
$parent_entry = $entry;
$entry = $subentry;
include '_register_entry.php';
$entry = $parent_entry;
} ?>
</div>
<?php endif; ?>
<?php }; ?>

</div>
29 changes: 14 additions & 15 deletions www/includes/easyparliament/templates/html/mp/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

<div class="primary-content__unit">

<?php if ($register_interests): ?>
<?php if ($register_interests) { ?>

<?php /** @var MySociety\TheyWorkForYou\DataClass\Regmem\Person $register */ ?>
<?php foreach ($register_interests['chamber_registers'] as $chamber => $register): ?>
<?php foreach ($register_interests['chamber_registers'] as $chamber => $register) { ?>

<div class="panel register">
<a name="register"></a>
Expand All @@ -53,30 +53,29 @@

<p>This register last updated on: <?= $register->published_date ?></p>

<?php foreach ($register->categories as $category): ?>
<?php if ($category->only_null_entries()): ?>
<?php continue; ?>
<?php endif; ?>
<?php foreach ($register->categories as $category) { ?>
<?php if ($category->only_null_entries()) {
continue;
}; ?>
<h3 id="category-<?= $register->chamber . $category->category_id ?>"><?= $category->category_name ?></h3>

<?php foreach ($category->entries as $entry): ?>
<?php if ($entry->null_entry == false): ?>
<?php include('_register_entry.php'); ?>
<?php endif; ?>

<?php endforeach; ?>
<?php foreach ($category->entries as $entry) {
if ($entry->null_entry == false) {
include('_register_entry.php');
}
} ?>

<?php endforeach; ?>
<?php }; ?>

</div>
<?php endforeach; ?>
<?php }; ?>

<div class="panel">
<p>
<a class="moreinfo-link" href="https://www.parliament.uk/mps-lords-and-offices/standards-and-financial-interests/parliamentary-commissioner-for-standards/registers-of-interests/register-of-members-financial-interests/">More about the register</a>
</p>
</div>
<?php endif; ?>
<?php }; ?>

<?php include('_profile_footer.php'); ?>

Expand Down

0 comments on commit 839dc11

Please sign in to comment.