-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.php
185 lines (177 loc) · 7.28 KB
/
search.php
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
include("head.php");
ini_set('display_errors',2);
error_reporting(E_ALL);
?>
<body>
<div class='master-container'>
<div class='tagline'>
<div class='tagline-body'>
<div class='tagline-close' onclick="$('.tagline').slideUp()">
<span class='icon'>D</span>
</div>
<div class='tagline-text'>
<div class='text-body'>
<p class='p1'>A <strong>collaborative online platform</strong> for</p>
<br>
<p class='p1'><strong>proposals on urban design</strong></p>
<div class='button-row'>
<a class='uberbutton green' href='http://betaville.net/webstart/betaville.jnlp'>
Download now
<span class='icon i-play'></span>
</a>
<a class='text' href='what-is-betaville.php'>Get info »</a>
<a class='text' href='http://vimeo.com/37300439' id='video'>Watch a demo »</a>
</div>
</div>
</div>
<div class='carousel'>
<ul id='tagline-carousel'>
<li class='carousel-futuristic'>
<div class='carousel-text'>
<em>Betaville is</em>
<br>
<span>Futuristic</span>
</div>
<a class='carousel-learn-more' href='what-is-betaville.php'>Learn more »</a>
</li>
<li class='carousel-opensource'>
<div class='carousel-text'>
<em>Betaville is</em>
<br>
<span>Open Source</span>
</div>
<a class='carousel-learn-more' href='contribute.php'>Learn more »</a>
</li>
<li class='carousel-participatory'>
<div class='carousel-text'>
<em>Betaville is</em>
<br>
<span>Participatory</span>
</div>
<a class='carousel-learn-more' href='contribute.php'>Learn more »</a>
</li>
<li class='carousel-publicart'>
<div class='carousel-text'>
<em>Betaville is</em>
<br>
<span>Public art</span>
</div>
<a class='carousel-learn-more' href='what-is-betaville.php'>Learn more »</a>
</li>
</ul>
<div class='carousel-nav' id='tagline-carousel-nav'>
<a href=''></a>
<a href=''></a>
<a href=''></a>
<a href=''></a>
<div class='active'></div>
</div>
</div>
</div>
<?php
function searchCheck() {
if ( isset( $_POST["searchField"]) && ($_POST['searchType'] == "0")){
$search = $_POST["searchField"];
$temp = SERVICE_URL.'?section=design&request=findbyuser&excludeempty=1&user='.$search;
$temp1 = file_get_contents($temp,0,null,null);
$temp2 = json_decode($temp1, true);
$results=$temp2['designs'];
$num=count($results);
// echo $num;
for ( $i = 0; $i < $num; $i++ ){
echo "<center><div class='f-1 project'>";
echo "<a href='design.php?id=".$results[$i]['designID']."'><br>";
$image = checkimage(THUMBNAIL_URL.$results[$i]['designID'].'.png');
echo "<a href='design.php?id=".$results[$i]['designID']."'><br>";
echo "<img src='".$image."'style='background-color: #3e4b71'>";
echo "<div class='project-info'>";
echo "<h3>";
echo '<a href="design.php?id='.$results[$i]['designID'].'">'.$results[$i]['name'].'<span class=\'icon\'> </span></a>';
echo "</h3>";
echo "<div class='project-meta'>";
echo "<ul>";
echo "<li>";
echo "<strong>Author </strong>";
echo $results[$i]['user'];
echo "</li></center>";
//echo ($i+1) . ". ".$results[$i]['name']. " by ".$results[$i]['user']."<br>";
//$image = checkimage(THUMBNAIL_URL.$results[$i]['designID'].'.png');
//echo "<a href='design.php?id=".$results[$i]['designID']."'><br>"."<img src=".$image."style='background-color:#3e4b71'>".'<a href="design.php?id='.$results[$i]['designID'].'">'.$results[$i]['name'].'<span class=\'icon\'> ]</span></a>';
}
}
else if ( isset( $_POST["searchField"]) && ($_POST['searchType'] == "1")){
$search = $_POST["searchField"];
$temp = SERVICE_URL.'?section=design&request=findbyname&name='.$search;
$temp1 = file_get_contents($temp,0,null,null);
$temp2 = json_decode($temp1, true);
$results=$temp2['designs'];
$num=count($results);
// echo $num;
for ( $i = 0; $i < $num; $i++ ){
echo "<center><div class='f-1 project'>";
echo "<a href='design.php?id=".$results[$i]['designID']."'><br>";
$image = checkimage(THUMBNAIL_URL.$results[$i]['designID'].'.png');
echo "<a href='design.php?id=".$results[$i]['designID']."'><br>";
echo "<img src='".$image."' style='background-color: #3e4b71'>";
echo "<div class='project-info'>";
echo "<h3>";
echo '<a href="design.php?id='.$results[$i]['designID'].'">'.$results[$i]['name'].'<span class=\'icon\'> </span></a>';
echo "</h3>";
echo "<div class='project-meta'>";
echo "<ul>";
echo "<li>";
echo "<strong>Author </strong>";
echo $results[$i]['user'];
echo "</li></center>";
//echo ($i+1) . ". ".$results[$i]['name']. " by ".$results[$i]['user']."<br>";
//$image = checkimage(THUMBNAIL_URL.$results[$i]['designID'].'.png');
//echo "<a href='design.php?id=".$results[$i]['designID']."'><br>"."<img src=".$image."style='background-color:#3e4b71'>".'<a href="design.php?id='.$results[$i]['designID'].'">'.$results[$i]['name'].'<span class=\'icon\'> ]</span></a>';
}
}
else if ( isset( $_POST["searchField"]) && ($_POST['searchType'] == "2")){
$search = $_POST["searchField"];
$temp = SERVICE_URL.'?section=design&request=findbyid&id='.$search;
$temp1 = file_get_contents($temp,0,null,null);
$temp2 = json_decode($temp1, true);
$result=$temp2['design'];
// echo $num
echo "<center><div class='f-1 project'>";
echo "<a href='design.php?id=".$result['designID']."'><br>";
$image = checkimage(THUMBNAIL_URL.$result['designID'].'.png');
echo "<a href='design.php?id=".$result['designID']."'><br>";
echo "<img src='".$image."' style='background-color: #3e4b71'>";
echo "<div class='project-info'>";
echo "<h3>";
echo '<a href="design.php?id='.$result['designID'].'">'.$result['name'].'<span class=\'icon\'> </span></a>';
echo "</h3>";
echo "<div class='project-meta'>";
echo "<ul>";
echo "<li>";
echo "<strong>Author </strong>";
echo $result['user'];
echo "</li></center>";
//echo ($i+1) . ". ".$results[$i]['name']. " by ".$results[$i]['user']."<br>";
//$image = checkimage(THUMBNAIL_URL.$results[$i]['designID'].'.png');
//echo "<a href='design.php?id=".$results[$i]['designID']."'><br>"."<img src=".$image."style='background-color:#3e4b71'>".'<a href="design.php?id='.$results[$i]['designID'].'">'.$results[$i]['name'].'<span class=\'icon\'> ]</span></a>';
}
}
?>
<?php
function display(){
if ( isset($_POST['searchField']))
echo "display:block";
else echo "display:none";
}
?>
<div class='page-container'>
<div class='page-body container' id='home'>
<center><div class="search">
<h1>Search Results</h1>
<a href="index.php" >Home</a>
<div id="result" style="<?php echo display(); ?>"><center><?php searchCheck(); ?></center></div></center>
</div>
</div>
<?php
include("footer.php");
?>