Exemple #1
0
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;
}
Exemple #2
0
function skip_write_all()
{
    global $cobrand;
    $options = cobrand_rep_list_options($cobrand);
    if (array_key_exists('include_write_all', $options) && $options['include_write_all']) {
        return true;
    }
    return false;
}