Esempio n. 1
0
 * Time: 1:22 PM
 */
/**
 * Backend page for administrators and Staff of Cyril's Classic Employees to edit employees
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $editResult = null;
        $sellerCon = new SellerController();
        $personCon = new PersonController();
        $offerCon = new OfferController();
        $featureCon = new FeatureController();
        $foCon = new Feature_OfferController();
        $mediaCon = new MediaController();
        $carCon = new CarController();
        $offerId = null;
        $sellerId = null;
        $personId = null;
        $selectedFeatureIds = array();
        $media = array();
        $carId = null;
        $sellerName = null;
        $carRego = null;
        $preferredPrice = null;
        $description = null;
        $status = null;
        $offerDate = null;
        function checkSelected($id1, $id2)
        {
            if ($id1 == $id2) {
Esempio n. 2
0
<?php

include_once 'imports.php';
session_start();
$model = new CarModel();
$view = new CarView($model);
$controller = new CarController($model, $view);
if (isset($_POST['submit'])) {
    // Submit button clicked on form
    $controller->submitClicked(filter_input(INPUT_POST, 'selected_car_type'), filter_input(INPUT_POST, 'selected_engine_size'), filter_input(INPUT_POST, 'selected_colour'));
} else {
    // Initial page before first submission
    $view->output();
}
Esempio n. 3
0
 */
