<?php //init code $stops = BusStop::find_all(); //GET request stuff if (isset($_GET['stopid'])) { $stop_to_read_update = $stop_object->find_by_id($_GET['stopid']); $stops_routes = $stop_route_object->get_routes_for_stop($stop_to_read_update->id); $complaints_of_stop = $complaint_object->get_complaints_for_object(2, $_GET['stopid']); $feedback_on_stop = $feedback_item_object->get_feedback_items_for_object(2, $_GET['stopid']); } else { $session->message("No Stop ID provided to view."); redirect_to("admin-list-stops.php"); } $photo_types = $photo_type_object->get_photo_types("bus_stop"); $photos_of_stop = $photo_object->get_photos('2', $_GET['stopid']); //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'])) { $stop_to_read_update->name = $_POST['name']; $stop_to_read_update->location_latitude = $_POST['location_latitude']; $stop_to_read_update->location_longitude = $_POST['location_longitude']; if ($stop_to_read_update->update()) { $session->message("Success! The Bus Stop details were updated. "); redirect_to('admin-list-stops.php'); } else { $session->message("Error! The Bus Stop details could not be updated. ");
/** * Retrieve a single record * * @param string unique $id * @return Response */ public function show($id) { $bus_stop = BusStop::find($id); echo json_encode($bus_stop); }
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 echo BusStop::find_by_id($route->end_stop)->id; ?> " class="btn btn-info"><?php echo BusStop::find_by_id($route->end_stop)->name; ?> </a></li> <li> </li> <?php } ?> </ul> </div> </div> <div class="tab-pane fade" id="map_location"> <section>
<div> <ul class="bus-stops-list"> <li class=""><h2>Route Number: <?php echo $route_to_read_update->route_number; ?> </h2></li> <li class=""> </li> <?php for ($i = 0; $i < count($stops_routes); $i++) { ?> <li><a href="admin-read-update-stop.php?stopid=<?php echo BusStop::find_by_id($stops_routes[$i]->stop_id)->id; ?> " class="btn btn-success"><?php echo BusStop::find_by_id($stops_routes[$i]->stop_id)->name; ?> </a></li> <?php if ($i != count($stops_routes) - 1) { echo '<li> <i class="icon-arrow-down"></i></li>'; } ?> <?php } ?> </ul> </div> </div>
<?php require_once '../../includes/initialize.php'; $stop_object = new BusStop(); $stops = $stop_object->find_all(); for ($i = 0; $i < count($stops); $i++) { if ($i == 0) { $stop_in_json = '['; $stop_in_json .= json_encode($stops[$i]->name); } else { $stop_in_json .= json_encode($stops[$i]->name); } if ($i == count($stops) - 1) { $stop_in_json .= ']'; } else { $stop_in_json .= ','; } } echo $stop_in_json;
<?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'])) { $stop_to_create = new BusStop(); $stop_to_create->name = $_POST['name']; $stop_to_create->location_latitude = $_POST['location_latitude']; $stop_to_create->location_longitude = $_POST['location_longitude']; if ($stop_to_create->create()) { $session->message("Success! The new Bus Stop has been added. "); redirect_to('admin-list-stops.php'); } else { $session->message("Error! The Bus Stop could not be added. "); } } } else { $session->message("Error! You do not have sufficient priviledges to view the requested page. "); redirect_to("index.php"); } } else { $session->message("Error! You must login to view the requested page. "); redirect_to("login.php"); }
<?php $lib = new BusStop(); $przystanek = $lib->getPrzystanek();
<?php $lib = new BusStop(); $przystanek = $lib->getAllBusStop(); $tmp = array(); foreach ($_POST['hours'] as $key => $hour) { $tmp[] = $hour . ' ' . $_POST['legend'][$key]; } $str = implode(';', $tmp); //echo $str."<br /><br />"; if (!empty($_POST['Save'])) { //tutaj zapis $hours = implode(';', $_POST['hours']); //sklejenie do stringa echo $hours; } //to sa przykladowe dane o odjazdach //my oczywiscie wyciagniemy je z bazy :] $odj = '12:45;13:05;13:54;15:12'; $odj = explode(';', $odj); if (!empty($_POST['dodaj_odjazdy'])) { $tmp = array(); foreach ($_POST['hours1'] as $key => $hours) { $tmp1[] = $hours . ' ' . $_POST['legend1'][$key]; } foreach ($_POST['hours2'] as $key => $hours) { $tmp2[] = $hours . ' ' . $_POST['legend2'][$key]; } foreach ($_POST['hours3'] as $key => $hours) { $tmp3[] = $hours . ' ' . $_POST['legend3'][$key]; }
/** * @covers Application\Entity\BusStop::setOperator */ public function testSetOperator() { $this->assertEquals($this->object, $this->object->setOperator("CXX")); }