function display_reps($va_type, $representatives, $va_info, $options) { global $representatives_info, $fyr_postcode, $cobrand, $cocode; $rep_list = ''; $photo = 0; $default_options = cobrand_rep_list_options($cobrand); $options = array_merge($default_options, $options); foreach ($representatives as $rep_specificid) { $rep_info = $representatives_info[$rep_specificid]; $rep_list .= '<li>'; $url = general_write_rep_url($va_type, $rep_specificid, $fyr_postcode); $a = '<a href="' . cobrand_url($cobrand, $url, $cocode) . '">'; if ($rep_specificid == '2000005') { $rep_list .= $a . '<img alt="" title="Portrait of Stom Teinberg MP" src="images/zz99zz.jpeg" align="left" border="0">'; $photo = 1; } elseif (array_key_exists('image', $rep_info)) { $rep_list .= $a . '<img alt="" title="Portrait of ' . htmlspecialchars($rep_info['name']) . '" src="' . $rep_info['image'] . '" align="left">'; $photo = 1; } if ($photo == 0) $rep_list .= $a; $rep_list .= htmlspecialchars($rep_info['name']) . '</a>'; if (array_key_exists('party', $rep_info)) { if ($options['extra_space']) { $rep_list .= '<br>'; } $rep_list .= '<span class="party">' . htmlspecialchars($rep_info['party']) . '</span>'; } } if (array_key_exists('include_write_all', $options) && $options['include_write_all'] && count($representatives) > 1){ $rep_list .= '<li class="all">'; $rep_list .= write_all_link($va_type, $va_info['rep_name_plural']); $rep_list .= '</li>'; } $rep_type = str_replace(' ', '-', strtolower($va_info['rep_name_plural'])); $out = '<ul class="' . $rep_type . '" '; if ($photo==1) $out .= ' id="photo"'; if (array_key_exists('small', $options) && $options['small']) $out .= ' style="font-size:83%"'; $out .= '>'; $out .= $rep_list . '</ul>'; return $out; }
function display_reps_two_types($va_types, $va_area, $representatives, $rep_count, $rep_counts) { $text = ''; // a string of html containing the main rep names and links $col_after = ''; // a string of html containing extra links, like help and TWFY $skip_write_all = skip_write_all(); if ($rep_count && $rep_counts[0] > 1 && !$skip_write_all) { // $text .= write_all_link($va_types[0], $va_area[0]['rep_name_plural']); $col_after .= '<p>' . write_all_link($va_types[0], $va_area[0]['rep_name_plural']) . '</p>'; } if ($rep_count) { $text .= display_reps($va_types[0], $representatives[0], $va_area[0], array()); } $text .= '<p>'; if ($va_types[1] == 'LAE') { $text .= "{$rep_counts['1']} London Assembly list members also represent you"; } elseif ($rep_count && $rep_counts[1] > 1) { $text .= "{$rep_counts['1']} {$va_area[1]['name']} {$va_area[1]['type_name']} {$va_area[1]['rep_name_plural']} also represent you"; } else { $text .= "One {$va_area[1]['name']} {$va_area[1]['type_name']} {$va_area[1]['rep_name']} also represents you"; } if ($va_types[1] == 'SPE') { $text .= '; if you are writing on a constituency matter or similar <strong>local or personal problem</strong>, please write to your <strong>constituency MSP</strong> above, or pick just <strong>one</strong> of your regional MSPs. Only <strong>one</strong> MSP is allowed to help you at a time'; } $text .= '.</p>'; if ($rep_count && $rep_counts[1] > 1 && $va_types[1] != 'SPE' && $va_types[1] != 'LAE' && !$skip_write_all) { // $text .= '<p>' . write_all_link($va_types[1], $va_area[1]['rep_name_plural']) . '</p>'; $col_after .= '<p>' . write_all_link($va_types[1], $va_area[1]['rep_name_plural']) . '</p>'; } if ($rep_count) { $text .= display_reps($va_types[1], $representatives[1], $va_area[1], array()); } if ($rep_count && $rep_counts[1] > 1 && ($va_types[1] == 'SPE' || $va_types[1] == 'LAE') && !$skip_write_all) { // $text .= '<p>' . write_all_link($va_types[1], $va_area[1]['rep_name_plural']) . '</p>'; $col_after .= '<p>' . write_all_link($va_types[1], $va_area[1]['rep_name_plural']) . '</p>'; } return array($text, $col_after); }