Your IP : 216.73.216.39


Current Path : /home/wirbesti/unwaehlbar.ch/
Upload File :
Current File : /home/wirbesti/unwaehlbar.ch/polvotes.php

<?php

class polvotes
{
    private $con;

    // Database Connection
    public function __construct(DBConnection $database)
    {
        $this->con = $database;
        return $this->con;
    }

    // Fetch politician vote records for show listing
    public function displayDataById($id)
    {
        $query = "SELECT pav.`votedate`, ".
        "pav.`votedivisiontext`, ".
        "pov.`voted` ".
        "FROM `politicianvotes` pov ".
        "JOIN `parlamentvotes` pav on pov.`voteregistrationnumber` = pav.`voteregistrationnumber` ".
        "WHERE pov.`politicianid` = :id";


        $data = array();
        $getpoliticianvotes = $this->con->dbc->prepare($query);
        $getpoliticianvotes->bindParam(":id", $id);
        $getpoliticianvotes->execute();
        $all = $getpoliticianvotes->fetchAll();
        foreach ($all as $row) {
            $data[] = $row;
        }
        return $data;
    }

    public function votedToText($voted)
    {
        switch ($voted) {
            case 1:
                return "Ja";
                break;
            case 2:
                return "Nein";
                break;
            case 3:
                return "Enthalten";
                break;
            case 4:
                return "Nicht teilgenommen";
                break;
            case 5:
                return "Entschuldigt";
                break;
            case 6:
                return "Präsident";
                break;

            default:
                return "";
                break;
        }
    }
}