示例#1
0
<?php

include 'includes/header.php';
require_once "content/content_handler.php";
?>
<div id="body" class="container">
	<section id="main">
		<div id="about">
			<h1>Trips</h1>
			<div>We have trips every month in the best trails around town. These are open to everyone so if you would like to socialize with a group of friendly cyclists and enjoy the fresh air in this normally busy city, feel free to join us, regardless of your cycling experience. <br/><br/> Our trips are always on the first Saturday every month, at 9:00 AM in the morning when the temperatures are nicest.
			</div>
		</div><br/>

		<div id="trips">
			<?php 
$trips = getTrips();
$current = getUpcomingTrip();
$locations = getTripLocations();
$currDate = date('F j', $current['datetime']);
?>
			<h3 class="title" style="text-align:left;"> Our Next Trip </h3>
			<div id="trip<?php 
echo $current['trip_id'];
?>
" class="trip" class="twelve columns">
				<div class="row">
					<div class="eight columns nomargin">
						<img id="tripHero<?php 
echo $current['trip_id'];
?>
" class="tripHero" src="img/trails/<?php 
    $result = scraperwiki::sqliteexecute("select * from routes where route ='" . $route['route'] . "'");
    if (isset($result->data[0][2]) && $result->data[0][2] == 'complete') {
        //already scraped
    } else {
        $routes[] = $route;
    }
}
scraperwiki::save_sqlite(array('route'), $routes, "routes", 0);
#Fetch trips along a route
if ($debug == 1) {
    $recTemp[] = $routes[0];
    $recTemp[] = $routes[1];
    $routes = $recTemp;
}
foreach ($routes as $route) {
    getTrips($route);
    $route['status'] = 'complete';
    scraperwiki::save_sqlite(array('route'), $route, "routes", 0);
}
function getTrips($route)
{
    //check if route exists and is complete
    $route_id = $route['route'];
    global $trips, $route_url, $debug;
    $route_url_full = $route_url . $route['route'];
    $html = scraperWiki::scrape($route_url_full);
    $dom = new simple_html_dom();
    $dom->load($html);
    $directions = array('Inbound', 'Outbound');
    foreach ($directions as $direction) {
        foreach ($dom->find('table.' . $direction . ' tbody tr') as $timetable) {
示例#3
0
            include "views/password_reset.php";
        } else {
            // no data from a password-reset-mail has been provided,
            // we show the request-a-password-reset form
            include 'views/password_reset_request.php';
        }
        // show the edit form to modify username, email or password
    } else {
        if (isset($_GET['edit']) && $login->isUserLoggedIn()) {
            include 'views/edit.php';
            // the user is logged in, we show informations about the current user
        } else {
            if ($login->isUserLoggedIn()) {
                include 'views/logged_in.php';
                include 'includes/functions.php';
                $userTrips = getTrips($_SESSION['user_id']);
                //print all the trips the user has
                echo "<table cellpadding=1 class='table tablesorter' id='thetable'>";
                echo "<thead>";
                echo "<th>Trip Name</th><th>Date</th><th>Location</th>";
                echo "</thead>";
                while ($info = mysqli_fetch_array($userTrips)) {
                    echo "<tr>";
                    echo "<td><a href='createTrip.php?trip_id=" . $info['id'] . "'>" . $info['name'] . "</a></td> ";
                    echo "<td>" . $info['startDate'] . "</td> ";
                    echo "<td>" . $info['location'] . "</td></tr> ";
                }
                echo "</table><br><br>";
                ?>