Exemplo n.º 1
0
 function render_reps($self_link, $reps, $bad_link = false)
 {
     if (!$reps) {
         return '';
     }
     $html = "";
     $info = dadem_get_representatives_info($reps);
     dadem_check_error($info);
     $areas = array();
     foreach ($reps as $rep) {
         $areas[] = $info[$rep]['voting_area'];
     }
     $area_info = mapit_call('areas', $areas);
     mapit_check_error($area_info);
     $generation = 0;
     $generations = mapit_call('generations', '');
     foreach ($generations as $g) {
         if ($g['active'] && $g['id'] > $generation) {
             $generation = $g['id'];
         }
     }
     for ($i = 0; $i < count($reps); $i++) {
         $rep = $reps[$i];
         $repinfo = $info[$rep];
         if (isset($area_info[$repinfo['voting_area']])) {
             $ainfo = $area_info[$repinfo['voting_area']];
             $html .= "<!-- gen " . $ainfo['generation_low'] . "-" . $ainfo['generation_high'] . " -->";
             if ($generation < $ainfo['generation_low'] || $generation > $ainfo['generation_high']) {
                 $html .= "<i>out of generation</i> ";
             }
         } else {
             $html .= '<i>area no longer exists</i> ';
         }
         if ($repinfo['deleted']) {
             $html .= "<i>deleted</i> ";
         } elseif ($repinfo['last_editor'] == 'fyr-queue') {
             $html .= "<i>failed</i> ";
         }
         if (array_key_exists('type', $repinfo)) {
             $html .= $repinfo['type'] . " ";
         } else {
             $html .= $repinfo['area_type'] . " ";
         }
         $link_extra = "";
         if ($bad_link && $i < count($reps) - 1) {
             $link_extra = "&nextbad=" . urlencode($reps[$i + 1]);
         }
         $html .= "<a href=\"{$self_link}&pc=" . urlencode(get_http_var('pc')) . "&rep_id=" . $rep . "{$link_extra}\">" . $repinfo['name'] . " (" . $repinfo['party'] . ")</a> \n";
         $html .= "prefer " . $repinfo['method'];
         if ($repinfo['email']) {
             $html .= ", " . $repinfo['email'];
         }
         if ($repinfo['fax']) {
             $html .= ", " . $repinfo['fax'];
         }
         $html .= "<br>";
     }
     return $html;
 }
Exemplo n.º 2
0
    dadem_check_error($status);
    if ($parent_status != 'none' || $status != 'none'){
        $election_error = cobrand_election_error_message($cobrand);
        if (!$election_error) {
             $election_error = 'Sorry, an election is forthcoming or has recently happened here.';
        }
        template_show_error($election_error);
    }
    // Get the representative info
    $area_representatives = dadem_get_representatives($va_id);
    dadem_check_error($area_representatives);  
    debug("FRONTEND", "area representatives $area_representatives");
    $area_representatives = array($va_id => $area_representatives);
    euro_check($area_representatives, $voting_areas);
    $all_representatives = array_values($area_representatives[$va_id]);
    $representatives_info = dadem_get_representatives_info($all_representatives);
    dadem_check_error($representatives_info);
    debug_timestamp();

    debug("FRONTEND", "representatives info $representatives_info");

    //Check the contact method exists for each representative
    $any_contacts = false;
    $error_msg = "";
    $fyr_valid_reps = array();
    # randomize the order that representatives will be displayed in
    shuffle($all_representatives);
    foreach ($all_representatives as $rep_specificid) {
       
        $success = msg_recipient_test($rep_specificid);
        $rep_name = "<strong>" . $fyr_voting_area['rep_prefix'] . " " .  
Exemplo n.º 3
0
            if (dadem_get_error($ids)) {
                continue;
            }
            $id = $ids[count($ids) - 1];
            $matches[] = $id;
            $reason[] = '(' . $m[0] . ')';
        }
    }
    if (!count($matches)) {
        $error = 'No Lords associated with that place, I\'m afraid. Pick another place.';
        lords_form(array('place' => $error));
        #	} elseif (count($matches)==1) {
        #    		header('Location: ' . url_new('write', false, 'fyr_extref', fyr_external_referrer(), 'cocode', get_http_var('cocode'), 'who', $matches[0]));
        #		exit;
    } else {
        $reps_info = dadem_get_representatives_info($matches);
        dadem_check_error($reps_info);
        print '<p>';
        if (count($matches) == 1) {
            print 'Only one Lord matched your search criteria:';
        } else {
            print 'There is more than one Lord associated with that place. Please pick from the list below:';
        }
        print '</p> <ul>';
        foreach ($matches as $i => $id) {
            $url = url_new('write', false, 'fyr_extref', fyr_external_referrer(), 'cocode', get_http_var('cocode'), 'who', $id);
            print '<li><a href="' . $url . '">' . $reps_info[$id]['name'] . '</a> <small>' . $reason[$i] . '</small></li>' . "\n";
        }
        print '</ul>';
    }
} else {
Exemplo n.º 4
0
if (!array_key_exists('id', $fyr_values) || $fyr_values['id'] == '' || !ctype_digit($fyr_values['id'])) {
    template_show_error('Please <a href="/">start from the beginning</a>.');
    exit;
}
$fyr_vatype = $fyr_values['id'];
$va_info = mapit_call('area', $fyr_vatype);
mapit_check_error($va_info);
$parent_info = mapit_call('area', $va_info['parent_area']);
mapit_check_error($parent_info);
debug_timestamp();
$area_reps = dadem_get_representatives(array($fyr_vatype));
dadem_check_error($area_reps);
debug_timestamp();
$area_reps = $area_reps[$fyr_vatype];
$area_reps = array_values($area_reps);
$reps_info = dadem_get_representatives_info($area_reps);
dadem_check_error($reps_info);
debug_timestamp();
$template_page = 'corrections-index';
if (isset($fyr_values['name']) && isset($fyr_values['party'])) {
    # Changes have been submitted
    $fyr_names = $fyr_values['name'];
    $fyr_parties = $fyr_values['party'];
    $fyr_new = isset($fyr_values['new']) ? $fyr_values['new'] : array();
    $fyr_delete = isset($fyr_values['delete']) ? $fyr_values['delete'] : array();
    $fyr_url = isset($fyr_values['url']) ? $fyr_values['url'] : '';
    if ($fyr_url == 'http://') {
        $fyr_url = '';
    }
    $fyr_notes = isset($fyr_values['notes']) ? $fyr_values['notes'] : '';
    $fyr_email = isset($fyr_values['email']) ? $fyr_values['email'] : '';
Exemplo n.º 5
0
function get_reps_info($area_representatives)
{
    $all_representatives = array_reduce(array_values($area_representatives), 'array_merge', array());
    $representatives_info = dadem_get_representatives_info($all_representatives);
    dadem_check_error($representatives_info);
    debug_timestamp();
    return $representatives_info;
}