Ejemplo n.º 1
0
if ($rdep['timeout'] != 0) {
    $t->assign('reason', $rdep['motif'] != "" ? " (" . $rdep['motif'] . ")" : "");
}
$parties = getPartiesFor($rdep['idperson'], 2004);
$t->assign('party', getPartyName($parties[0]['name']));
$party_list = array();
if (sizeof($parties) > 1) {
    for ($i = 1; $i < sizeof($parties); $i++) {
        array_push($party_list, getPartyName($parties[$i]['name']) . " până în " . date("M Y", $parties[$i]['t'] / 1000));
    }
}
$t->assign('party_list', $party_list);
$candidateVotes = $rdep['possible'];
$percent = $rdep['percent'];
$class = "blacktext";
if ($percent < 0.5) {
    $class = "red";
}
if ($percent < 0.3) {
    $class = "brightred";
}
$t->assign('number_class', $class);
// ----------- Voting presence
$t->assign('presence', 100 * $percent);
$t->assign('votes_from', $timein < 1139201156 ? "Feb 2006" : date("M Y", $timein));
$t->assign('votes_to', $timeout == 0 ? "Nov 2008" : date("M Y", $timeout));
$t->assign('possible', $candidateVotes);
// ------------ Spoke in the parliament
$t->assign('speaking_time', getVideoCellText2($rdep['idv'], $rdep['sessions'], $rdep['seconds']));
$t->assign('idm', $rdep['idm']);
$t->display('mod_cdep_2004.tpl');
Ejemplo n.º 2
0
/**
 * Shows all information related to a deputy.
 * To be replaced with the more generic function to show a person.
 */
function showDeputy($id)
{
    $sql = "SELECT dep.id, dep.name, dep.idm, dep.timein, dep.timeout, dep.motif, " . "video.seconds, video.idv, video.sessions, " . "votes_agg.possible, votes_agg.percent, " . "belong_agg.idparty, " . "cand.url as dep_url, " . "colleges.url as col_url, " . "dep.imgurl " . "FROM cdep_2004_deputies as dep " . "LEFT JOIN cdep_2004_video AS video ON video.idperson = dep.idperson " . "LEFT JOIN cdep_2004_votes_agg AS votes_agg " . "ON votes_agg.idperson = dep.idperson " . "LEFT JOIN cdep_2004_belong_agg AS belong_agg " . "ON belong_agg.idperson = dep.idperson " . "LEFT JOIN alegeri_2008_candidates AS cand " . "ON cand.idperson = dep.idperson " . "LEFT JOIN alegeri_2008_colleges as colleges " . "ON cand.college_id = colleges.id " . "WHERE dep.id = {$id} ";
    $sdep = mysql_query($sql);
    $rdep = mysql_fetch_array($sdep);
    $numVotes = getNumberOfVotes();
    // ------------------ vote percentages
    $timein = $rdep['timein'] / 1000;
    $timeout = $rdep['timeout'] / 1000;
    // 1103259600 = 17 dec 2004
    echo "<div class=numedeputattitlu>" . $rdep['name'] . "</div>";
    echo "<table cellspacing=10 cellpadding=10 width=800><td>";
    $imgurl = str_replace('imagini/l2004', 'parlamentari/l2004/mari', $rdep['imgurl']);
    echo "<img src=http://www.cdep.ro" . $imgurl . " width=283><br>";
    echo "</td><td valign=top class=info>";
    // ----------------- now print the times in office, if need be
    echo "<br>În Camera Deputaților între: <b>";
    echo date("M Y", $timein) . " - " . ($timeout == 0 ? 'prezent' : date("M Y", $timeout));
    if ($rdep['timeout'] != 0) {
        echo $rdep['motif'] != "" ? "(" . $rdep['motif'] . ")" : "";
    }
    echo "</b>";
    $candidateVotes = $rdep['possible'];
    $percent = $rdep['percent'];
    $class = "blacktext";
    if ($percent < 0.5) {
        $class = "red";
    }
    if ($percent < 0.3) {
        $class = "brightred";
    }
    if ($timein < 1139201156) {
        echo "<br>Prezent la <b><span class={$class}>" . floor(10000 * $percent) / 100 . "%</span></b> din ";
        echo " voturile electronice dintre Februarie 2006 și " . "Noiembrie 2008 (3590).<br>";
    } else {
        echo "<br>Prezent la <b><span class={$class}>" . floor(10000 * $percent) / 100 . "%</span></b> din ";
        echo " voturile electronice dintre " . date("d M Y", $timein) . " și Noiembrie 2008 ({$candidateVotes}).<br>";
    }
    echo "<br>Luări de cuvânt: " . getVideoCellText2($rdep['idv'], $rdep['sessions'], $rdep['seconds']);
    echo "<br><br>Partid: ";
    $parties = getPartiesFor($rdep['id'], 2004);
    echo getPartyName($parties[0]['name']);
    if (sizeof($parties) > 1) {
        echo ' (<span class="gray small">';
        for ($i = 1; $i < sizeof($parties); $i++) {
            echo "<b>" . getPartyName($parties[$i]['name']) . "</b> până în " . date("M Y", $parties[$i]['t'] / 1000);
            if ($i != sizeof($parties) - 1) {
                echo ", ";
            }
        }
        echo '</span>)';
    }
    if ($rdep['dep_url']) {
        echo "<br><br>Candidează la: " . getLinkFromThinkopolisUrl($rdep['col_url'], "");
    } else {
        echo "<br>Nu pare să candideze în 2008.<br>";
    }
    echo "<br><br>Informează-te despre această persoană: " . "<ul class=moreinfolist>";
    echo "<li> <a href=\"http://www.cdep.ro/pls/parlam/structura.mp?" . "idm=" . $rdep['idm'] . "&cam=2&leg=2004\">site-ul cdep.ro</a></li> ";
    if ($rdep['dep_url']) {
        echo "<li> <a href=\"http://www.alegeri-2008.ro" . $rdep['dep_url'] . "\">alegeri-2008.ro</a></li>";
    }
    echo "<li> <a href=\"http://www.google.ro/search?hl=ro&q=" . $rdep['name'] . "&meta=lr%3Dlang_ro\">căutare google</a></li>";
    echo "<li> <a href=\"http://www.google.ro/search?hl=ro&q=" . $rdep['name'] . "+site:wikipedia.org&&btnI=Mă Simt " . "Norocos&meta=lr%3Dlang_ro\">wikipedia</a></li>";
    echo "</ul>";
    echo "</td><tr><td colspan=2>";
    echo "</td></table>";
}