/**
 * Backend page for administrators and Staff of Cyril's Classic Employees to edit employees
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $editResult = null;
        $sellerCon = new SellerController();
        $custCon = new CustomerController();
        $personCon = new PersonController();
        $offerCon = new OfferController();
        $featureCon = new FeatureController();
        $foCon = new Feature_OfferController();
        $mediaCon = new MediaController();
        $carCon = new CarController();
        $makeCon = new MakeController();
        $modelCon = new ModelController();
        $saleCon = new SaleController();
        $empCon = new EmployeeController();
        $saleId = null;
        $offerId = null;
        $buyerId = null;
        $empId = null;
        $carId = null;
        $sellerName = null;
        $preferredPrice = null;
        $makeName = null;
        $modelName = null;
        $year = null;
        $rego = null;
Esempio n. 4
0
    public function printSales()
    {
        $sales = $this->getSales();
        $offerCon = new OfferController();
        $sellerCon = new SellerController();
        $custCon = new CustomerController();
        $personCon = new PersonController();
        $carCon = new CarController();
        if ($sales->errorInfo()[2] == null) {
            $rows = $sales->fetchAll();
            $rowCount = count($rows);
            if ($rowCount > 0) {
                ?>
                <table class="table table-responsive table-hover">
                    <tr>
                        <th>Sale Date</th><th>Car Rego</th><th>Seller</th><th>Buyer</th><th>Sold Price</th><th>Actions</th>
                    </tr>
                    <?php 
                foreach ($rows as $row) {
                    $offer = $offerCon->getOffer($row['offer_id']);
                    $offerRow = $offer->fetch();
                    if (count($offerRow) > 0) {
                        $buyer = $custCon->getCustomer($row['customer_id']);
                        $buyerRow = $buyer->fetch();
                        if (count($buyerRow) > 0) {
                            $person = $personCon->getPerson($buyerRow['person_id']);
                            $personRow = $person->fetch();
                            $buyerName = $personRow['first_name'] . ' ' . $personRow['surname'];
                            $seller = $sellerCon->getSeller($offerRow['seller_id']);
                            $sellerRow = $seller->fetch();
                            if (count($sellerRow) > 0) {
                                $person = $personCon->getPerson($sellerRow['person_id']);
                                $personRow = $person->fetch();
                                if (count($personRow) > 0) {
                                    $car = $carCon->getCar($offerRow['car_id']);
                                    $carRow = $car->fetch();
                                    if (count($carRow) > 0) {
                                        ?>
                                            <tr>
                                                <td><?php 
                                        echo $row['sale_date'];
                                        ?>
</td><td><?php 
                                        echo $carRow['rego_number'];
                                        ?>
</td><td><?php 
                                        echo $personRow['first_name'] . ' ' . $personRow['surname'];
                                        ?>
</td><td><?php 
                                        echo $buyerName;
                                        ?>
</td><td>$<?php 
                                        echo ucfirst($row['total_price']);
                                        ?>
</td><td><a href="./edit.php?id=<?php 
                                        echo $row['sale_id'];
                                        ?>
" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php 
                                        echo $row['sale_id'];
                                        ?>
" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a></td>
                                            </tr>
                                        <?php 
                                    } else {
                                        ?>
                                            <div class="alert alert-danger" role="alert">
                                                <strong>Uh oh!</strong> The database returned the following error:<br/>
                                                <em><?php 
                                        echo $carRow->errorInfo()[2];
                                        ?>
</em>
                                            </div>
                                        <?php 
                                    }
                                } else {
                                    ?>
                                        <div class="alert alert-danger" role="alert">
                                            <strong>Uh oh!</strong> The database returned the following error:<br/>
                                            <em><?php 
                                    echo $personRow->errorInfo()[2];
                                    ?>
</em>
                                        </div>
                                    <?php 
                                }
                            } else {
                                ?>
                                    <div class="alert alert-danger" role="alert">
                                        <strong>Uh oh!</strong> The database returned the following error:<br/>
                                        <em><?php 
                                echo $sellerRow->errorInfo()[2];
                                ?>
</em>
                                    </div>
                                <?php 
                            }
                        } else {
                            ?>
                                <div class="alert alert-danger" role="alert">
                                    <strong>Uh oh!</strong> The database returned the following error:<br/>
                                    <em><?php 
                            echo $buyerRow->errorInfo()[2];
                            ?>
</em>
                                </div>
                            <?php 
                        }
                    } else {
                        ?>
                            <div class="alert alert-danger" role="alert">
                                <strong>Uh oh!</strong> The database returned the following error:<br/>
                                <em><?php 
                        echo $offerRow->errorInfo()[2];
                        ?>
</em>
                            </div>
                        <?php 
                    }
                }
                ?>
                </table>
            <?php 
            } else {
                ?>
                <div class="alert alert-info" role="alert">
                    <strong>No results.</strong> There are no sales to display<br/>
                    Use the form above to add some.
                </div>
            <?php 
            }
        } else {
            ?>
            <div class="alert alert-danger" role="alert">
                <strong>Uh oh!</strong> The database returned the following error:<br/>
                <em><?php 
            echo $sales->errorInfo()[2];
            ?>
</em>
            </div>
        <?php 
        }
        $sales->closeCursor();
    }
Esempio n. 5
0
 $modelName = null;
 $rego = null;
 $bodyType = null;
 $transmission = null;
 $driveType = null;
 $fuelType = null;
 $year = null;
 $odometer = null;
 $colour = null;
 $doors = null;
 $seats = null;
 $engineSize = null;
 $cylinders = null;
 $modelId = null;
 $makeId = null;
 $carCon = new CarController();
 $modelCon = new ModelController();
 $makeCon = new MakeController();
 function checkSelected($id1, $id2)
 {
     if ($id1 == $id2) {
         echo 'selected';
     }
 }
 if (isset($_GET['id'])) {
     $carId = $_GET['id'];
     $car = $carCon->getCar($carId);
     if ($car->errorInfo()[2] == null) {
         $row = $car->fetch();
         $rowCount = count($row);
         if ($rowCount > 0) {
Esempio n. 6
0
<?php

/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 9/18/15
 * Time: 12:12 PM
 */
