Example #1
0
require_once 'DealTableGateway.php';
require_once 'BusinessTableGateway.php';
require 'ensureUserLoggedIn.php';
$username = $_SESSION['user_id'];
/*if (isset($_GET) && isset($_GET['sortOrder'])) {
    $sortOrder = $_GET['sortOrder'];
    $columnNames = array("dealName", "numberBeds", "headNurse");
    if (!in_array($sortOrder, $columnNames)) {
        $sortOrder = 'dealName';
    }
}
else {
    $sortOrder = 'dealName';
}*/
$connection = Connection::getInstance();
$dealGateway = new DealTableGateway($connection);
$gateway = new BusinessTableGateway($connection);
$deals = $dealGateway->getDealByUserId($username);
?>
<!DOCTYPE html>
<html>
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script type="text/javascript" src="Javascript/deal.js"></script>
        <title>Yoink!</title>
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
        <link href="CSS/bootstrap.min.css" rel="stylesheet">
        <link href="CSS/custom.css" rel="stylesheet">
<script type="text/javascript" src="Javascript/business.js"></script>
<?php 
require_once 'Connection.php';
require_once 'DealTableGateway.php';
require_once 'BusinessTableGateway.php';
require_once 'UserTableGateway.php';
$id = session_id();
if ($id == "") {
    session_start();
}
require 'ensureUserLoggedIn.php';
$username = $_SESSION['user_id'];
require 'ensureUserLoggedIn.php';
$conn = Connection::getInstance();
$dealGateway = new DealTableGateway($conn);
$userGateway = new UserTableGateway($conn);
$businessGateway = new BusinessTableGateway($conn);
$deals = $dealGateway->getDeals();
$users = $userGateway->getUserByUserName($username);
$businesses = $businessGateway->getBusinesses();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA3kPZdtcJcP3EuDFpPNU3iIfAh0q-X6Gc&libraries=places"></script>
        <title>Yoink!</title>
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
Example #3
0
<?php

require_once 'Deal.php';
require_once 'Connection.php';
require_once 'DealTableGateway.php';
$id = session_id();
if ($id == "") {
    session_start();
}
$dealId = $_SESSION['id'];
require 'ensureUserLoggedIn.php';
$connection = Connection::getInstance();
$gateway = new DealTableGateway($connection);
$deal_description = filter_input(INPUT_POST, 'deal_description', FILTER_SANITIZE_STRING);
$deal_category = filter_input(INPUT_POST, 'deal_category', FILTER_SANITIZE_STRING);
$businessId = filter_input(INPUT_POST, 'businessId', FILTER_SANITIZE_STRING);
if ($dealId === -1) {
    $dealId = NULL;
}
$errorMessage = array();
if ($deal_description === FALSE || $deal_description === '') {
    $errorMessage['$deal_description'] = 'Deal Description must not be blank<br/>';
}
if ($deal_category === FALSE || $deal_category === '') {
    $errorMessage['$deal_category'] = 'Category must not be blank<br/>';
}
if ($businessId === FALSE || $businessId === '') {
    $errorMessage['$businessId'] = 'Business must not be blank<br/>';
}
$gateway->updateDeal($dealId, $deal_description, $deal_category, $businessId);
header('Location: viewDeals.php');
Example #4
0
<?php

require_once 'Deal.php';
require_once 'Connection.php';
require_once 'DealTableGateway.php';
$id = session_id();
if ($id == "") {
    session_start();
}
require 'ensureUserLoggedIn.php';
if (!isset($_GET) || !isset($_GET['id'])) {
    die('Invalid request');
}
$id = $_GET['id'];
$connection = Connection::getInstance();
//gateway calls deleteDeal method from DealTableGateway
$gateway = new DealTableGateway($connection);
$gateway->deleteDeal($id);
header("Location: viewDeals.php");
Example #5
0
if (isset($_GET) && isset($_GET['sortOrder'])) {
    $sortOrder = $_GET['sortOrder'];
    $columnNames = array("businessID", "business_name", "business_address", "business_lat", "business_long", "business_type");
    if (!in_array($sortOrder, $columnNames)) {
        $sortOrder = 'businessID';
    }
} else {
    $sortOrder = 'businessID';
}
if (!isset($_GET) || !isset($_GET['id'])) {
    die('Invalid request');
}
$bId = $_GET['id'];
$connection = Connection::getInstance();
$gateway = new BusinessTableGateway($connection);
$dealGateway = new DealTableGateway($connection);
$statement = $gateway->getBusinessById($bId);
$deals = $dealGateway->getDealByBusinessId($bId);
?>
<!DOCTYPE html>
<html>
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script type="text/javascript" src="Javascript/business.js"></script>
        <title>Yoink!</title>
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
        <link href="CSS/bootstrap.min.css" rel="stylesheet">
        <link href="CSS/custom.css" rel="stylesheet">
