Ejemplo n.º 1
0
 $description = $offer['description'];
 $offerDate = $offer['offer_date'];
 $buyerId = $row['customer_id'];
 $empId = $row['emp_id'];
 $deductions = $row['deductions'];
 $total = $row['total_price'];
 $seller = $sellerCon->getSeller($sellerId);
 $seller = $seller->fetch();
 $personId = $seller['person_id'];
 $person = $personCon->getPerson($personId);
 $person = $person->fetch();
 $sellerName = $person['first_name'] . ' ' . $person['surname'];
 $car = $carCon->getCar($carId);
 $car = $car->fetch();
 $modelId = $car['model_id'];
 $model = $modelCon->getModel($modelId);
 $model = $model->fetch();
 $modelName = $model['model_name'];
 $make = $makeCon->getMake($model['make_id']);
 $make = $make->fetch();
 $makeName = $make['make_name'];
 $year = $car['year'];
 $rego = $car['rego_number'];
 $fo = $foCon->getFeaturesForOffer($offerId);
 $fo = $fo->fetchAll();
 $featureIds = array();
 foreach ($fo as $f) {
     $featureIds[] = $f['feature_id'];
 }
 foreach ($featureIds as $featureId) {
     $f = $featureCon->getFeature($featureId);
Ejemplo n.º 2
0
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>Picture</th>
                        <th>Make</th>
                        <th>Model</th>
                        <th>Engine</th>
                        <th>Price (AUD)</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
        foreach ($offers as $offer) {
            $car = $carCon->getCar($offer['car_id']);
            $car = $car->fetch();
            $model = $modelCon->getModel($car['model_id']);
            $model = $model->fetch();
            $make = $makeCon->getMake($model['make_id']);
            $make = $make->fetch();
            $media = $mediaCon->getMediaForOffer($offer['offer_id']);
            $media = $media->fetch();
            ?>
                        <tr>
                            <td><img src="<?php 
            echo $media['file_path'];
            ?>
" width="250" class="img-responsive" alt="Generic placeholder thumbnail"></td>
                            <td><?php 
            echo $make['make_name'];
            ?>
</td>
Ejemplo n.º 3
0
 $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) {
                 $modelRow = $model->fetch();
                 $rowCount = count($modelRow);
                 if ($rowCount == 1) {
                     $makeId = $modelRow['make_id'];
                 }
             }
             $rego = $row['rego_number'];
             $bodyType = $row['body_type'];
             $transmission = $row['transmission'];
             $driveType = $row['drive_type'];
             $fuelType = $row['fuel_type'];
             $year = $row['year'];
             $odometer = $row['odometer'];
             $colour = $row['colour'];
Ejemplo n.º 4
0
    public function printCars()
    {
        $cars = $this->getCars();
        $makeCon = new MakeController();
        $modelCon = new ModelController();
        if ($cars->errorInfo()[2] == null) {
            $rows = $cars->fetchAll();
            $rowCount = count($rows);
            if ($rowCount > 0) {
                ?>
                <table class="table table-responsive table-hover">
                    <tr>
                        <th>Make Name</th><th>Model Name</th><th>Year</th><th>Body Type</th><th>Registration Number</th><th>Actions</th>
                    </tr>
                    <?php 
                foreach ($rows as $row) {
                    $model = $modelCon->getModel($row['model_id']);
                    $model = $model->fetch();
                    $make = $makeCon->getMake($model['make_id']);
                    $make = $make->fetch();
                    ?>
                        <tr>
                            <td><?php 
                    echo $make['make_name'];
                    ?>
</td><td><?php 
                    echo $model['model_name'];
                    ?>
</td><td><?php 
                    echo $row['year'];
                    ?>
</td><td><?php 
                    echo $row['body_type'];
                    ?>
</td><td><?php 
                    echo $row['rego_number'];
                    ?>
</td>
                            <td><a href="./view.php?id=<?php 
                    echo $row['car_id'];
                    ?>
" class="btn btn-info"><span class="glyphicon glyphicon-briefcase"></span> View</a> <a href="./edit.php?id=<?php 
                    echo $row['car_id'];
                    ?>
" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="./delete.php?id=<?php 
                    echo $row['car_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 cars 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 $cars->errorInfo()[2];
            ?>
</em>
            </div>
        <?php 
        }
        $cars->closeCursor();
    }