| 1 |
<?php |
|---|
| 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 |
require_once("include/session.php"); |
|---|
| 38 |
require_once("include/search_class.php"); |
|---|
| 39 |
require_once("include/common_functions.php"); |
|---|
| 40 |
|
|---|
| 41 |
if(!isset($_GET["id"])) reportError(100,"Passed Parameter not present."); |
|---|
| 42 |
$_GET["id"]= (integer) $_GET["id"]; |
|---|
| 43 |
|
|---|
| 44 |
$displayTable= new displaySearchTable; |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
$displayTable->initialize($_GET["id"]); |
|---|
| 48 |
|
|---|
| 49 |
session_register("passedjoinclause"); |
|---|
| 50 |
session_register("passedjoinwhere"); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
if(!isset($_POST["othercommands"])) $_POST["othercommands"]=""; |
|---|
| 55 |
if(!isset($_POST["relationship"])) $_POST["relationship"]=""; |
|---|
| 56 |
if(!isset($_POST["advancedsearch"])) $_POST["advancedsearch"]=""; |
|---|
| 57 |
if(!isset($_POST["advancedsort"])) $_POST["advancedsort"]=""; |
|---|
| 58 |
|
|---|
| 59 |
if(isset($_POST["doprint"])) $_POST["command"]="print"; |
|---|
| 60 |
if(isset($_POST["deleteCommand"])) |
|---|
| 61 |
if($_POST["deleteCommand"]) $_POST["command"]=$_POST["deleteCommand"]; |
|---|
| 62 |
if($_POST["othercommands"]) $_POST["command"]="other"; |
|---|
| 63 |
if($_POST["relationship"]) $_POST["command"]="relate records"; |
|---|
| 64 |
if($_POST["advancedsearch"]) $_POST["command"]="advanced search"; |
|---|
| 65 |
if($_POST["advancedsort"]) $_POST["command"]="advanced sort"; |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
if(isset($_POST["command"])){ |
|---|
| 69 |
|
|---|
| 70 |
switch($_POST["command"]){ |
|---|
| 71 |
|
|---|
| 72 |
case "print": |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
$displayTable->querytype="print"; |
|---|
| 76 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 77 |
$_SESSION["printing"]["tableid"]=$displayTable->thetabledef["id"]; |
|---|
| 78 |
$_SESSION["printing"]["maintable"]=$displayTable->thetabledef["maintable"]; |
|---|
| 79 |
$_SESSION["printing"]["theids"]=$theids; |
|---|
| 80 |
header("Location: print.php"); |
|---|
| 81 |
break; |
|---|
| 82 |
case "other": |
|---|
| 83 |
$displayTable->recordoffset=0; |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 87 |
eval("\$tempmessage=".$_POST["othercommands"]."(\$theids);"); |
|---|
| 88 |
if($tempmessage) $statusmessage=$tempmessage; |
|---|
| 89 |
break; |
|---|
| 90 |
case "search": |
|---|
| 91 |
$displayTable->recordoffset=0; |
|---|
| 92 |
$displayTable->buildSearch($_POST); |
|---|
| 93 |
break; |
|---|
| 94 |
case "reset": |
|---|
| 95 |
$displayTable->recordoffset=0; |
|---|
| 96 |
$displayTable->resetQuery(); |
|---|
| 97 |
break; |
|---|
| 98 |
case "omit": |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
$displayTable->recordoffset=0; |
|---|
| 102 |
$tempwhere=""; |
|---|
| 103 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 104 |
foreach($theids as $theid){ |
|---|
| 105 |
$tempwhere.=" or ".$displayTable->thetabledef["maintable"].".id=".$theid; |
|---|
| 106 |
} |
|---|
| 107 |
$tempwhere=substr($tempwhere,3); |
|---|
| 108 |
$displayTable->querywhereclause="(".$displayTable->querywhereclause.") and not (".$tempwhere.")"; |
|---|
| 109 |
break; |
|---|
| 110 |
case "keep": |
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
$displayTable->recordoffset=0; |
|---|
| 114 |
$tempwhere=""; |
|---|
| 115 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 116 |
foreach($theids as $theid){ |
|---|
| 117 |
$tempwhere.=" or ".$displayTable->thetabledef["maintable"].".id=".$theid; |
|---|
| 118 |
} |
|---|
| 119 |
$tempwhere=substr($tempwhere,3); |
|---|
| 120 |
$displayTable->querywhereclause=$tempwhere; |
|---|
| 121 |
break; |
|---|
| 122 |
case "delete": |
|---|
| 123 |
|
|---|
| 124 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 125 |
$tempmessage=delete_record($theids); |
|---|
| 126 |
if($tempmessage) $statusmessage=$tempmessage; |
|---|
| 127 |
break; |
|---|
| 128 |
case "advanced search": |
|---|
| 129 |
$displayTable->recordoffset=0; |
|---|
| 130 |
$displayTable->querywhereclause=stripslashes($_POST["advancedsearch"]); |
|---|
| 131 |
$displayTable->querytype="advanced search"; |
|---|
| 132 |
break; |
|---|
| 133 |
case "advanced sort": |
|---|
| 134 |
$displayTable->recordoffset=0; |
|---|
| 135 |
$displayTable->querysortorder=$_POST["advancedsort"]; |
|---|
| 136 |
break; |
|---|
| 137 |
case "relate records": |
|---|
| 138 |
include("include/relationships.php"); |
|---|
| 139 |
$theids=explode(",",$_POST["theids"]); |
|---|
| 140 |
$goto=perform_relationship($_POST["relationship"],$theids); |
|---|
| 141 |
$_SESSION["temp_relateto"]=$displayTable->thetabledef["maintable"]; |
|---|
| 142 |
$displayTable->querytype="relate"; |
|---|
| 143 |
|
|---|
| 144 |
header("Location: ".$goto); |
|---|
| 145 |
break; |
|---|
| 146 |
|
|---|
| 147 |
} |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
if(!isset($_POST["newsort"])) $_POST["newsort"]=""; |
|---|
| 152 |
if(!isset($_POST["desc"])) $_POST["desc"]=""; |
|---|
| 153 |
|
|---|
| 154 |
if($_POST["newsort"]!="") { |
|---|
| 155 |
|
|---|
| 156 |
$displayTable->recordoffset=0; |
|---|
| 157 |
foreach ($displayTable->thecolumns as $therow){ |
|---|
| 158 |
if ($_POST["newsort"]==$therow["name"]) $therow["sortorder"]? $displayTable->querysortorder=$therow["sortorder"] : $displayTable->querysortorder=$therow["column"]; |
|---|
| 159 |
} |
|---|
| 160 |
$_POST["startnum"]=1; |
|---|
| 161 |
} elseif($_POST["desc"]!="") { |
|---|
| 162 |
$displayTable->querysortorder.=" DESC"; |
|---|
| 163 |
$displayTable->recordoffset=0; |
|---|
| 164 |
} |
|---|
| 165 |
|
|---|
| 166 |
if($displayTable->querytype!="print" and $displayTable->querytype!="relate" and $displayTable->querytype!="new" and $displayTable->querytype!="edit") { |
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
if(isset($_SESSION["passedjoinclause"])) { |
|---|
| 171 |
$displayTable->recordoffset=0; |
|---|
| 172 |
$displayTable->queryjoinclause=$_SESSION["passedjoinclause"]; |
|---|
| 173 |
session_unregister("passedjoinclause"); |
|---|
| 174 |
} |
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
if(isset($_SESSION["passedjoinwhere"])) { |
|---|
| 179 |
$displayTable->recordoffset=0; |
|---|
| 180 |
|
|---|
| 181 |
$displayTable->querywhereclause=$_SESSION["passedjoinwhere"]; |
|---|
| 182 |
session_unregister("passedjoinwhere"); |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
$displayTable->querytype="related records from ".$_SESSION["temp_relateto"]; |
|---|
| 186 |
session_unregister("temp_relateto"); |
|---|
| 187 |
} |
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
if(isset($_POST["offset"])) if($_POST["offset"]!="") $displayTable->recordoffset=$_POST["offset"]; |
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
$displayTable->issueQuery(); |
|---|
| 194 |
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|---|
| 195 |
<html> |
|---|
| 196 |
<head> |
|---|
| 197 |
<title><?php echo $displayTable->thetabledef["displayname"] ?></title> |
|---|
| 198 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
|---|
| 199 |
<link href="<?php echo $_SESSION["app_path"] ?>common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/base.css" rel="stylesheet" type="text/css"> |
|---|
| 200 |
<!-- These Javscript files and scripts are required for the query_searchdisplay and query_function files to |
|---|
| 201 |
work properly --> |
|---|
| 202 |
<script language="JavaScript" src="common/javascript/common.js" type="text/javascript" ></script> |
|---|
| 203 |
<script language="JavaScript" src="common/javascript/queryfunctions.js" type="text/javascript" ></script> |
|---|
| 204 |
</head> |
|---|
| 205 |
<body><?php include("menu.php");?><?php if(isset($has_header)) display_header();?><div class="bodyline"> |
|---|
| 206 |
<h1 id="srchScreen<?php echo $displayTable->thetabledef["id"] ?>"><?php echo $displayTable->thetabledef["displayname"] ?></h1> |
|---|
| 207 |
<div> |
|---|
| 208 |
<?PHP |
|---|
| 209 |
|
|---|
| 210 |
$displayTable->displaySearch(); |
|---|
| 211 |
$displayTable->displayQueryButtons(); |
|---|
| 212 |
$displayTable->displayQueryHeader(); |
|---|
| 213 |
if($displayTable->numrows>0){ |
|---|
| 214 |
$displayTable->displayQueryResults(); |
|---|
| 215 |
$displayTable->displayQueryFooter(); |
|---|
| 216 |
} |
|---|
| 217 |
else |
|---|
| 218 |
$displayTable->displayNoResults(); |
|---|
| 219 |
|
|---|
| 220 |
$displayTable->displayRelationships(); |
|---|
| 221 |
$displayTable->saveQueryParameters(); |
|---|
| 222 |
?></div> |
|---|
| 223 |
</div> |
|---|
| 224 |
<?php include("footer.php")?> |
|---|
| 225 |
</body> |
|---|
| 226 |
</html><?php }?> |
|---|