Example #6
0
if (isset($_GET) && isset($_GET['sortOrder'])) {
    $sortOrder = $_GET['sortOrder'];
    $columnNames = array("businessID", "business_name", "business_address", "business_lat", "business_long", "business_type");
    if (!in_array($sortOrder, $columnNames)) {
        $sortOrder = 'businessID';
    }
} else {
    $sortOrder = 'businessID';
}
if (!isset($_GET) || !isset($_GET['id'])) {
    die('Invalid request');
}
$dealId = $_GET['id'];
$_SESSION['id'] = $dealId;
$connection = Connection::getInstance();
$gateway = new DealTableGateway($connection);
$businessGateway = new BusinessTableGateway($connection);
$businesses = $businessGateway->getBusinessByUserId($username, $sortOrder);
$statement = $gateway->getDealById($dealId);
if ($statement->rowCount() !== 1) {
    die("Illegal request");
}
$row = $statement->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script type="text/javascript" src="Javascript/deal.js"></script>
        <title>Yoink</title>
Example #7
0
require_once 'Connection.php';
require_once 'DealTableGateway.php';
require_once 'Deal.php';
require_once 'BusinessTableGateway.php';
$sessionId = session_id();
if ($sessionId == "") {
    session_start();
}
require 'ensureUserLoggedIn.php';
if (!isset($_GET) || !isset($_GET['id'])) {
    die('Invalid request');
}
$dealId = $_GET['id'];
$connection = Connection::getInstance();
$dealGateway = new DealTableGateway($connection);
$businessGateway = new BusinessTableGateway($connection);
$businessGateway2 = new BusinessTableGateway($connection);
$deals = $dealGateway->getDealById($dealId);
$businessDeal = $businessGateway2->getBusinessByDealId($dealId);
?>
<!DOCTYPE html>
<html>
    <head>
        <link href='http://fonts.googleapis.com/css?family=Lato:400,700,900' rel='stylesheet' type='text/css'>
        <meta charset="UTF-8">
        <script type="text/javascript" src="Javascript/deal.js"></script>
        <title>Yoink!</title>
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
Example #8
0
<?php

require_once 'Deal.php';
require_once 'Connection.php';
require_once 'DealTableGateway.php';
$id = session_id();
if ($id == "") {
    session_start();
}
$userId = $_SESSION['user_id'];
require 'ensureUserLoggedIn.php';
$connection = Connection::getInstance();
$gateway = new DealTableGateway($connection);
//Validates form data, removes harmful input
$dealId = filter_input(INPUT_POST, 'dealId', FILTER_SANITIZE_NUMBER_INT);
$deal_description = filter_input(INPUT_POST, 'deal_description', FILTER_SANITIZE_STRING);
$deal_category = filter_input(INPUT_POST, 'deal_category', FILTER_SANITIZE_STRING);
$businessId = filter_input(INPUT_POST, 'businessId', FILTER_SANITIZE_STRING);
if ($dealId == -1) {
    $dealId = NULL;
}
if ($userId == -1) {
    $userId = null;
}
//if statements to validate form, works with createDeal.php
$errorMessage = array();
if ($deal_description === FALSE || $deal_description === '') {
    $errorMessage['dealNameError'] = 'Deal Description must not be blank<br/>';
}
if ($deal_category === FALSE || $deal_category === '') {
    $errorMessage['dealCategoryError'] = 'Deal Category must not be blank<br/>';