/**
 * Home Page for Cyril's Classic Cars
 */
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$makeCon = new MakeController();
$modelCon = new ModelController();
$carCon = new CarController();
$featureCon = new FeatureController();
$mediaCon = new MediaController();
function dollar_format($value)
{
    $value = floatval($value);
    return '$' . number_format($value, 2);
}
function checkSelected($val1, $val2)
{
    if ($val1 == $val2) {
        echo 'selected';
    }
}
function checkFeatures($val, $features)
{
    if (in_array($val, $features)) {
Esempio n. 7
0
 $modelName = null;
 $rego = null;
 $bodyType = null;
 $transmission = null;
 $driveType = null;
 $fuelType = null;
 $year = null;
 $odometer = null;
 $colour = null;
 $doors = null;
 $seats = null;
 $engineSize = null;
 $cylinders = null;
 $modelId = null;
 $makeId = null;
 $carCon = new CarController();
 $modelCon = new ModelController();
 $makeCon = new MakeController();
 function checkSelected($id1, $id2)
 {
     if ($id1 == $id2) {
         echo 'selected';
     }
 }
 if (isset($_GET['id'])) {
     $carId = $_GET['id'];
     $car = $carCon->getCar($carId);
     if ($car->errorInfo()[2] == null) {
         $row = $car->fetch();
         $rowCount = count($row);
         if ($rowCount > 0) {
Esempio n. 8
0
<?php

/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 9/18/15
 * Time: 12:12 PM
 */
/**
 * Home Page for Cyril's Classic Cars
 */
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$makeCon = new MakeController();
$modelCon = new ModelController();
$carCon = new CarController();
$featureCon = new FeatureController();
$foCon = new Feature_OfferController();
$offerCon = new OfferController();
$mediaCon = new MediaController();
$carOffer = null;
$carMake = null;
$carCar = null;
$carModel = null;
$carMedia = null;
function dollar_format($value)
{
    $value = floatval($value);
    return '$' . number_format($value, 2);
}
if (isset($_GET['id'])) {
    $offerId = $_GET['id'];
Esempio n. 9
0
/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 9/27/15
 * Time: 2:01 PM
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_POST['txtOfferId'])) {
    $sellerCon = new SellerController();
    $custCon = new CustomerController();
    $personCon = new PersonController();
    $offerCon = new OfferController();
    $featureCon = new FeatureController();
    $foCon = new Feature_OfferController();
    $mediaCon = new MediaController();
    $carCon = new CarController();
    $makeCon = new MakeController();
    $modelCon = new ModelController();
    $saleCon = new SaleController();
    $empCon = new EmployeeController();
    $offer = $offerCon->getOffer($_POST['txtOfferId']);
    if ($offer->errorInfo()[2] == null) {
        $row = $offer->fetch();
        $rowCount = count($row);
        if ($rowCount > 0) {
            $seller = $sellerCon->getSeller($row['seller_id']);
            $seller = $seller->fetch();
            $person = $personCon->getPerson($seller['person_id']);
            $person = $person->fetch();
            $car = $carCon->getCar($row['car_id']);
            $car = $car->fetch();
Esempio n. 10
0
/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 16/09/15
 * Time: 1:22 PM
 */
/**
 * Backend page for administrators and Staff of Cyril's Classic Cars to add and view models
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $addResult = null;
        $makeCon = new MakeController();
        $modelCon = new ModelController();
        $carCon = new CarController();
        ?>
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
            <meta name="description" content="">
            <meta name="author" content="">
            <link rel="icon" href="../../favicon.ico">

            <title>Cyril's Classic Cars | Administration - Models</title>

            <!-- Bootstrap core CSS -->
Esempio n. 11
0
<?php

/**
 * Backend page for administrators and Staff of Cyril's Classic Cars to add and view models
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $editResult = null;
        $carId = null;
        $modelName = null;
        $rego = null;
        $modelId = null;
        $makeId = null;
        $carCon = new CarController();
        $modelCon = new ModelController();
        $makeCon = new MakeController();
        function checkSelected($id1, $id2)
        {
            if ($id1 == $id2) {
                echo 'selected';
            }
        }
        if (isset($_GET['id'])) {
            $carId = $_GET['id'];
            $car = $carCon->getCar($carId);
            if ($car->errorInfo()[2] == null) {
                $row = $car->fetch();
                $rowCount = count($row);
                if ($rowCount > 0) {
                    $model = $modelCon->getModel($row['model_id']);
Esempio n. 12
0
<?php

/**
 * Created by PhpStorm.
 * User: roessler
 * Date: 9/18/15
 * Time: 12:12 PM
 */
/**
 * Home Page for Cyril's Classic Cars
 */
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
$makeCon = new MakeController();
$modelCon = new ModelController();
$carCon = new CarController();
$featureCon = new FeatureController();
function dollar_format($value)
{
    $value = floatval($value);
    return '$' . number_format($value, 2);
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->