Ejemplo n.º 1
0
/**
 * Returns an array with the most recent votes in the database.
 * @return array
 * @private
 */
function getSenatVotes($order, $count, $from, $uid = 0, $q = '')
{
    if ($q != '') {
        $sql = mysql_query("\n      SELECT v.id, v.link, v.type, v.description, v.time,\n             v.vda, v.vnu, v.vab, v.vmi,\n             l.link as law_link, l.number as law_number\n      FROM senat_2008_votes_details AS v\n      LEFT JOIN senat_2008_laws AS l ON l.id = v.idlaw\n      WHERE v.link LIKE '%{$q}%'\n      ORDER BY time {$order}\n      LIMIT {$from}, {$count}\n    ");
    } else {
        $sql = mysql_query("\n      SELECT v.id, v.link, v.type, v.description, v.time,\n             v.vda, v.vnu, v.vab, v.vmi,\n             l.link as law_link, l.number as law_number\n      FROM senat_2008_votes_details AS v\n      LEFT JOIN senat_2008_laws AS l ON l.id = v.idlaw\n      ORDER BY time {$order}\n      LIMIT {$from}, {$count}\n    ");
    }
    $votes = array();
    while ($r = mysql_fetch_array($sql)) {
        $vote = $r;
        $vote['subject'] = str_replace("/pls/proiecte", "http://www.cdep.ro/pls/proiecte", $r['description']);
        $vote['time'] = $r['time'] / 1000;
        if ($uid != 0) {
            $vote['tags'] = getVoteTags('senat_2008_votes_details', $r['id'], $uid);
        }
        $votes[] = $vote;
    }
    return $votes;
}
Ejemplo n.º 2
0
/**
 * Returns an array with the most recent votes in the database.
 * @return array
 * @private
 */
function getCdepVotes($order, $count, $from, $uid = 0, $q = '')
{
    if ($q == '') {
        $sql = mysql_query("\n      SELECT link, type, description, time, vda, vnu, vab, vmi, id\n      FROM cdep_2008_votes_details\n      ORDER BY time {$order}\n      LIMIT {$from}, {$count}\n    ");
    } else {
        $sql = mysql_query("\n      SELECT link, type, description, time, vda, vnu, vab, vmi, id\n      FROM cdep_2008_votes_details\n      WHERE link LIKE '%{$q}%'\n      ORDER BY time {$order}\n      LIMIT {$from}, {$count}\n    ");
    }
    $votes = array();
    while ($r = mysql_fetch_array($sql)) {
        $vote = $r;
        $vote['subject'] = str_replace("/pls/proiecte", "http://www.cdep.ro/pls/proiecte", $r['description']);
        $vote['time'] = $r['time'] / 1000;
        if ($uid != 0) {
            $vote['tags'] = getVoteTags('cdep_2008_votes_details', $r['id'], $uid);
        }
        $votes[] = $vote;
    }
    return $votes;
}