コード例 #1
0
function outputImageInfo($dbAdapter)
{
    $gateTravelImageDetails = new TravelImageDetailsTableGateway($dbAdapter);
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $result = $gateTravelImageDetails->findById($_GET['id']);
    $imageId = $result->ImageID;
    $path = $gateTravelImage->findById($imageId)->Path;
    $UID = $gateTravelImage->findById($imageId)->UID;
    $latitude = $result->Latitude;
    $longitude = $result->Longitude;
    $location = array("latitude" => $latitude, "longitude" => $longitude);
    echo utf8_encode('<ol class="breadcrumb">
			<li><a href="index.php">Home</a></li>
			<li><a href="browse.php">Browse</a></li>
			<li><a href="browse-images.php">Images</a></li>
			<li class="active">' . utf8_encode($result->Title) . '</li>
		</ol>');
    singleImagePanel($result->Title, $path, $result->Description);
    generateMapPanel($location);
    echo '<div class="row">
			<div class="col-md-3">';
    imageByPanel($UID, $dbAdapter);
    echo '</div><div class="col-md-3">';
    ImageDetailsPanel($result->CityCode, $result->CountryCodeISO, $dbAdapter);
    echo '</div><div class="col-md-3">';
    socialPanel();
    echo '</div><div class="col-md-3">';
    cartpanel();
    echo '</div></div>';
}
コード例 #2
0
function ImagesFrom($countryName, $dbAdapter)
{
    $gate = new TravelImageTableGateway($dbAdapter);
    $countryIso = $_GET['iso'];
    $where = 'CountryCodeISO = :countryIso';
    $result = $gate->findBy($where, array(':countryIso' => $countryIso));
    echo '<div class="panel panel-primary">
		<div class="panel-heading">Images From ' . $countryName . '</div>
			<div class="panel-body">';
    OutputImages($result);
    echo '</div>
		</div>';
}
コード例 #3
0
function displayImages($dbAdapter)
{
    $gate = new TravelImageTableGateway($dbAdapter);
    if (isset($_GET['go'])) {
        $search = $_GET['go'];
        /* $result = $gate->findBySearch($search); */
        $where = "Title LIKE :searched1 OR Description LIKE :searched2";
        $result = $gate->findBy($where, array(':searched1' => "%" . $search . "%", ':searched2' => "%" . $search . "%"));
    } elseif (isset($_GET['country']) && isset($_GET['city']) && $_GET['country'] != 'ZZZ' && $_GET['city'] != '0') {
        $cityIso = $_GET['city'];
        $countryIso = $_GET['country'];
        $where = 'CountryCodeISO = :countryIso AND CityCode = :cityIso';
        $result = $gate->findBy($where, array(':countryIso' => $countryIso, ':cityIso' => $cityIso));
    } elseif (isset($_GET['city']) && $_GET['city'] == '0' && isset($_GET['country']) && $_GET['country'] != 'ZZZ') {
        $countryIso = $_GET['country'];
        $where = 'CountryCodeISO = :countryIso';
        $result = $gate->findBy($where, array(':countryIso' => $countryIso));
    } elseif (isset($_GET['city']) && ($_GET['country'] == 'ZZZ' && $_GET['city'] != '0')) {
        $cityIso = $_GET['city'];
        $where = 'CityCode = :cityIso';
        $result = $gate->findBy($where, array(':cityIso' => $cityIso));
    } else {
        $result = $gate->findAll();
    }
    if (isset($_GET['go']) && empty($result)) {
        echo "Search returned no results.";
    } else {
        OutputImages($result);
        // called from functions.php
    }
}
コード例 #4
0
function outputPostRows($dbAdapter)
{
    $gateTravelPost = new TravelPostTableGateway($dbAdapter);
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $gateTravelUserDetails = new TravelUserDetailsTableGateway($dbAdapter);
    $gateTravelPostImage = new TravelPostImagesTableGateway($dbAdapter);
    $result = $gateTravelPost->findAll();
    foreach ($result as $row) {
        $postId = $row->PostID;
        $userId = $row->UID;
        $imageId = $gateTravelPostImage->findById($postId)->ImageID;
        $thumb = $gateTravelImage->findById($imageId)->Path;
        $title = $row->Title;
        $firstName = $gateTravelUserDetails->findById($userId)->FirstName;
        $lastName = $gateTravelUserDetails->findById($userId)->LastName;
        $userName = utf8_encode($firstName . $lastName);
        $excerpt = substr($row->Message, 0, 200) . "...";
        $date = substr($row->PostTime, 0, 10);
        echo utf8_encode('<div class="row">
		               <div class="col-md-2">
								<a href="single-image.php?id=' . $imageId . '" class="">
								<img src="travel-images/square-medium/' . $thumb . '" alt="' . $title . '" class="img-thumbnail"/>
								</a>
		               </div>
		              <div class="col-md-10">
		                  <h2>' . $title . '</h2>
		                  <div class="details">
		                    Posted by <a href="single-user.php?id=' . $userId . '" class="">' . $userName . '</a>
		                    <span class="pull-right">' . $date . '</span>
		                  </div>
		                  <p class="excerpt">' . $excerpt . '</p>
						  <p><a href="single-post.php?id=' . $postId . '" class="btn btn-primary btn-sm">Read more</a></p>
		               </div>
		           </div>
		           <hr/>');
    }
}
コード例 #5
0
function displayCartItems($dbAdapter)
{
    $gateTravelImageDetails = new TravelImageDetailsTableGateway($dbAdapter);
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $sub = 0;
    // runs through each item in the cart giving a row in the table.
    foreach ($_SESSION["Cart"] as $object) {
        $id = $object->__get("imageID");
        $serial = $object->__get("serial");
        $result = $gateTravelImageDetails->findById($id);
        $title = $result->Title;
        $path = $gateTravelImage->findById($id)->Path;
        $cost = number_format((double) $object->calcCost(), 2, '.', '');
        $sub = $sub + $cost;
        echo '<form action = "addToCart.php?serial=' . $serial . '&amp;modify=update" method = "POST">';
        echo '<tr id = "' . $serial . '" style="border-bottom:2px solid #596a7b ">';
        echo '<td><img src="travel-images/square-small/' . $path . '"></td>';
        echo '<td><a href="single-image.php?id=' . $id . '">' . $title . '</a></td>';
        echo '<td>
							<select name = "size"> ';
        outputOptions($object, "size");
        echo '</select>
						</td>';
        echo '<td>
							<select name = "paper">';
        outputOptions($object, "stock");
        echo '	</select></td>';
        echo '<td><input type = "number" name = "quantity" size = 2 min = "1" max = "50" value = ' . $object->__get("quantity") . ' required></td>';
        echo '<td>
							<select name = "frame" maxlength = 15>';
        outputOptions($object, "frame");
        echo '	</select></td>';
        echo '<td id = "' . $serial . '1">$' . $cost . '';
        echo '<td>';
        echo '<td> <button class = "glyphicon glyphicon-remove" id = "remove"/>';
        echo '</td>';
        echo "</tr>";
        echo '</form>';
    }
    return $sub;
}
コード例 #6
0
    $gateTravelImageDetails = new TravelImageDetailsTableGateway($dbAdapter);
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $imageID = $_GET['favorite_image_id'];
    $path = $gateTravelImage->findById($imageID)->Path;
    $title = $gateTravelImageDetails->findById($imageID)->Title;
    $favoriteImage = new FavoriteImage(FavoriteImage::getFieldNames(), false);
    $favoriteImage->imageID = $imageID;
    $favoriteImage->path = $path;
    $favoriteImage->title = $title;
    $favoriteImageList[] = $favoriteImage;
    $_SESSION['favoriteImageList'] = $favoriteImageList;
    header('Location: single-image.php?id=' . $_GET['favorite_image_id']);
} elseif (isset($_GET['favorite_post_id']) && is_numeric($_GET['favorite_post_id']) && $_GET['favorite_post_id'] >= 0) {
    $gateTravelPost = new TravelPostTableGateway($dbAdapter);
    $gateTravelPostImage = new TravelPostImagesTableGateway($dbAdapter);
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $postID = $_GET['favorite_post_id'];
    $imageID = $gateTravelPostImage->findById($postID)->ImageID;
    $path = $gateTravelImage->findById($imageID)->Path;
    $title = $gateTravelPost->findById($postID)->Title;
    $favoritePost = new FavoritePost(FavoritePost::getFieldNames(), false);
    $favoritePost->postID = $postID;
    $favoritePost->path = $path;
    $favoritePost->title = $title;
    $favoritePostList[] = $favoritePost;
    $_SESSION['favoritePostList'] = $favoritePostList;
    header('Location: single-post.php?id=' . $_GET['favorite_post_id']);
} else {
    header("Location: error.php");
    die;
}
コード例 #7
0
function outputThumbnail($dbAdapter)
{
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $result = $gateTravelImage->findForPost($_GET['id']);
    OutputImages($result);
}
コード例 #8
0
function outputUserImages($dbAdapter)
{
    $gateTravelImage = new TravelImageTableGateway($dbAdapter);
    $result = $gateTravelImage->findForUser($_GET['id']);
    OutputImages($result);
}