navigation  interaction  search

 other resources

root/tags/phpbms-0.61/advancedsearch.php

Revision 51 (checked in by brieb, 3 years ago)

- Added license to the top of every page with code.

Line 
1 <?php
2 /*
3  +-------------------------------------------------------------------------+
4  | Copyright (c) 2005, Kreotek LLC                                         |
5  | All rights reserved.                                                    |
6  +-------------------------------------------------------------------------+
7  |                                                                         |
8  | Redistribution and use in source and binary forms, with or without      |
9  | modification, are permitted provided that the following conditions are  |
10  | met:                                                                    |
11  |                                                                         |
12  | - Redistributions of source code must retain the above copyright        |
13  |   notice, this list of conditions and the following disclaimer.         |
14  |                                                                         |
15  | - Redistributions in binary form must reproduce the above copyright     |
16  |   notice, this list of conditions and the following disclaimer in the   |
17  |   documentation and/or other materials provided with the distribution.  |
18  |                                                                         |
19  | - Neither the name of Kreotek LLC nor the names of its contributore may |
20  |   be used to endorse or promote products derived from this software     |
21  |   without specific prior written permission.                            |
22  |                                                                         |
23  | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |
24  | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |
25  | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
26  | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |
27  | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |
28  | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |
29  | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |
30  | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |
31  | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |
32  | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
33  | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
34  |                                                                         |
35  +-------------------------------------------------------------------------+
36 */
37     require("include/session.php");
38
39     function showSearch($tabledefid,$basepath){
40         global $dblink;
41         
42         //First, grab table name from id   
43         $querystatement="SELECT querytable FROM tabledefs WHERE id=".$tabledefid;
44         $queryresult = mysql_query($querystatement,$dblink);
45         if(!$queryresult) reportError(500,"Cannot retrieve Table Information");
46         $thetabledef=mysql_fetch_array($queryresult);
47
48         //Grab query for all columns
49         $querystatement="SELECT * FROM ".$thetabledef["querytable"]." LIMIT 1";
50         $queryresult = mysql_query($querystatement,$dblink);
51         if(!$queryresult) reportError(500,"Cannot retrieve Table Information");
52         $numfields = mysql_num_fields($queryresult);
53         for ($i=0;$i<$numfields;$i++) $fieldlist[]=mysql_field_table($queryresult,$i).".".mysql_field_name($queryresult,$i);
54         ?><table border="0" cellspacing="0" cellpadding="0">
55             <tr>
56                 <td valign=top width="99%">
57                     <div>match <select id="ASanyall" onChange="updateAS()">
58                         <option value="and" selected="selected">all</option>
59                         <option value="or">any</option>
60                     </select> of the following rules:</div>
61                     <div id="theASCs" style="margin:0px;padding:0px;">
62                         <div id="ASC1">
63                             <select id="ASC1field" onChange="updateAS()">
64                                 <?php
65                                     foreach($fieldlist as $field){
66                                         echo "<option value=\"".$field."\" >".$field."</option>\n";}?>
67                             </select>
68                             <select id="ASC1operator" onChange="updateAS()">
69                                  <option value="=" selected="selected">=</option>
70                                  <option value="!=">!=</option>
71                                  <option value=">">&gt;</option>
72                                  <option value="<">&lt;</option>
73                                  <option value=">=">&gt;=</option>
74                                  <option value="<=">&lt;=</option>
75                                  <option value="like">like</option>
76                                  <option value="not like">not like</option>
77                             </select>
78                             <input type="text" id="ASC1text" size="30" maxlength="255" onKeyUp="updateAS()" value="" />
79                             <button type="button" id="ASC1minus" class="invisibleButtons" onClick="removeLineAS(this)"><img src="<?php echo $_SESSION["app_path"] ?>common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/button-minus-disabled.png" align="middle" alt="-" width="16" height="16" border="0" /></button>
80                             <button type="button" id="ASC1plus" class="invisibleButtons" onClick="addlineAS()"><img src="<?php echo $_SESSION["app_path"] ?>common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/button-plus.png" align="middle" alt="+" width="16" height="16" border="0" /></button>
81                         </div>
82                     </div>
83                     <div>
84                         sql where clause<br/>
85                         <textarea id="ASSQL" style="width:99%" cols="90" rows="3" onKeyUp="ASEnableSave(this)"></textarea>       
86                     </div>
87                 </td>
88                 <td valign="top">
89                     <div align="right" style="margin-top:10px;"><br />
90                         <input id="ASsearchbutton" type="button" onClick="performAdvancedSearch(this)" class="Buttons" disabled="true" value="search" style="width:90px;" accesskey="" />       
91                     </div>
92                 </td>
93             </tr>
94         </table><?php       
95     }
96
97
98     if(isset($_GET["cmd"])){
99         switch($_GET["cmd"]){
100             case "show":
101                 showSearch($_GET["tid"],$_GET["base"]);
102             break;
103         }//end switch
104     }
105 ?>
106
Note: See TracBrowser for help on using the browser.
Copyright © 2006-2007 Kreotek, LLC. All Rights reserved.