Example #1
0
 function getProject($project_id)
 {
     $project = [];
     $ConnectionManager = new ConnectionManager();
     $conn = $ConnectionManager->getConnection();
     $stmt = $conn->prepare("SELECT * FROM project WHERE project_id=?");
     $stmt->bind_param("s", $project_id);
     $stmt->execute();
     $stmt->bind_result($project_id, $project_name, $type, $year, $country, $location, $size, $completion_date, $description);
     while ($stmt->fetch()) {
         $project['project_id'] = $project_id;
         $project['project_name'] = $project_name;
         $project['type'] = $type;
         $project['year'] = $year;
         $project['country'] = $country;
         $project['location'] = $location;
         $project['size'] = $size;
         $project['completion_date'] = $completion_date;
         $project['description'] = $description;
     }
     $ConnectionManager->closeConnection($stmt, $conn);
     $photoMgr = new PhotoManager();
     $photo_arr = $photoMgr->getPhotosByProject($project_id);
     $project['photo_arr'] = $photo_arr;
     return $project;
 }
Example #2
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProductManager.php";
include_once "./Manager/PhotoManager.php";
$photoMgr = new PhotoManager();
$productMgr = new ProductManager();
$product_id = addslashes(filter_input(INPUT_POST, 'selected_product_id'));
$color = addslashes(filter_input(INPUT_POST, 'color'));
$qty = intval(addslashes(filter_input(INPUT_POST, 'qty')));
//$url = filter_input(INPUT_POST, 'url');
//print_r($url);
$stock = $productMgr->getStock($product_id);
session_start();
$userid = null;
$addedQty = 0;
$totalQty = 0;
$qty_update = false;
$cart_data = array();
if (!empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $cart_data['error_not_logged_in'] = false;
    //add product to the shopping cart
    if ($productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color) > 0) {
        $addedQty = $productMgr->retrieveItemQtyInShoppingCart($userid, $product_id, $color);
Example #3
0
include_once "./Manager/ProjectManager.php";
include_once "./Manager/PhotoManager.php";
//Get page number from Ajax
if (isset($_POST["page"])) {
    $pageNumber = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
    //filter number
    if (!is_numeric($pageNumber)) {
        die('Invalid page number!');
    }
    //incase of invalid page number
} else {
    $pageNumber = 1;
    //if there's no page number, set it to 1
}
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
$itemPerPage = 10;
$results = [];
$filteredProjects = [];
if (isset($_SESSION['filterResults']) && !empty($_SESSION['filterResults'])) {
    //get total number of records from database
    $filteredProjects = $_SESSION['filterResults'];
    $totalNumberProjects = count($filteredProjects);
    //break records into pages
    $totalPages = ceil($totalNumberProjects / $itemPerPage);
    //fetch position of record
    $pagePosition = ($pageNumber - 1) * $itemPerPage;
    //fetch paginated results
    for ($i = $pagePosition; $i < min($pagePosition + $itemPerPage, $totalNumberProjects); $i++) {
        array_push($results, $filteredProjects[$i]);
    }
Example #4
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'On');
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProductManager.php";
include_once "./Manager/PhotoManager.php";
include_once "./Manager/OrderManager.php";
$productMgr = new ProductManager();
$photoMgr = new PhotoManager();
$orderMgr = new OrderManager();
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$operation = '';
$operation = filter_input(INPUT_POST, 'operation');
if ($operation === '') {
    $operation = $_GET['operation'];
}
if ($operation === "add_product") {
    $valid = true;
    $product_name = filter_input(INPUT_POST, 'product_name');
    $random_no = (string) rand(0, 10000);
    $product_id = "AL" . $random_no;
    $symbol_code = filter_input(INPUT_POST, 'symbol_code');
    if (empty($symbol_code)) {
        $symbol_code = '';
    }
    $price = filter_input(INPUT_POST, 'price');
Example #5
0
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
    <?php 
if (session_status() != PHP_SESSION_ACTIVE) {
    session_start();
}
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProjectManager.php";
include_once "./Manager/PhotoManager.php";
$project_id = filter_input(INPUT_GET, 'project_id');
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
$hdImages = $photoMgr->getHDPhotosByid($project_id);
$detailImage = $hdImages[0];
$project = $projectMgr->getProject($project_id);
$completionDate = date_create_from_format('Y-m-d H:i:s', $project['completion_date']);
?>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
    <link rel="stylesheet" href="./public_html/css/carouselHome.css">
    <link rel="stylesheet" href="./public_html/css/main.css">
    <link rel="stylesheet" href="./public_html/css/dmx_style.css">
    <style>
        .wrapper{
            margin-bottom: 30px;
Example #6
0
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->  
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->  
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<?php 
session_start();
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProjectManager.php";
include_once "./Manager/PhotoManager.php";
if (isset($_GET['message'])) {
    print '<script type="text/javascript">alert("' . $_GET['message'] . '");</script>';
}
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
$projectList = $projectMgr->getAllProjects();
$photoListJson = $photoMgr->getAllPhotosInJson();
?>
<head>
    <title>Admin | Issac</title>
    <!-- Meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Responsive HTML5 Website landing Page for Developers">
    <meta name="author" content="3rd Wave Media">    
    <link rel="shortcut icon" href="favicon.ico">  
    <link href='http://fonts.googleapis.com/css?family=Lato:300,400,300italic,400italic' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="public_html/bootstrap/js/bootstrap.min.js"></script>
Example #7
0
     }
 }
 $ids = implode(',', $photos_to_delete);
 if (count($photos_to_delete) > 0) {
     $query = "DELETE FROM photos WHERE photoid IN ({$ids})";
     $result = mysql_query($query, $db_connection);
     if (!$result) {
         die('Invalid query 4: ' . mysql_error());
     }
 }
 // convert roomurl to photos and clear roomurls whose files dont exist
 $query = "SELECT * FROM property WHERE roomurl != ''";
 $properties_with_roomurl_result = mysql_query($query, $db_connection);
 $missing_files = array();
 $converted_roomurls = array();
 $pm = new PhotoManager($db_connection, $UPLOAD_DIRECTORY);
 while ($property = mysql_fetch_array($properties_with_roomurl_result)) {
     $roomurl = $property['roomurl'];
     $roomurl = str_replace('http://www.j9accommodation.co.uk/j9/upload/', '', $roomurl);
     $roomurl = str_replace('http://www.exceldiving.co.uk/j9/upload/', '', $roomurl);
     $roomurl_path = $UPLOAD_DIRECTORY . '/' . $roomurl;
     if (!file_exists($roomurl_path) || !is_file($roomurl_path)) {
         // file specified by roomurl column doesnt exist so clear it
         $query = 'UPDATE property SET roomurl = "" WHERE id = "' . $property['id'] . '"';
         $result = mysql_query($query, $db_connection);
         if (!$result) {
             die('Invalid query 1: ' . mysql_error());
         }
         array_push($missing_files, $roomurl_path);
     } else {
         // file exists, so rename it then create thumbnails for it
Example #8
0
<?php

require_once 'PhotoManager.php';
require_once 'PhotoManagerWidget.php';
require_once 'connect.php';
require_once 'config.php';
// get property id param
if (array_key_exists('property_id', $_GET)) {
    $property_id = $_GET['property_id'];
} else {
    $property_id = null;
}
// get db connection
$pm = new PhotoManager($db_connection, $UPLOAD_DIRECTORY);
if ($property_id != null) {
    // load photos for property
    $photos = $pm->get_photos_for_property($property_id);
    $photo_manager_widget = new PhotoManagerWidget($property_id, $photos, $SITE_ROOT);
    $photo_manager_widget->render();
}
?>


<br />
<br />

<form action="" method="get">
	<input type="text" name="property_id" placeholder="Enter a property ID" /><input type="submit" />
</form>
Example #9
0
                                                <table class="table table-bordered table-hover table-striped" id="display_product">
                                                    <thead>
                                                        <tr>
                                                            <th> </th>
                                                            <th>Product ID</th>
                                                            <th>Product Name</th>
                                                            <th>Symbol Code</th>
                                                            <th>Price</th>
                                                            <th>Color</th>
                                                            <th>Stock</th>
                                                            <th width="10%">Edit</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <?php 
$photoMgr = new PhotoManager();
foreach ($product_list as $product) {
    $p_id = $product["product_id"];
    $p_name = $product["product_name"];
    $p_symbol_code = $product["symbol_code"];
    $p_price = $product["price"];
    $p_color = $product["color"];
    $description = htmlentities($product["description"]);
    $p_stock = $product["stock"];
    $photo_url_arr = $photoMgr->getPhotos($p_id);
    $photo_url_string = str_replace('"', "&quot;", str_replace(array("{", "}"), "", json_encode($photo_url_arr)));
    $p_color_optional_code_arr = $productMgr->getAllColorOptionalCodeByProduct($p_id);
    $p_color_optional_code_string = str_replace('"', "&quot;", str_replace(array("{", "}"), "", json_encode($p_color_optional_code_arr)));
    ?>
                                                           <tr>
                                                               <td><input type="checkbox" class="productList_id" value="<?php 
Example #10
0
include_once "./Manager/ProductManager.php";
include_once "./Manager/CreditManager.php";
include_once "./Manager/PhotoManager.php";
// Load the header
$userid = null;
$username = null;
if (!empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $pos = strpos($userid, "@");
    // $username is displayed in the header
    $username = substr($userid, 0, $pos);
}
$checkoutList = $_POST;
$productMgr = new ProductManager();
$photoMgr = new PhotoManager();
$list = [];
//var_dump($checkoutList);
foreach ($checkoutList as $checkout) {
    $product = $productMgr->getProduct($checkout["productId"]);
    $item = [];
    $photoList = $photoMgr->getPhotos($product["product_id"]);
    $item["product_id"] = $product["product_id"];
    $item["product_name"] = $product["product_name"];
    $item["color"] = $checkout["color"];
    $item["thumbnail"] = $photoList[$item["color"]];
    $item["quantity"] = $checkout["quantity"];
    $item["price"] = $product["price"];
    $item["subtotal"] = $checkout["quantity"] * $product["price"];
    $item["add_to_cart_time"] = $checkout["create_time"];
    array_push($list, $item);
Example #11
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'On');
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProjectManager.php";
include_once "./Manager/PhotoManager.php";
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$operation = "";
$operation = filter_input(INPUT_POST, 'operation');
if ($operation == "") {
    $operation = $_GET['operation'];
}
if ($operation === "create") {
    $valid = true;
    $random_no = (string) rand(0, 10000);
    $project_id = "P" . $random_no;
    $project_name = filter_input(INPUT_POST, 'name');
    $type = $_POST['type'];
    $year = filter_input(INPUT_POST, 'year');
    $country = filter_input(INPUT_POST, 'country');
    $location = filter_input(INPUT_POST, 'location');
    $size = filter_input(INPUT_POST, 'size');
    $completion_date = filter_input(INPUT_POST, 'completion_date');
    $date = new DateTime($completion_date);
Example #12
0
<?php

require_once 'ApiResponses.php';
require_once '../config.php';
if (!array_key_exists('photo_id', $_POST)) {
    $response = new ApiResponseFailure('Missing photo id');
    $response->render();
}
$photo_id = $_POST['photo_id'];
// get file names from db
require_once '../connect.php';
require_once '../PhotoManager.php';
$pm = new PhotoManager($db_connection, $UPLOAD_DIRECTORY);
$photo = $pm->get_photo_by_id($photo_id);
$photo->delete();
$response = new ApiResponseSuccess();
$response->render();
Example #13
0
<?php

require_once 'ApiResponses.php';
require_once '../config.php';
if (!array_key_exists('property_id', $_POST) || !array_key_exists('file_contents', $_POST) || !array_key_exists('file_name', $_POST)) {
    $response = new ApiResponseFailure('Missing one of the following: file_contents, file_name, property_id');
    $response->render();
}
// get file contents and other data
$file_contents = explode(",", $_POST['file_contents']);
$file_contents = $file_contents[1];
$file_contents = str_replace(' ', '+', $file_contents);
$file_contents = base64_decode($file_contents);
$file_name = $_POST['file_name'];
$property_id = $_POST['property_id'];
// add the photo
require_once '../connect.php';
require_once '../PhotoManager.php';
$pm = new PhotoManager($db_connection, $UPLOAD_DIRECTORY);
$file_name = PhotoManager::generate_file_name($file_name);
$written_files = $pm->add_photo($file_name, $file_contents, $property_id);
$response = new ApiResponseFileUploaded($written_files['photo_id'], $written_files['file_name'], $written_files['file_name_medium'], $written_files['file_name_small']);
$response->render();
Example #14
0
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php 
if (session_status() != PHP_SESSION_ACTIVE) {
    session_start();
}
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProductManager.php";
include_once "./Manager/PhotoManager.php";
$productMgr = new ProductManager();
$photoMgr = new PhotoManager();
$userid = null;
$username = null;
if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $pos = strpos($userid, "@");
    // $username is displayed in the header
    $username = substr($userid, 0, $pos);
    $cart_items = $productMgr->retrieveFromShoppingCart($userid);
    $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid);
}
$selected_product_id = addslashes(filter_input(INPUT_GET, 'selected_product_id'));
$selected_product_color = addslashes(filter_input(INPUT_GET, 'color'));
$product_selected = $productMgr->getProduct($selected_product_id);
$selected_product_name = $product_selected['product_name'];
$selected_product_description = $product_selected['description'];
Example #15
0
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php 
if (session_status() != PHP_SESSION_ACTIVE) {
    session_start();
}
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProductManager.php";
include_once "./Manager/PhotoManager.php";
$productMgr = new ProductManager();
$photoMgr = new PhotoManager();
$userid = null;
$username = null;
if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $pos = strpos($userid, "@");
    // $username is displayed in the header
    $username = substr($userid, 0, $pos);
    $cart_items = $productMgr->retrieveFromShoppingCart($userid);
    $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid);
}
?>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Latest compiled and minified CSS -->
Example #16
0
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php 
if (session_status() != PHP_SESSION_ACTIVE) {
    session_start();
}
include_once "./Manager/ConnectionManager.php";
include_once "./Manager/ProductManager.php";
include_once "./Manager/PhotoManager.php";
$productMgr = new ProductManager();
$photoMgr = new PhotoManager();
$userid = null;
$username = null;
if (isset($_SESSION["userid"]) && !empty($_SESSION["userid"])) {
    // $userid is customer email address
    $userid = $_SESSION["userid"];
    $pos = strpos($userid, "@");
    // $username is displayed in the header
    $username = substr($userid, 0, $pos);
    $cart_items = $productMgr->retrieveFromShoppingCart($userid);
    $cart_total_qty = $productMgr->retrieveTotalNumberOfItemsInShoppingCart($userid);
}
include_once "./protect.php";
?>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
Example #17
0
<?php

require_once 'ApiResponses.php';
require_once '../config.php';
if (!array_key_exists('photo_id', $_POST)) {
    $response = new ApiResponseFailure('Missing photo_id');
    $response->render();
}
require_once '../connect.php';
require_once '../PhotoManager.php';
// get property id from photo
$photo_id = $_POST['photo_id'];
$pm = new PhotoManager($db_connection, $UPLOAD_DIRECTORY);
$photo = $pm->get_photo_by_id($photo_id);
$property_id = $photo->propertyid;
// set default to 0 for all photos for this property
$pm->reset_default_for_property($property_id);
// set photo to default
$pm->set_default($photo_id, 1);
// return successful
$response = new ApiResponseSuccess();
$response->render();
include_once "./Manager/PhotoManager.php";
//Get page number from Ajax
if (isset($_POST["page"])) {
    $pageNumber = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
    //filter number
    if (!is_numeric($pageNumber)) {
        die('Invalid page number!');
    }
    //incase of invalid page number
} else {
    $pageNumber = 1;
    //if there's no page number, set it to 1
}
$project_id = filter_input(INPUT_POST, 'project_id');
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
$photoPerPage = 9;
$results = [];
//get total number of records from database
$totalNumberImages = $photoMgr->getTotalNumberOfThumbnailPhotosOfProject($project_id);
//break records into pages
$totalPages = ceil($totalNumberImages / $photoPerPage);
//fetch position of record
$pagePosition = ($pageNumber - 1) * $photoPerPage;
//Fetch part of records using SQL LIMIT clause
$results = $photoMgr->getPaginatedResults($pagePosition, $photoPerPage, $project_id);
//Display fetched records
if (!empty($results)) {
    //$_SESSION['results'] = $filteredProjects;
    ?>
        <div id='thumbnails'>