Skip to content

Commit

Permalink
display MP's EU referendum stance at the top of the profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Jun 30, 2016
1 parent 41508ca commit d963fe6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
9 changes: 9 additions & 0 deletions classes/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ public function getEntryDate($house = 1) {
return $date_entered;
}


public function getEUStance() {
if (array_key_exists('eu_ref_stance', $this->extra_info())) {
return $this->extra_info()['eu_ref_stance'];
}

return FALSE;
}

/**
* Image
*
Expand Down
1 change: 1 addition & 0 deletions www/docs/mp/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
$data['current_offices'] = $MEMBER->offices('current');
$data['previous_offices'] = $MEMBER->offices('previous');
$data['register_interests'] = person_register_interests($MEMBER, $MEMBER->extra_info);
$data['eu_stance'] = $MEMBER->getEUStance();

# People who are or were MPs and Lords potentially have voting records, except Sinn Fein MPs
$data['has_voting_record'] = ( ($MEMBER->house(HOUSE_TYPE_COMMONS) && $MEMBER->party() != 'SF') || $MEMBER->house(HOUSE_TYPE_LORDS) );
Expand Down
18 changes: 12 additions & 6 deletions www/includes/easyparliament/templates/html/mp/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,21 @@
</div>
<div class="primary-content__unit">

<?php if (array_key_exists($display_wtt_stats_banner, $wtt_strings)): ?>
<?php if ($eu_stance): ?>
<div class="panel panel--responsiveness">
<a name="responsiveness"></a>
<h2>Does <strong><?= $full_name ?></strong> respond to constituents&rsquo; emails?</h2>
<h2>
<? if ($eu_stance == 'Leave' || $eu_stance == 'Remain') { ?>
<strong><?= $full_name ?></strong> campaigned to <?= $eu_stance == 'Leave' ? 'leave' : 'remain in' ?> the European Union
<? } else { ?>
We don't know whether <strong><?= $full_name ?></strong> campaigned to leave, or stay in the European Union
<? } ?>
</h2>
<p>
According to our <?= $display_wtt_stats_banner ?> survey, <?= $full_name ?> responded to a
<strong><?= $wtt_strings[$display_wtt_stats_banner] ?></strong> proportion of messages
sent by constituents on WriteToThem.com.
<a href="https://www.writetothem.com/stats/<?= $display_wtt_stats_banner ?>/zeitgeist">See the results in context</a>
Let your MP know how <em>you</em> feel - <a href="https://www.writetothem.com/<?php
if ($the_users_mp) {
echo "?a=WMC&amp;pc=" . _htmlentities(urlencode($user_postcode));
} ?>" onclick="trackLinkClick(this, 'Links', 'WriteToThem', 'Person'); return false;"><img src="/style/img/envelope.png">email them now</a>.
</p>
</div>
<?php endif; ?>
Expand Down

0 comments on commit d963fe6

Please sign in to comment.