[studentbooks15] r84 committed - [No log message]

0 views
Skip to first unread message

student...@googlecode.com

unread,
Dec 4, 2010, 9:58:30 PM12/4/10
to student...@googlegroups.com
Revision: 84
Author: reamus
Date: Sat Dec 4 18:57:49 2010
Log: [No log message]
http://code.google.com/p/studentbooks15/source/detail?r=84

Added:
/svn/trunk/reamus/search_revised.php

=======================================
--- /dev/null
+++ /svn/trunk/reamus/search_revised.php Sat Dec 4 18:57:49 2010
@@ -0,0 +1,146 @@
+<?php
+require_once("Include/backend/SearchEngine.php");
+require_once("Include/header_bar.php");
+
+$db = SearchEngine::GetInstance();
+$termsIsEmpty = true;
+$debug = false;
+
+$query = explode('?', $_SERVER['QUERY_STRING']);
+$params = array();
+
+foreach( $query as $param )
+{
+ list($name, $value) = explode('=', $param);
+ $params[urldecode($name)][] = urldecode($value);
+}
+
+$query = $params["query"][0];
+$cat = $params["cat"][0];
+$school = $params["school"][0];
+
+$searchresults = array();
+
+if ($school != "") {
+ $searchresults = $db->fieldsearch("School", $school, $query);
+ if ( $cat != "") {
+ $searchresults = array_intersect($searchresults,
+ $db->fieldsearch("Department",
+ $cat, $query));
+ }
+} else {
+ if ($cat != "") {
+ $searchresults = $db->fieldsearch("Department", $cat, $query);
+ } else {
+ if ($query != "") {
+ $searchresults = $db->omnisearch($query);
+ }
+ }
+}
+
+
+?>
+<?php include("Include/mimetype.php");
+ ?>
+<head>
+ <title>BookGet.com</title>
+ <?php include "Include/basic_style.php" ?>
+ <style>
+ .book
+ {
+ width: 130px;
+ }
+ .Results {
+ text-align: center;
+ }
+ </style>
+</head>
+<body>
+ <?php if ($debug) print_r($searchresults); ?>
+ <div id="headerbar">
+ </div>
+ <?php print $header; ?>
+ <div id="pagewrapper">
+ <div id="leftcol">
+ <?php include("Include/category_bar.php"); ?>
+ </div>
+ <div id="pagecontent">
+ <div id="rightcol" >
+ <?php include("Include/minicart.php"); ?>
+ </div>
+ <div id="content">
+ <?php if (count($searchresults) >= 1) { ?>
+
+ <table id="results">
+ <tr>
+ <th scope="col" class="label">Cover</th>
+ <th scope="col" class="label">ISBN</th>
+ <th scope="col" class="label">Title</th>
+ <th scope="col" class="label">Authors</th>
+ <th scope="col" class="label">Quality</th>
+ <th scope="col" class="label">Price</th>
+ <th scope="col" class="label">Quantity</th>
+
+ </tr>
+ <?php
+ $quality_codes = array(0 => "New",
+ 1 => "Great",
+ 2 => "Good",
+ 3 => "Used"
+ );
+
+ for ($i = 0; $i < count($searchresults); $i++) {
+
+ <fieldset>
+ $Title = $searchresults[$i]["Title"];
+ $ISBN = $searchresults[$i]["ISBN"];
+ $Author = $searchresults[$i]["Author"];
+ $Author1 = $searchresults[$i]["Author1"];
+ $Price = $searchresults[$i]["Price"];
+ $Quality =
$quality_codes[$searchresults[$i]["Quality"]];
+ $Qty = $searchresults[$i]["Qty"];
+ $id = $searchresults[$i]["BookID"];
+ $Description = $searchresults[$i]["Description"];
+
+
+
+
+
+ print "< form method="post" action=""
class="jcart">\n";
+ print "< input type="hidden" name= "BOOK_ID"
value= "$id" />\n";
+ print"<input type="hidden" name="Title"
value="$Title" />";
+ print"<input type="hidden" name="Price"
value="$Price" />";
+ print"<input type="hidden" name="jcart_token"
value="<?php echo $_SESSION['jcart_token'];?>" />";
+ print "<tr>\n";
+ print " <td class=\"Results\">\n";
+ print " <img src='img/".$id.".gif'
class='book'/>\n";
+ print " </td>\n";
+
+ print "<td class=\"Results\"><a
href='book.php?id=".$id."' >" . $Title ."</a></td>\n";
+ print "<td class=\"Results\">" .
$Author . "<br/>$Author1</td>\n";
+
+ print "<td class=\"Results\">" .
$Quality . "</td>\n";
+ print "<td class=\"Results\">" .
$Price . "</td>\n";
+ print "<td class=\"Results\">" .
$Qty . "</td></tr>\n";
+ <label>Qty: <input type="text" name="my-item-qty"
value="1" size="3" /></label>
+ <input type="submit" name="my-add-button"
value="add to cart" class="button" />
+ </fieldset>
+ </form>
+
+
+
+
+ }
+ ?>
+ </table>
+ <?php } else { ?>
+ <h1 class="label">Found no results</h1>
+ <?php } ?>
+ </div>
+ <?php include("Include/footer_bar.php"); ?>
+ </div>
+ </div>
+
+
+</body>
+</html>

Reply all
Reply to author
Forward
0 new messages