<?php // this is to check if the user is the (owner), (owner + driver), or (owner + conductor) $bp = new BusPersonnel(); $routes = BusRoute::find_all(); $buses = Bus::find_all(); $bus_personnel = BusPersonnel::find_all(); $photo_types = $photo_type_object->get_photo_types("bus"); $photos_of_bus = $photo_object->get_photos('3', $_GET['busid']); //GET request stuff if (isset($_GET['busid'])) { $bus_to_read_update = $bus_object->find_by_id($_GET['busid']); $complaints_of_bus = $complaint_object->get_complaints_for_object(3, $_GET['busid']); $feedback_on_bus = $feedback_item_object->get_feedback_items_for_object(3, $_GET['busid']); } else { $session->message("No Bus ID provided to view."); redirect_to("admin-list-buses.php"); } //check login if ($session->is_logged_in()) { if ($session->object_type == 5) { //admin user $user = $admin_user_object->find_by_id($_SESSION['id']); $profile_picture = $photo_object->get_profile_picture($session->object_type, $user->id); if (isset($_POST['submit'])) { $bus_to_read_update->route_id = $_POST['route_id']; $bus_to_read_update->reg_number = $_POST['reg_number']; $bus_to_read_update->name = $_POST['name']; if ($bus_to_read_update->update()) { $session->message("Success! The Bus details were updated. "); redirect_to('admin-list-buses.php');
<div class="clearfix"> </div> <div> <ul class="bus-stops-list"> <li class=""><h4>Routes that pass through <?php echo $stop_to_read_update->name; ?> </h4></li> <li class=""> </li> <?php for ($i = 0; $i < count($stops_routes); $i++) { ?> <?php $br = new BusRoute(); $route = $br->find_by_id($stops_routes[$i]->route_id); ?> <li><a href="admin-read-update-route.php?routeid=<?php echo $route->id; ?> " class="btn btn-info"><?php echo $route->route_number; ?> </a> from <a href="admin_read_update_stop.php?stopid=<?php echo BusStop::find_by_id($route->begin_stop)->id; ?> " class="btn btn-info"><?php echo BusStop::find_by_id($route->begin_stop)->name; ?> </a> to <a href="admin_read_update_stop.php?stopid=<?php
<?php require_once "../includes/initialize.php"; if (!$session->is_logged_in()) { redirect_to("login.php"); } else { $admin_user = AdminUser::find_by_id($_SESSION['id']); } if (empty($_GET['routeid'])) { $session->message("Eror. No Route ID was provided. "); redirect_to("index.php"); } $route_to_delete = BusRoute::find_by_id($_GET['routeid']); if ($route_to_delete && $route_to_delete->delete()) { $session->message("Success! The Bus Route has been deleted. "); redirect_to("admin-list-routes.php"); } else { $session->message("Error. The Bus Route could not be deleted. "); }
<?php require_once '../../includes/initialize.php'; //init code $object_type = new ObjectType(); $bp_role = new BusPersonnelRole(); $bus_route_object = new BusRoute(); $bus_object = new Bus(); $complaint_type = new ComplaintType(); $routes = BusRoute::find_all(); $stops = BusStop::find_all(); $buses = Bus::find_all(); $bus_personnel = BusPersonnel::find_all(); $q = $_GET['q']; $selected_complaint_type = $complaint_type->find_by_id($q); $selected_object_type = $object_type->find_by_id($selected_complaint_type->related_object_type); if ($selected_object_type->object_type_name == 'route') { echo '<label for="bus_route_id" class="control-label">Bus Route</label>'; echo '<div class="controls">'; echo '<select name="bus_route_id">'; foreach ($routes as $route) { echo '<option value="' . $route->id . '">'; echo $route->route_number; echo '</option>'; } echo '</select>'; echo '</div>'; } else { if ($selected_object_type->object_type_name == 'stop') { echo '<label for="stop_id" class="control-label">Bus Stop</label>'; echo '<div class="controls">';