Repository navigation
Expand file tree
/
Copy pathInteropShop.php
More file actions
127 lines (100 loc) · 3.27 KB
/
Copy pathInteropShop.php
File metadata and controls
127 lines (100 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
include_once 'lib/CurlHelper.php';
include_once 'lib/Interoperability.php';
//$siteName = utf8_decode($_GET["feedName"]);
//$siteUri= utf8_decode($_GET["feedUri"]);
$userServers = array();
if((isset($siteName) && strlen($siteName) > 0) && (isset($siteUri) && strlen($siteUri) > 0)){
array_push($userServers, new TeamEndPoints($siteName, $siteUri));
}
else {
array_push($userServers, new TeamEndPoints("The Beanz Products", "http://roncabeanz.com/Roncabeanz/ReadProducts.php"));
array_push($userServers, new TeamEndPoints("Think Full Stack Products", "http://www.thinkinfullstack.com/project/apiproducts.php"));
}
$mktProducts = array();
$mtkProductMap = array();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Team Alpha Market</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link href="css/AutoGrid.css" rel="stylesheet" type="text/css">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
</style>
</head>
<body>
<?php
session_start();
$_SESSION['ref'] = $_SERVER['SCRIPT_NAME'];
session_write_close();
?>
<div class="row">
<h1>Team Alpha Market Place</h1>
</div>
<div class="ui-widget">
<label for="searchProd">Search Our Marketplace: </label>
<input id="searchProd", placeholder="Search Products", style="width: 25%">
</div>
<?php
//Step2
foreach ($userServers as $cur) {
$ch = new CurlHelper();
$result = $ch->get($cur->requestUrl);
$products = json_decode($result, TRUE);
?>
<div class="row">
</div>
<div class="row">
<h2><?php echo $cur->name; ?></h2>
</div>
<!-- Portfolio Gallery Grid -->
<div class="infiniteContainer">
<?php
foreach ($products as $product) {
$thumbnail = $product["thumbnail"];
array_push($mktProducts, $product["name"]);
$mtkProductMap[$product["name"]] = $product["clickTo"];
?>
<div class="infiniteCell">
<a href= "<?php echo $product["clickTo"]; ?>">
<span class="data"> <img src="<?php echo $thumbnail; ?>" alt="<?php $product["name"] ?>" style="width:200px"></span>
<span class="data"> <h3><?php echo $product["name"] ?></h3></span>
</a>
</div>
<?php
}
?>
</div>
<!-- END MAIN -->
<?php
}
?>
<script>
$( function() {
var availableTags = <?php echo json_encode($mktProducts);?>;
$( "#searchProd" ).autocomplete({
source: availableTags
});
} );
</script>
<script>
var input = document.getElementById("searchProd");
input.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
var name = document.getElementById("searchProd").value;
var prodUrls = <?php echo json_encode($mtkProductMap); ?>;
var prodUrl = prodUrls[name];
window.location.href = prodUrl;
}
});
</script>
</body>
</html>