Пример #1
0
 $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) {
             $model = $modelCon->getModel($row['model_id']);
             if ($model->errorInfo()[2] == null) {
Пример #2
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;
        $description = null;
Пример #3
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 edit makes
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $editResult = null;
        $makeId = null;
        $makeName = null;
        $makeCon = new MakeController();
        if (isset($_GET['id'])) {
            $makeId = $_GET['id'];
            $make = $makeCon->getMake($makeId);
            if ($make->errorInfo()[2] == null) {
                $row = $make->fetch();
                $rowCount = count($row);
                if ($rowCount = 1) {
                    $makeName = $row['make_name'];
                }
            }
        }
        if (isset($_POST['hdnAction'])) {
            if ($_POST['hdnAction'] == 'update') {
                $result = $makeCon->updateMake($_POST['hdnMakeId'], $_POST['txtMakeName']);
                $makeName = $_POST['txtMakeName'];
Пример #4
0
<?php

/**
 * 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 makes
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $makeCon = new MakeController();
        ?>
        <!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 - Makes</title>

            <!-- Bootstrap core CSS -->
            <link href="../../../lib/bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet">
Пример #5
0
         $rows = $models->fetchAll();
         $rowCount = count($rows);
         if ($rowCount > 0) {
             $modelResults = array();
             foreach ($rows as $row) {
                 $modelResults[$row['model_name']] = $row['model_name'];
             }
             $modelObject = json_encode($modelResults);
         } else {
             $modelObject = null;
         }
         print_r($modelObject);
         return $modelObject;
     }
 } else {
     $makeCon = new MakeController();
     $make = $makeCon->getMakeByName($_POST['txtMake']);
     if ($make->errorInfo()[2] == null) {
         $make = $make->fetch();
         if (count($make) > 0) {
             $makeId = $make['make_id'];
             $modelCon = new ModelController();
             $models = $modelCon->getModelsInMake($makeId);
             if ($models->errorInfo()[2] == null) {
                 $rows = $models->fetchAll();
                 $rowCount = count($rows);
                 if ($rowCount > 0) {
                     $modelResults = array();
                     foreach ($rows as $row) {
                         $modelResults[$row['model_name']] = $row['model_name'];
                     }
Пример #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();
$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'];
Пример #7
0
    public function printModels()
    {
        $models = $this->getModels();
        $makeCon = new MakeController();
        if ($models->errorInfo()[2] == null) {
            $rows = $models->fetchAll();
            $rowCount = count($rows);
            if ($rowCount > 0) {
                ?>
                <table class="table table-responsive table-hover">
                    <tr>
                        <th>Make Name</th><th>Model Name</th><th>Actions</th>
                    </tr>
                    <?php 
                foreach ($rows as $row) {
                    $make = $makeCon->getMake($row['make_id']);
                    $make = $make->fetch();
                    ?>
                        <tr>
                            <td><?php 
                    echo $make['make_name'];
                    ?>
</td><td><?php 
                    echo $row['model_name'];
                    ?>
</td>
                            <td><a href="./view.php?id=<?php 
                    echo $row['model_id'];
                    ?>
" class="btn btn-info"><span class="glyphicon glyphicon-briefcase"></span> View</a> <a href="./edit.php?id=<?php 
                    echo $row['model_id'];
                    ?>
" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php 
                    echo $row['model_id'];
                    ?>
" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> Delete</a></td>
                        </tr>
                    <?php 
                }
                ?>
                </table>
            <?php 
            } else {
                ?>
                <div class="alert alert-info" role="alert">
                    <strong>No results.</strong> There are no models 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 $models->errorInfo()[2];
            ?>
</em>
            </div>
        <?php 
        }
        $models->closeCursor();
    }
Пример #8
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 delete makes
 */
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'config/config.php';
if (isset($_SESSION['authenticated'])) {
    if ($_SESSION['authenticated'] == true) {
        $deleteResult = null;
        $makeId = null;
        $makeName = null;
        $makeCon = new MakeController();
        if (isset($_GET['id'])) {
            $makeId = $_GET['id'];
            $make = $makeCon->getMake($makeId);
            if ($make->errorInfo()[2] == null) {
                $row = $make->fetch();
                $rowCount = count($row);
                if ($rowCount = 1) {
                    $makeName = $row['make_name'];
                }
            }
        }
        if (isset($_POST['hdnAction'])) {
            if ($_POST['hdnAction'] == 'delete') {
                $result = $makeCon->deleteMake($_POST['hdnMakeId']);
                $makeName = $_POST['txtMakeName'];
Пример #9
0
<?php

/**
 * 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 makes
 */
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();
        if (isset($_POST['hdnAction'])) {
            if ($_POST['hdnAction'] == 'insert') {
                $result = $makeCon->insertMake($_POST['txtMakeName']);
                if ($result->errorInfo()[2] == null) {
                    $addResult = true;
                } else {
                    $addResult = $result->errorInfo()[2];
                }
            }
        }
        ?>
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="utf-8">