navigation  interaction  search

 other resources

root/trunk/phpbms/advancedsearch.php

Revision 285 (checked in by brieb, 1 year ago)

Merging object oriented branch back into trunk.

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