-
Notifications
You must be signed in to change notification settings - Fork 0
/
displayMultipleSearchResult.php
120 lines (112 loc) · 5.02 KB
/
displayMultipleSearchResult.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
<html>
<head>
<title>BT Neo AIB - KM Portal</title>
</head>
<body bgcolor="white">
<?php include("header.php"); ?>
<?php
require_once 'DBLogic.php';
$searchStr = isset($_POST['searchStr']) ? $_POST['searchStr'] : '';
//echo "<br/>";
//echo "searchStr =" . $searchStr;
$searchData = searchKeyword($searchStr, -1);
for ($i = 0; $i < count($searchData); $i++) {
$keywordId[$i] = $searchData[$i]['keyword_id'];
$keywordName[$i] = $searchData[$i]['keyword_name'];
$type[$i] = $searchData[0]['type'];
$relatedWord[$i] = $searchData[$i]['related_word'];
$keywordInfo[$i] = $searchData[$i]['keyword_info'];
$keywordDesc[$i] = $searchData[$i]['keyword_desc'];
$keywordAppMappingData = searchKeywordAppMapping($keywordId[$i]);
}
$max_count = count($searchData);
$max_per_page = 5;
if ($max_count < $max_per_page) {
$max_per_page = $max_count;
}
$start_index = isset($_POST['startIndex']) ? $_POST['startIndex'] : 0;
$start_index = ($start_index - 1) * 5;
if ($start_index + 5 > $max_count) {
$end_index = $start_index + ($max_count % 5);
} else {
$end_index = $start_index + 5;
}
?>
<table width=100% border=0>
<tr>
<td width="100%" align="left" style="color: #A62A2A" valign=middle
height="10%"><font size=5pt font=arial><u><?php echo $searchStr ?> found at
below places: </u></font></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<form></form>
<?php
for ($i = $start_index; $i < $end_index; $i++) {
$keywordName[$i] = str_replace($searchStr, "<font style=\"color: blue;\">" . $searchStr . "</font>", $keywordName[$i]);
$relatedWord[$i] = str_replace($searchStr, "<font style=\"color: blue;\">" . $searchStr . "</font>", $relatedWord[$i]);
$keywordDesc[$i] = str_replace(strtolower($searchStr), "<font style=\"color: blue;\">" . $searchStr . "</font>", $keywordDesc[$i]);
?>
<table width=100% border=0 bordercolor=orange>
<tr width="100%">
<td width="25%" align="left" border=0 bordercolor=orange><font
style="color: #CD3700;font-family:arial;size:11pt"><b><u>Name:</u></b></font>
<font style="color: black;font-family:arial;size:11pt"><?php echo $keywordName[$i] ?></font><br />
</td>
<td width="25%" align="left" border=0 bordercolor=orange><font
style="color: #CD3700;font-family:arial;size:11pt"><b><u>Related word:</u></b></font>
<font style="color: black;font-family:arial;size:11pt"><?php echo $relatedWord[$i] ?></font><br />
</td>
<td width="25%" align="center">
<form action="displaySearchResult.php" method="post">
<input title="Complete View" style="background-color: #FFE4C4;border-color: black" type="submit" value="Complete View" />
<input type="hidden" value="<?php echo $searchStr ?>" name="searchStr"/>
<input type="hidden" value="1" name="startIndex"/>
<input type="hidden" value="<?php echo $i; ?>" name="index"/>
</form>
</td>
</tr>
</table>
<table width=100% border=0 bordercolor=orange>
<tr width=100%>
<td align="left"><font style="color: #CD3700;font-family:arial;size:11pt"> <b><u>Application
description:</u></b></font>
<p align=justify><font style="color: black;font-family:arial;size:11pt"><?php echo $keywordDesc[$i] ?></font></p>
</td>
</tr>
</table>
<hr>
<?php } ?>
<?php if (count($searchData) > 5) { ?>
<table width=100% border=0 bordercolor=orange>
<tr width="100%">
<td width="30%" valign="top" align="right">Page:
</td>
<?php
$searchCount = (count($searchData) / 5) + 1;
for ($i = 1; $i < $searchCount; $i++) {
?>
<td align="center" width="4pt">
<form name="displaySearchResult.php" method="post">
<input type="submit"
<?php
if ($_POST['startIndex'] == $i) {
echo "disabled";
}
?>
size="4" value=<?php echo $i; ?> />
<input type="hidden" value="<?php echo $searchStr; ?>" name="searchStr"/>
<input type="hidden" value="<?php echo $i; ?>" name="startIndex"/>
<input type="hidden" value="-1" name="index"/>
</form>
</td>
<?php } ?>
<td align="left" width="<?php echo 100 - $searchCount * 4 ?>"></td>
</tr>
</table>
<?php } ?>
<?php include("footer.php"); ?>
</body>
</html>