Exemplo n.º 1
0
function displayResults($a)
{
    //Make all rows clickable
    //Runs through the search results and displays them
    echo "<h6 header col s12 light>Distance from " . getLocation()['zipCode'] . "&nbsp&nbsp<a href='postcode.php'>Not your location?</a></h6>";
    //Make th elements clickable for sorting
    echo " <br><br><div id='pager1' class='pager'>\n         <form>\n               <div class='row'>\n                 <div class='col s2'>Results Per Page:</div>\n                 <div class='col s2'>\n                <select class=\"pagesize\">\n                        <option selected=\"selected\"  \n                        value=\"10\">10</option>\n                        <option value=\"20\">20</option>\n                        <option value=\"30\">30</option>\n                        <option  value=\"40\">40</option>\n                </select>\n                </div>\n\t   \t</div>\n                <img src=\"img/ic_chevron_left_grey600_18dp.png\" \n                class=\"first\"/>\n                <img src=\"img/ic_arrow_back_grey600_18dp.png\" \n                class=\"prev\"/\n                <input type=\"text\" class=\"pagedisplay\"/>\n                <img src=\"img/ic_arrow_forward_grey600_18dp.png\" \n                class=\"next\"/>\n                <img src=\"img/ic_chevron_right_grey600_18dp.png\" \n                class=\"last\"/>\n\n        </form>\n         </div>\n           <table class='tablesorter hoverable striped ' id='searchResults'>\n            <thead>\n             <tr>\n              <th data-field='name'>Title</th>\n              <th data-field='sdate' >Start Date</th>\n              <th data-field='edate'>End Date</th>\n              <th data-field='loc'>Location</th> \n              <th data-field='dist'>Distance</th>\n              <th data-field='going'>Add/Remove</th>";
    echo "</tr>\n        </thead>\n\n        <tbody id=\"searchResultsBody\">";
    //Run through all results and format them in the table
    foreach ($a as $row) {
        echo "<tr>";
        echo "<td><a href=event.php?id=" . $row['id'] . ">" . $row['name'] . "</td>";
        echo "<td>" . date("d M y", $row['startDate']) . "</td>";
        echo "<td>" . date("d M y", $row["endDate"]) . "</td>";
        echo "<td>" . $row['location'] . "</td>";
        if (isset($row[0])) {
            echo "<td>" . $row[0] . "</td>";
        } else {
            echo '<td></td>';
        }
        echo "<td>";
        if (!goingToEvent($row['id'])) {
            if (!isset($_SESSION['id'])) {
                echo "<form method='post' action='chooselogin.php'><input name='id' type='hidden' value='" . $row['id'] . "'>\n                                        <button type='submit' action='userAddEvent.php' class='btn waves-effect waves-light'><i class='mdi-social-person-add'></button>";
            } else {
                echo "<form method='post' action='userAddEvent.php'><input name='id' type='hidden' value='" . $row['id'] . "'>\n                                        <button type='submit' action='userAddEvent.php' class='btn waves-effect waves-light'><i class='mdi-content-add'></button>";
            }
        } else {
            echo "<form method='post' action='userRmEvent.php'><input name='id' type='hidden' value='" . $row['id'] . "'>\n              <button type='submit' action='userRmEvent.php' class='btn waves-effect waves-light'><i class='mdi-content-remove'></button>";
        }
        echo "</form></td>";
        echo "</tr></a>";
    }
    echo "</tbody>\n         </table>\n         <div id='pager' class='pager'>\n         <form>\n\n\t\t<img src=\"img/ic_chevron_left_grey600_18dp.png\" class=\"first\"/>\n\t\t<img src=\"img/ic_arrow_back_grey600_18dp.png\" class=\"prev\"/\n\t\t<input type=\"text\" class=\"pagedisplay\"/>\n\t\t<img src=\"img/ic_arrow_forward_grey600_18dp.png\" class=\"next\"/>\n\t\t<img src=\"img/ic_chevron_right_grey600_18dp.png\" class=\"last\"/>\n\t\t<select class=\"pagesize\">\n\t\t\t<option selected=\"selected\"  value=\"10\">10</option>\n\t\t\t<option value=\"20\">20</option>\n\t\t\t<option value=\"30\">30</option>\n\t\t\t<option  value=\"40\">40</option>\n\t\t</select>\n\t</form>\n         </div>\n         </div>";
}
Exemplo n.º 2
0
require "style/header.php";
echo '<div id="content">';
require "database.php";
//Get variables
$con = connect();
$stmt = $con->prepare("SELECT * FROM Events WHERE `Id`=?");
$stmt->bind_param('i', $_GET["id"]);
$stmt->execute();
$stmt->bind_result($id, $title, $location, $sdate, $edate, $desc, $postcode, $createdBy);
$stmt->fetch();
$sdate = date("d M y", $sdate);
$edate = date("d M y", $edate);
echo "<br>";
echo '<div class="row">
          <div class="container">';
if (!goingToEvent($_GET['id'])) {
    echo "<form method='post' action='userAddEvent.php'>\n          <input name='id' type='hidden' value='" . $_GET['id'] . "'>\n          <button type='submit' action='userAddEvent.php' class='right btn waves-effect waves-light'><i class='mdi-content-add'></i>I'm going!</button>";
} else {
    echo "<form method='post' action='userRmEvent.php'><input name='id' type='hidden' value='" . $_GET['id'] . "'>\n             <button type='submit' action='userRmEvent.php' class='right btn waves-effect waves-light'><i class='mdi-content-remove'></i>\n            I'm not going any more</button>";
}
echo "</form>";
echo '</div>
        </div>';
echo '<div id="index-banner" class="parallax-container">
          <div class="section no-pad-bot">
            <div class="container">
              <br><br>
              <h1 class="header center blue-text">' . $title . '</h1>
              <div class="row center">
                <h5 id="evdate" class="header col s12 light">';
if ($sdate != $edate) {