Show photographs.
This commit is contained in:
@@ -76,38 +76,21 @@ $surveyLink = "<a href=\"https://forms.gle/gnDNyBiVC64tDo2Y7\">Streets People Lo
|
||||
|
||||
</div>
|
||||
<!-- /wp:columns -->
|
||||
<?php exit(0); else: ?>
|
||||
<?php else: ?>
|
||||
<!-- wp:paragraph -->
|
||||
<p></p>
|
||||
<!-- /wp:paragraph -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (isset($config['groupNames'])) {
|
||||
$groupNames = $config['groupNames'];
|
||||
$propertyOnCandidate = 'Group';
|
||||
} else {
|
||||
$groupNames = $config['wardNames'];
|
||||
$propertyOnCandidate = 'Ward';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php foreach ($groupNames as $index => $groupName): ?>
|
||||
<?php foreach ($councils as $key => $council): ?>
|
||||
<!-- wp:heading {"level":3,"className":"is-style-default"} -->
|
||||
<?php $groupSlug = sluggify($groupName); ?>
|
||||
<h3 class="wp-block-heading is-style-default" id="<?php echo $groupSlug; ?>"><a style="text-decoration: none;" href="#<?php echo $groupSlug; ?>"><?php echo htmlspecialchars($groupName); ?></a></h3>
|
||||
<?php $groupSlug = sluggify($council); ?>
|
||||
<h3 class="wp-block-heading is-style-default" id="<?php echo $groupSlug; ?>"><a style="text-decoration: none;" href="#<?php echo $groupSlug; ?>"><?php echo htmlspecialchars($council); ?></a></h3>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<?php
|
||||
$groupCandidates = array_filter($candidates, function ($candidate) use ($groupName, $propertyOnCandidate) {
|
||||
return isset($candidate[$propertyOnCandidate]) && $candidate[$propertyOnCandidate] === $groupName;
|
||||
});
|
||||
|
||||
usort($groupCandidates, function($a, $b) {
|
||||
if ($a == $b) {
|
||||
return 0;
|
||||
}
|
||||
return (((int) $a['Rating']) < ((int) $b['Rating'])) ? 1 : -1;
|
||||
$groupCandidates = array_filter($candidates, function ($candidate) use ($council) {
|
||||
return $candidate['Council'] === $council;
|
||||
});
|
||||
|
||||
if (count($groupCandidates) > 0):
|
||||
@@ -116,10 +99,10 @@ $surveyLink = "<a href=\"https://forms.gle/gnDNyBiVC64tDo2Y7\">Streets People Lo
|
||||
<?php
|
||||
$columnCount = 4;
|
||||
|
||||
$chunkedWardCandidates = array_chunk($groupCandidates, $columnCount);
|
||||
$chunkedCouncilCandidates = array_chunk($groupCandidates, $columnCount);
|
||||
?>
|
||||
|
||||
<?php foreach($chunkedWardCandidates as $chunk): ?>
|
||||
<?php foreach($chunkedCouncilCandidates as $chunk): ?>
|
||||
<!-- wp:columns -->
|
||||
<div class="wp-block-columns">
|
||||
|
||||
@@ -131,22 +114,13 @@ $surveyLink = "<a href=\"https://forms.gle/gnDNyBiVC64tDo2Y7\">Streets People Lo
|
||||
<?php
|
||||
$candidate = $chunk[$columnIdx];
|
||||
|
||||
if (isset($candidate['Picture']) && isset($media[$candidate['Picture']])) {
|
||||
$candidate_image = $media[$candidate['Picture']];
|
||||
if (isset($candidate['Picture']) && strlen($candidate['image_url'])) {
|
||||
$candidate_image['url'] = $candidate['image_url'];
|
||||
$candidate_image['id'] = $candidate['image_id'];
|
||||
} else {
|
||||
$candidate_image = $media['default.png'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$candidate_rating = str_repeat("✔️", max(0, min(5, $candidate['Rating'])));
|
||||
|
||||
// If string is 5 ticks, insert a zero width space entity between the 3rd and 4th ticks so that it wraps nicer
|
||||
if ($candidate_rating == "✔️✔️✔️✔️✔️") {
|
||||
$candidate_rating = "✔️✔️✔️​✔️✔️";
|
||||
}
|
||||
// If string is 4 ticks, insert a zero width space entity between the 2nd and 3rd ticks so that it wraps nicer
|
||||
if ($candidate_rating == "✔️✔️✔️✔️") {
|
||||
$candidate_rating = "✔️✔️​✔️✔️";
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- wp:image {"id":<?php echo $candidate_image['id']; ?>,"width":"200px","height":"200px","scale":"cover","align":"center","style":{"color":{}},"className":"is-resized"} -->
|
||||
@@ -157,9 +131,6 @@ $surveyLink = "<a href=\"https://forms.gle/gnDNyBiVC64tDo2Y7\">Streets People Lo
|
||||
<h2 class="wp-block-heading has-text-align-center has-medium-font-size" style="margin-top:1rem;margin-bottom:0.5rem"><strong><?php echo htmlspecialchars($candidate['Candidate Name']); ?></strong></h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph {"align":"center","style":{"layout":{"selfStretch":"fit","flexSize":null},"typography":{"lineHeight":"1"},"spacing":{"margin":{"top":"0.5rem","bottom":"1.5rem"}}},"fontSize":"large"} -->
|
||||
<p class="has-text-align-center has-large-font-size candidate-ticks"><?php echo $candidate_rating; ?></p>
|
||||
<!-- /wp:paragraph -->
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user