/
technologies.php
224 lines (157 loc) · 8.73 KB
/
technologies.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php include("inc/technologies-data.php"); ?><?php
$pageTitle = "Technologies | BYU Tech Transfer";
$section = "patents";
include('inc/header.php');
$search=False;
$allresults = get_products_all();
$search_term = "";
if ($_GET["c"] != '') {
$placeholder = $_GET["c"];
$category = trim($_GET["c"]);
if ($category != ""){
$search=True;
$cresults = get_category_search($category);
$products = $cresults;
if (isset($_GET["s"])) {
$search_term = trim($_GET["s"]);
if ($search_term != "") {
$products = get_category_results($search_term,$cresults);
}
}
}
}
elseif (isset($_GET["s"])) {
$search_term = trim($_GET["s"]);
if ($search_term != "") {
$search=True;
$products = get_products_search($search_term);
}
} ?>
<div class="section shirts page">
<div class="wrapper">
<div class="breadcrumb"><a href="index.php">Home</a> > <a href="technologies.php">Technologies</a> </div>
<h1 style="margin-bottom: 0em;">BYU’s Full List of Technologies</h1>
<p style="text-align: center; margin-top: 0px;"><a class="featured-tech-pdf" href="http://techtransfer.byu.edu/Promising-Technologies.pdf" target="_blank" style="padding-top: 0px; font-size: 1em; text-align: center;">Download the list of promising technologies (pdf)</a></p>
<p>Here is BYU's list of available technologies. Filter throught the technologies by category or by searching keywords. Click on any patent for more info.</p>
<div class="search-container">
<div class="group"><a id="clear-search" href="technologies.php">Clear Search</a></div>
<form method="get">
<?php // pre-populate the current search term in the search box; ?>
<?php // if a search hasn't been performed, then that search term ?>
<?php // will be blank and the box will look empty ?>
<div class="group"><input class="search-box" placeholder="Search technologies..." type="text" name="s" value="<?php echo htmlspecialchars($search_term); ?>">
<div class="select-style">
<select name="c" value ="<?php $placeholder?>">
<option value="">All categories</option>
<option value <?php if ($category == 'engineering') { ?>selected<?php }; ?>="engineering">Engineering</option>
<option value <?php if ($category == 'software') { ?>selected<?php }; ?>="software">Software</option>
<option value <?php if ($category == 'biology') { ?>selected<?php }; ?>="biology">Biology</option>
<option value <?php if ($category == 'medical') { ?>selected<?php }; ?>="medical">Medical</option>
</select>
</div>
<input id="search-go" type="submit" value="Update Search"></div>
</form>
<?php // if a search has been performed ... ?>
<?php if ($search_term != "") : ?>
<?php endif; ?>
<?php // if there are products found that match the search term, display them; ?>
<?php // otherwise, display a message that none were found ?>
<?php if (!empty($products)) : ?>
<ul class="products">
<?php
// Find out how many items are in the table
$total = count($products);
If($total > 5){
// How many items to list per page
$limit = 5;
// How many pages will there be
$pages = ceil($total / $limit);
// What page are we currently on?
$page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
'options' => array(
'default' => 1,
'min_range' => 1,
),
)));
// Calculate the offset for the query
$offset = ($page - 1) * $limit;
// Some information to display to the user
$start = $offset + 1;
$end = min(($offset + $limit), $total);
// Prepare the paged query
// The "back" link
$prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($page - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>';
// The "forward" link
$nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $pages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>';
// Display the paging information
echo '<div id="paging"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>';
// Display the results
$keys = array_keys($products);
for($i = $start; $i <= $end; $i++) {
$key = $keys[$i-1];
echo get_list_view_html($key,$products[$key]);
}
// The "back" link
$prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($page - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>';
// The "forward" link
$nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $pages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>';
// Display the paging information
echo '<div id="paging"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>';
}
else{
foreach ($products as $product_id => $product) {
$id_number = $product['id#'];
$array_space = searchForID($id_number, get_products_all());
echo get_list_view_html($array_space,$product);
}}
?>
</ul>
<?php elseif($search==True): ?>
<p class="warning"><i class="fa fa-exclamation-circle"></i> No technologies were found matching that search term.</p>
<?php else:?>
<?php
// Find out how many items are in the table
$total = count(get_products_all());
// How many items to list per page
$limit = 5;
// How many pages will there be
$pages = ceil($total / $limit);
// What page are we currently on?
$page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
'options' => array(
'default' => 1,
'min_range' => 1,
),
)));
// Calculate the offset for the query
$offset = ($page - 1) * $limit;
// Some information to display to the user
$start = $offset + 1;
$end = min(($offset + $limit), $total);
// Prepare the paged query
// The "back" link
$prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($page - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>';
// The "forward" link
$nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $pages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>';
// Display the paging information
echo '<div id="paging"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>';
// Display the results
$alldata = get_products_all();
for($i = $start; $i <= $end; $i++) {
$key = 100+$i;
echo get_list_view_html($key,$alldata[$key]);
}
// The "back" link
$prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($page - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>';
// The "forward" link
$nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $pages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>';
// Display the paging information
echo '<div id="paging"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>';
?>
<?php endif; ?>
</div>
<ul class="products">
</ul>
</div>
</div>
<?php include('inc/footer.php') ?>