<?php # import required library and initiate require_once 'db/persistence.php'; $dbr = new persistDisplay(); /** * @name viewReports * Report Handling * @author Saqib * */ class viewReports { public $pList = '', $cList = '', $pcList = ''; /** * @name showPartyReport * Display Party votes report */ public function showPartyReport() { echo '<table><tr><th>Party</th><th>Votes</th></tr>'; foreach ($this->pList as $k => $v) { echo "<tr><td align=\"left\">" . $k . "</td><td align=\"right\">{$v}</td></tr>"; } echo '</table>'; } /** * @name showConstituencyReport * Display constituency votes report */ public function showConstituencyReport()
<html> <head> </head> <?php #import libraries and initialise require_once 'lib.php'; $dbVotes = new persistDisplay(); $votes = new voteoptions(); ?> <body> <p>Are you going to vote?</p> <div id="divVoteOptions"> <?php # process and display voting option $votes->sVoteOptions = $dbVotes->votesOptionsList(); $voteslist = $votes->populateVoteOptions(); echo $voteslist; ?> </div> <!-- Set up containers --> <div id="divPartyWindow"></div> <div id="divConstituencyWindow"></div> <div id="divSubmitWindow"></div> <div id="resultsWindow"><p><a href="viewResults.php">View Results</a></p></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<html> <head> <title>Home Page</title> </head> <?php require_once 'db/persistence.php'; $dbp = new persistDisplay(); require_once 'cookie/cookie.php'; $ck = new cookieMonster(); $ck->checkViewedBooks(); ?> <body> <h1>Home Page</h1> <p>A Great Document Website</p> <p>You haven't viewed any documents yet</p> <p><strong>Documents you have viewed:</strong></p> <?php $bookViewed = $ck->booksViewed; foreach ($bookViewed as $kID) { $bookTitle = $dbp->getTitles($kID); echo "<p>{$bookTitle[$kID]}</p>"; } ?>
<?php # import required library and initiate require_once 'lib.php'; $dbVotes = new persistDisplay(); /** * Triggered via jQuery/Ajax * Return json encoded party list */ if (isset($_GET['voteStats'])) { $party = $_GET['voteStats']; if ($party == 2) { //echo "$party"; echo json_encode($dbVotes->partyList()); } }
<?php # import required library and initiate require_once 'lib.php'; $dbVotes = new persistDisplay(); /** * Triggered via jQuery/Ajax * Return json encoded constituencies */ if (isset($_GET['voteStat'])) { $voteStatGet = $_GET['voteStat']; if ($voteStatGet == 2) { echo json_encode($dbVotes->constituencyList()); } }
<?php # import required library and initiate require_once 'lib.php'; $dbVotes = new persistDisplay(); /** * Triggered via jQuery/Ajax * Submits log details to database */ if (isset($_GET['voteStat'])) { $voteStatGet = $_GET['voteStat']; $voteConstituency = $_GET['voteConstituency']; $votingParty = $_GET['voteParty']; if ($voteStatGet == 2) { $sbtLog = $dbVotes->logResults($voteStatGet, $votingParty, $voteConstituency); //echo json_encode( $dbVotes->constituencyList( ) ) ; //$sbtLog = $dbVotes->logResults(2, 3, 4); } }
<html> <head> <title>Document Detail</title> </head> <body> <?php require_once 'db\\persistence.php'; require_once 'cookie/cookie.php'; $titleid = isset($_GET['id']) ? intval($_GET['id']) : ''; if ($titleid) { $books = new persistDisplay(); $bookDetails = $books->getTitlesInfo($titleid); foreach ($bookDetails as $title => $book) { ?> <h1><?php echo "{$title}"; ?> </h1> <h2>Info</h2> <p> <?php echo $book; ?> </p> <?php }
<!DOCTYPE html> <HTML> <head> <title>Document List</title> </head> <body> <?php require_once 'cookie/cookie.php'; $ck = new cookieMonster(); require_once 'db\\persistence.php'; $dbp = new persistDisplay(); $titles = $dbp->getTitles(); ?> <h1>Documents</h1> <?php foreach ($titles as $id => $title) { $bId = $ck->getValidBookCookie($id); if ($bId != 0 || $bId != '') { ?> <p><?php echo "*" . $title; ?> <a href="detail.php?id=<?php echo $id; ?> ">More Info</a></p> <?php