<div id="sidebar" style="float:left;width:15%;"> <?php include 'sidebar.php'; ?> </div> <div id="content" style="float:right;width:85%;"> Add Order <form action="action.php?action=add" method="POST"> <table> <tr><td>Title</td><td><input type="text" name="title" id="title"></td></tr> <tr><td>Vehicle</td> <td><select name="vehicle" id="vehicle"><option> --- Select Vehicle --- </option> <?php for ($i = 0; $i < sizeof($mVehicleList); $i++) { $mVehicle = new Vehicle($mVehicleList[$i]); if ($mVehicle->getCurrentJob() == "") { echo "<option value=" . $mVehicleList[$i] . ">" . $mVehicle->getVehicleNumber() . "</option>"; } } ?> </select></td></tr> <tr><td>Driver</td> <td><select name="driver" id="driver"><option> --- Select Driver --- </option> <?php for ($i = 0; $i < sizeof($mDriverList); $i++) { $mDriver = new Driver($mDriverList[$i]); if ($mDriver->getCurrentJob() == "") { echo "<option value=" . $mDriverList[$i] . ">" . $mDriver->getName() . "</option>"; } } ?>
include 'sidebar.php'; ?> </div> <div id="content" style="float:right;width:85%;"> <table> <tr><td style="width:200px;">Vehicle Type</td> <td style="width:200px;">Model</td> <td style="width:200px;">Vehicle Number</td> <td style="width:200px;">Current Job</td> <td style="width:200px;">Current Driver</td> <td style="width:200px;">Action</td> </tr> <?php for ($i = 0; $i < sizeof($mVehicleList); $i++) { $mVehicle = new Vehicle($mVehicleList[$i]); $mJob = new Job($mVehicle->getCurrentJob()); $mDriver = new Driver($mJob->getDriver()); echo "<tr>"; echo "<td>" . $mVehicle->getType() . "</td>"; echo "<td>" . $mVehicle->getModel() . "</td>"; echo "<td>" . $mVehicle->getVehicleNumber() . "</td>"; echo "<td>" . $mJob->getCode() . "</td>"; echo "<td>" . $mDriver->getName() . "</td>"; echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>"; echo "</tr>"; } ?> </table> <div> </div>
if (Vehicle::add($type, $model, $vehicle_number, $make_year, $description)) { //mail to admin.. $veh_id = Vehicle::getIdByNumber($vehicle_number); $adder = new VehicleMailer($veh_id); $adder->sendVehicleAddedMessage(); header('Location:index.php'); } else { header('Location:abc.php'); } break; case "delete": $id = $_GET['id']; echo $_GET['id']; $mVehicle = new Vehicle($id); /* if getCurrentJob() retruns o means vehicle is not on job... */ if ($mVehicle->isOnTrip() != 0 || $mVehicle->getCurrentJob() != 0) { echo '<script language="javascript">'; echo 'alert("Vehicle is on Job, can\'t delte now !!!")'; echo '</script>'; header('Location:index.php'); break; } if ($mVehicle->delete()) { $adder = new VehicleMailer($id); $adder->sendVehicleDeletedMessage(); header('Location:index.php'); } else { header('Location:index.php'); } //header('Location:abc.php'); break;