525 lines
23 KiB
PHP
525 lines
23 KiB
PHP
<?php
|
||
|
||
|
||
if (!isset($page))
|
||
$page=str_replace('.php', '', basename(__FILE__));
|
||
|
||
include_once('tables.php');
|
||
include_once('qs_functions.php');
|
||
include_once('default.php');
|
||
if (!isset($titre))
|
||
$titre='Recherche "'.$table.'"';
|
||
|
||
mysql_query('SET CHARACTER SET utf8;');
|
||
|
||
$result = mysql_query("$sql $sql_ext limit 0,1")
|
||
or die('Invalid query');
|
||
|
||
if (isset($_POST['act'])) {
|
||
$_SESSION[$sessionPage."_page"] = '';
|
||
$filter_string = "";
|
||
$qry_string = "";
|
||
$i = 0;
|
||
while ($i < mysql_num_fields($result)) {
|
||
$meta = mysql_fetch_field($result);
|
||
$field_name = $meta->name;
|
||
$field_type = $meta->type;
|
||
//get field type
|
||
$type_field = "";
|
||
$type_field = returntype($field_type);
|
||
//clear session
|
||
$_SESSION[$sessionPage.'_search_fd'] = '';
|
||
$_SESSION[$sessionPage.'_multisearch_fd'] = '';
|
||
$_SESSION[$sessionPage.'_search_fd_'.$i] = '';
|
||
if ((qsrequest("search_fd" . $i) != "") && (qsrequest("search_fd" . $i) != "*")) {
|
||
$idata = qsrequest("search_fd" . $i);
|
||
if (strlen($idata) > 1) {
|
||
if ($idata[strlen($idata) - 1] == "*") {
|
||
$idata = substr($idata, 0, strlen($idata) - 1);
|
||
}
|
||
}
|
||
$idata = str_replace("*", "%", $idata);
|
||
$irealdata = $idata;
|
||
if (qsrequest("search_optfd".$i) != "") {
|
||
$idata = qsrequest("search_optfd". $i) . $idata ;
|
||
}
|
||
$iopt = substr($idata, 0, 2);
|
||
if (($iopt == "<=") || ($iopt == "=<")) {
|
||
$iopt = "<=";
|
||
$irealdata = substr($idata, 2);
|
||
} elseif (($iopt == ">=") || ($iopt == "=>")) {
|
||
$iopt = ">=";
|
||
$irealdata = substr($idata, 2);
|
||
} elseif ($iopt == "==") {
|
||
$iopt = "=";
|
||
$irealdata = substr($idata, 2);
|
||
} elseif ($iopt == "<>") {
|
||
$irealdata = substr($idata, 2);
|
||
} elseif ($iopt == "^^") {
|
||
$iopt = "*";
|
||
$idata = $iopt . $irealdata . $iopt; // Contain
|
||
} elseif ($iopt == "^*") {
|
||
$iopt = "*";
|
||
$idata = $irealdata . $iopt; // Start With
|
||
} elseif ($iopt == "*^") {
|
||
$iopt = "*";
|
||
$idata = $iopt . $irealdata ; // End With
|
||
} else {
|
||
$iopt = substr($idata, 0, 1);
|
||
if (($iopt == "<") || ($iopt == ">") || ($iopt == "=")) {
|
||
$irealdata = substr($idata,1);
|
||
} else {
|
||
$iopt = "=";
|
||
}
|
||
}
|
||
if (qsrequest("andor_optfd".$i) != "") {
|
||
$idata = qsrequest("andor_optfd". $i) . $idata ;
|
||
}
|
||
if (!strcasecmp($idata,"{current date and time}")) {
|
||
$idata = time();
|
||
} elseif (!strcasecmp($idata,"{current date}")) {
|
||
$idata = time();
|
||
} elseif (!strcasecmp($idata,"{current time}")) {
|
||
$idata = time();
|
||
}
|
||
if ($meta) {
|
||
if ($type_field == "type_datetime") {
|
||
if ((($timestamp = strtotime($irealdata)) !== -1)) {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd" . $i . "=" ./*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string = $field_name . " like '%" . $idata . "%'";
|
||
} else {
|
||
$qry_string .= "&search_fd" . $i . "=" ./*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string .= " and " . $field_name . " like '%" . $idata . "%'";
|
||
}
|
||
} else {
|
||
$err_string .= "<strong>Error:</strong>while searching.<strong>" . $field_name . "</strong>.<br>";
|
||
$err_string .= "Description: Invalid DateTime.<br>";
|
||
}
|
||
} elseif ($type_field == "type_integer") {
|
||
if (is_numeric($irealdata)) {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd" . $i . "=" . $idata;
|
||
$filter_string = $field_name . " " . $iopt . " " . $irealdata;
|
||
} else {
|
||
$qry_string .= "&search_fd" . $i . "=" . $idata;
|
||
$filter_string .= " and " . $field_name . " " . $iopt . " " . $irealdata;
|
||
}
|
||
} else {
|
||
$err_string .= "<strong>Error:</strong>while searching.<strong>" . $field_name . "</strong>.<br>";
|
||
$err_string .= "Description: Type mismatch.<br>";
|
||
}
|
||
} elseif ($type_field == "type_string") {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd" . $i . "=" ./*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string = $field_name . " like '" . $irealdata . "%'";
|
||
} else {
|
||
$qry_string .= "&search_fd" . $i . "=" . /*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string .= " and " . $field_name . " like '" . $irealdata . "%'";
|
||
}
|
||
} else {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd" . $i . "=" . /*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string = $field_name . " = '" . $irealdata . "'";
|
||
} else {
|
||
$qry_string .= "&search_fd" . $i . "=" . /*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string .= " and " . $field_name . " = '" . $irealdata . "'";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (qsrequest("multisearch_fd" . $i) != "") {
|
||
if ($qry_string == "") {
|
||
$qry_string = "multisearch_fd" . $i . "=" . qsrequest("multisearch_fd" . $i);
|
||
} else {
|
||
$qry_string = $qry_string . "&multisearch_fd" . $i . "=" . qsrequest("multisearch_fd" . $i);
|
||
}
|
||
}
|
||
//begin search between see variable 'search_fd_(n)'
|
||
if (qsrequest("search_fd_" . $i) != "") {
|
||
$idata = qsrequest("search_fd_" . $i);
|
||
if (strlen($idata) > 1) {
|
||
if ($idata[strlen($idata) - 1] == "*") {
|
||
$idata = substr($idata, 0, strlen($idata) - 1);
|
||
}
|
||
}
|
||
$idata = str_replace("*", "%", $idata);
|
||
$irealdata = $idata;
|
||
if (qsrequest("search_optfd_".$i) != "") {
|
||
$idata = qsrequest("search_optfd_". $i) . $idata ;
|
||
}
|
||
if ($meta) {
|
||
if ($type_field == "type_datetime") {
|
||
if ((($timestamp = strtotime($irealdata)) !== -1)) {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd_" . $i . "=" ./*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string = $field_name . " like '%" . $idata . "%'";
|
||
} else {
|
||
$qry_string .= "&search_fd_" . $i . "=" ./*urlencode(*/stripslashes($idata)/*)*/;
|
||
$filter_string .= " and " . $field_name . " like '%" . $idata . "%'";
|
||
}
|
||
} else {
|
||
$err_string .= "<strong>Error:</strong>while searching.<strong>" . $field_name . "</strong>.<br>";
|
||
$err_string .= "Description: Invalid DateTime.<br>";
|
||
}
|
||
} elseif ($type_field == "type_integer") {
|
||
if (is_numeric($irealdata)) {
|
||
if ($qry_string == "") {
|
||
$qry_string = "search_fd_" . $i . "=" . $idata;
|
||
$filter_string = $field_name . " " . $iopt . " " . $irealdata;
|
||
} else {
|
||
$qry_string .= "&search_fd_" . $i . "=" . $idata;
|
||
$filter_string .= " and " . $field_name . " " . $iopt . " " . $irealdata;
|
||
}
|
||
} else {
|
||
$err_string .= "<strong>Error:</strong>while searching.<strong>" . $field_name . "</strong>.<br>";
|
||
$err_string .= "Description: Type mismatch.<br>";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
$i++;
|
||
}
|
||
if ($result > 0) {mysql_free_result($result);}
|
||
if (qsrequest("search_sort") <> "") {
|
||
$sortstring = qsrequest("search_sort");
|
||
}
|
||
if (qsrequest("page_size") <> "") {
|
||
$page_size = qsrequest("page_size");
|
||
}
|
||
#----get submit url page----
|
||
$submiturl = "./list.php?";
|
||
if ($err_string == "") {
|
||
if ($qry_string != "") {
|
||
$URL= $submiturl . "&" . $qry_string;
|
||
} else {
|
||
$URL= $submiturl;
|
||
}
|
||
header ("Location: $URL");
|
||
exit;
|
||
}
|
||
} else {
|
||
$sortstring = "";
|
||
if (qssession("sortfield") != "") {
|
||
$sortstring = "&sortfield=" . urlencode(stripslashes(qssession("sortfield"))) . "&sortby=" . urlencode(stripslashes(qssession("sortby")));
|
||
}
|
||
if (qssession("page_size") != "") {
|
||
$page_size = urlencode(stripslashes(qssession("page_size")));
|
||
}
|
||
$i=0;
|
||
while ($i < mysql_num_fields($result)) {
|
||
$strkeyword = "";
|
||
$iopt = "";
|
||
$idata = "";
|
||
if ((!isset($_GET["search_fd".$i])) && (!isset($_POST["search_fd".$i]))) {
|
||
$arryitemvalue[$i] = "";
|
||
$arryopt[$i]="";
|
||
} else {
|
||
# Check value for advance search
|
||
$idata = qsrequest("search_fd" . $i);
|
||
$icon = "";
|
||
if (substr($idata, 0, 2) == "||") {
|
||
$icon = "||";
|
||
$idata = substr($idata, 2);
|
||
}
|
||
$iopt = substr($idata, 0, 2); // Get 2 of left keyword
|
||
if (($iopt == "<=") || ($iopt == "=<")){
|
||
$iopt = "<=";
|
||
$strkeyword = substr($idata, 2);
|
||
}elseif (($iopt == ">=") || ($iopt == "=>")){
|
||
$iopt = ">=";
|
||
$strkeyword = substr($idata, 2);
|
||
}elseif ($iopt == "==" ){
|
||
$iopt = "==";
|
||
$strkeyword = substr($idata, 2);
|
||
}elseif ($iopt == "<>"){
|
||
$strkeyword = substr($idata, 2);
|
||
} else {
|
||
$startstrdata = substr($idata,0,1) ;
|
||
$endstrdata = $idata[strlen($idata) - 1];
|
||
if (($startstrdata != "%" ) && ($endstrdata != "%")){
|
||
if (($startstrdata == "<") || ($startstrdata == ">") || ($startstrdata == "=")) {
|
||
if ($startstrdata == "<") {
|
||
$strkeyword = str_replace("<","", $idata) ;
|
||
$iopt = "<";
|
||
}elseif($startstrdata == ">") {
|
||
$strkeyword = str_replace(">","", $idata) ;
|
||
$iopt = ">";
|
||
} else {
|
||
$strkeyword = str_replace("=","", $idata) ;
|
||
$iopt = "=";
|
||
}
|
||
}else {
|
||
$arryitemvalue[$i] = $idata;
|
||
$strkeyword = $idata;
|
||
}
|
||
}else {
|
||
if (($startstrdata == "%" ) && ($endstrdata == "%")) { # Contain Case
|
||
$startstrdata = str_replace("%","", $idata) ;
|
||
$strkeyword = substr($idata,1, (strlen($idata)-2));
|
||
$iopt = "^^" ;
|
||
}elseif (($startstrdata != "%" ) && ($endstrdata == "%")) { # Start With Case xx*
|
||
$strkeyword = substr($idata,0, (strlen($idata)-1));
|
||
$iopt = "^*";
|
||
}elseif (($startstrdata == "%" ) && ($endstrdata != "%")) { # End With Case *xx
|
||
$strkeyword = substr($idata,1, (strlen($idata)));
|
||
$iopt = "*^";
|
||
}
|
||
}// end eheck one charator
|
||
}//end of check 2 first character
|
||
$arryitemvalue[$i] = $strkeyword;
|
||
$arryopt[$i] = $iopt;
|
||
$arryandoropt[$i] = $icon;
|
||
}
|
||
$i += 1;
|
||
}// end while
|
||
if ($result > 0) {mysql_free_result($result);}
|
||
}
|
||
?>
|
||
<html>
|
||
<head>
|
||
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
|
||
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
|
||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />-->
|
||
<title><?=htmlentities($titre)?></title>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<link rel="stylesheet" type="text/css" href="../nonimg/gestion.css">
|
||
<script language="javascript">
|
||
function Trim(s){
|
||
var temp = " ";
|
||
var i = 0;
|
||
while ((temp == " ") && (i <= s.length)) {
|
||
temp = s.charAt(i);
|
||
i++;
|
||
}
|
||
s = s.substring(i - 1, s.length);
|
||
return(s);
|
||
}
|
||
function check(frm) {
|
||
var szAlert = "Invalid\n";
|
||
var nIndex = 0;
|
||
/* if (!NumberValidate(frm.search_fd0.value)) {
|
||
nIndex++;
|
||
szAlert += "- " +"'Num Mand' invalid numeric format\n";
|
||
}
|
||
if (!NumberValidate(frm.search_fd8.value)) {
|
||
nIndex++;
|
||
szAlert += "- " +"'Adr Num' invalid numeric format\n";
|
||
}*/
|
||
if(nIndex > 0) {
|
||
alert(szAlert) ;
|
||
return false ;
|
||
}
|
||
return true ;
|
||
}
|
||
</script>
|
||
<script src="../nonimg/validate.js"></script>
|
||
<script language='javascript' src='../nonimg/calendar.js'></script>
|
||
</head>
|
||
<body>
|
||
<Center>
|
||
<center><strong><font size="5"><?=htmlentities($titre)?></font></strong></center><br>
|
||
|
||
<a name="top"></a>
|
||
<form name="qs_search_form" method="post" action="./search.php" onSubmit="return check(this)">
|
||
<script>
|
||
function getURLParam(strParamName){
|
||
var strReturn = "";
|
||
var strHref = window.location.href;
|
||
if ( strHref.indexOf("?") > -1 ){
|
||
var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
|
||
var aQueryString = strQueryString.split("&");
|
||
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
|
||
if (
|
||
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
|
||
var aParam = aQueryString[iParam].split("=");
|
||
strReturn = aParam[1];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return strReturn;
|
||
}
|
||
</script>
|
||
<?php
|
||
$css_class = '"TrOdd"';
|
||
?>
|
||
<table Border="0" Cellpadding="2" Cellspacing="1" BgColor="#177AE9">
|
||
<tr>
|
||
<td colspan="2" class="ThRows" align="center"><?=htmlentities($titre)?></td>
|
||
</tr>
|
||
<?php
|
||
if ($err_string != '') {
|
||
print '<tr>';
|
||
print '<td align="left" class="ThRows"><b><font color="red">Erreur :</font></b></td>';
|
||
print '<td align="left" colspan="2" class=' . $css_class . '>' . $err_string . '</td>';
|
||
print '</tr>';
|
||
}
|
||
|
||
foreach ($champ as $i=>$field) {
|
||
if (!$field['hidden'])
|
||
{
|
||
?>
|
||
<tr>
|
||
<td align="left" class="ThRows"><?=htmlentities($field['libelleColonne'])?></td>
|
||
<?php
|
||
$cellvalue = '';
|
||
if ((!isset($_GET['search_fd'.$i])) && (!isset($_POST['search_fd'.$i]))) {
|
||
$itemvalue = '';
|
||
} else {
|
||
$itemvalue = $arryitemvalue[$i];
|
||
}
|
||
if ($format[$i]=='enum') {
|
||
$cellvalue='';
|
||
foreach ($formatEnum[$i] as $value) {
|
||
/*
|
||
$cellvalue.= '<input type="radio" name="edit_fd'.$i.'" value="'.$value. '" ';
|
||
$cellvalue.= qscheckselected($value,$itemvalue,' checked="checked"') .'>'.$value.'<br/>'; */
|
||
$value=utf8_encode($value);
|
||
$cellvalue.= '<input type="radio" name="search_fd'.$i.'" value="'.$value.'" ';
|
||
$cellvalue.= qscheckselected($value, $itemvalue,' checked="checked"') .'>'.$value.'<br/>';
|
||
}
|
||
$cellvalue.='<input type="hidden" name="multisearch_fd'.$i.'" value="">';
|
||
}
|
||
elseif ($format[$i]=='date') $cellvalue.='<input type="text" name="search_fd'.$i.'" value="'. qsreplace_html_quote(stripslashes($itemvalue)) . '"><input type="hidden" name="multisearch_fd'.$i.'" value=""><a href="#search_fd'.$i.'"></a><a name="search_fd'.$i.'"><img src="../images/Calendar.gif" onclick="popUpCalendar(this, document.forms[0].search_fd'.$i.', \'dd/mm/yyyy\', 0, 0)" align="absmiddle" border="0" height="21" width="20"></a>';
|
||
elseif (isset($champ[$i]['libs']['table'])) { /** @todo Aujourd'hui, on ne peut faire une multiple s<>lection car la recherche ne les prendra pas en compte **/
|
||
$libs=$champ[$i]['libs'];
|
||
$cellvalue='<select align="top" name="search_fd'.$i.'"><option/>'.EOL;// SIZE="10" multiple
|
||
|
||
$cellvalue.=qsmysqlgen_listbox( 'SELECT '.$libs['key'].', '.$libs['lib'].' FROM '.$libs['table'].' ORDER BY '.$libs['lib'].' ASC',
|
||
'search_fd'.$i, $libs['key'], $libs['lib'],$itemvalue);
|
||
$cellvalue.='</select>'.EOL;
|
||
} else
|
||
$cellvalue = '<input type="text" name="search_fd'.$i.'" value="'. qsreplace_html_quote(stripslashes($itemvalue)) . '"><input type="hidden" name="multisearch_fd'.$i.'" value="">';
|
||
if ($cellvalue == '') {
|
||
$cellvalue = ' ';
|
||
}
|
||
print '<td class='.$css_class.' align=Default>'.$cellvalue.'</td>';
|
||
?>
|
||
</tr>
|
||
<?php
|
||
}
|
||
}
|
||
/*
|
||
$cellvalue = "";
|
||
if ((!isset($_GET["edit_fd".$i])) && (!isset($_POST["edit_fd".$i]))) {
|
||
if ($formatdate[$i]<>'')
|
||
$itemvalue = qsconvertdate($row[$i],"dd/mm/yyyy");
|
||
else
|
||
$itemvalue = $row[$i];
|
||
} else {
|
||
$itemvalue = qsrequest("edit_fd".$i);
|
||
}
|
||
if ($isEditables[$i]) {
|
||
$cellvalue = '<input type="text" name="edit_fd'.$i.'" value="' . qsreplace_html_quote(stripslashes($itemvalue)) . '"';
|
||
if (isset($long[$i]) && $long[$i]>0) {
|
||
$size=$long[$i]+1;
|
||
if ($size>80) $size=80;
|
||
$cellvalue.=' size="'.$size.'" maxlength="'.$long[$i].'">';
|
||
} else
|
||
$cellvalue.='>';
|
||
if (isset($champ[$i]['libs']['table'])){
|
||
$libs=$champ[$i]['libs'];
|
||
if ($format[$i]=='int') {
|
||
$multiple='';
|
||
$testMutipe1="if (!Selectbox.hasOneOption(this.form.edit_fd$i)) { ";
|
||
$testMutipe2=' } ';
|
||
} else {
|
||
$multiple='multiple';
|
||
$testMutipe1='';
|
||
$testMutipe2='';
|
||
}
|
||
//$cellvalue='<input type="text" name="edit_fd'.$i.'" value="'. htmlentities($itemvalue).'">';
|
||
$cellvalue ='<table><tr><td valign="top"><i>Sélectionné(s) :</i><br/><select align="top" name="edit_fd'.$i.'" size="10" '.$multiple.
|
||
' onDblClick="Selectbox.moveSelectedOptions(this.form.edit_fd'.$i.',this.form.edit_fd'.$i.'out, true)">'.EOL;
|
||
if ($itemvalue<>'') {//mysql_query('SET CHARACTER SET utf8;');
|
||
$cellvalue.=qsmysqlgen_listbox('SELECT '.$libs['key'].', '.$libs['lib'].' FROM '.$libs['table'].' WHERE '.$libs['key'].' IN ('.str_replace(';',',',$itemvalue).')',
|
||
'edit_fd'.$i, $libs['key'], $libs['lib'],$itemvalue);}
|
||
$cellvalue.='</select></td><td align="center">'.EOL;
|
||
// onDblClick="Selectbox.moveSelectedOptions(this.form.list1,this.form.list2,this.form.movesort.checked,this.form.movepattern1.value)">
|
||
// onClick="Selectbox.moveSelectedOptions(this.form.list1,this.form.list2,this.form.movesort.checked,this.form.movepattern1.value)"><br><br>
|
||
$cellvalue.='<input type="button" VALUE=">" onClick="Selectbox.moveSelectedOptions(this.form.edit_fd'.$i.', this.form.edit_fd'.$i.'out, true)"><br/>'.EOL;
|
||
if ($multiple<>'')
|
||
$cellvalue.='<input type="button" VALUE=">>" onClick="Selectbox.moveAllOptions(this.form.edit_fd'.$i.', this.form.edit_fd'.$i.'out, true)"><br/>'.EOL;
|
||
$cellvalue.='<br/><input type="button" VALUE="<" onClick="'.$testMutipe1.'Selectbox.moveSelectedOptions(this.form.edit_fd'.$i.'out, this.form.edit_fd'.$i.', true)'.$testMutipe2.'"><br/>'.EOL;
|
||
if ($multiple<>'')
|
||
$cellvalue.='<input type="button" VALUE="<<" onClick="Selectbox.moveAllOptions(this.form.edit_fd'.$i.'out, this.form.edit_fd'.$i.', true)"><br/>'.EOL;
|
||
|
||
$cellvalue.='</td><td><i>Disponible(s) :</i><br/><select align="top" name="edit_fd'.$i.'out" SIZE="10" '.$multiple.
|
||
'onDblClick="'.$testMutipe1.'Selectbox.moveSelectedOptions(this.form.edit_fd'.$i.'out,this.form.edit_fd'.$i.', true)'.$testMutipe2.'">'.EOL;
|
||
if ($itemvalue<>'')
|
||
$cellvalue.=qsmysqlgen_listbox('SELECT '.$libs['key'].', '.$libs['lib'].' FROM '.$libs['table'].' WHERE '.$libs['key'].' NOT IN ('.str_replace(';',',',$itemvalue).')',
|
||
'edit_fd'.$i.'out', $libs['key'], $libs['lib'],$itemvalue);
|
||
else
|
||
$cellvalue.=qsmysqlgen_listbox('SELECT '.$libs['key'].', '.$libs['lib'].' FROM '.$libs['table'],
|
||
'edit_fd'.$i.'out', $libs['key'], $libs['lib'],$itemvalue);
|
||
$cellvalue.='</select></td></tr></table>'.EOL;
|
||
}
|
||
elseif ($format[$i]=='date') $cellvalue.='<a href="#edit_fd'.$i.'"></a><a name="edit_fd'.$i.'"><img src="../images/Calendar.gif" onclick="popUpCalendar(this, document.forms[0].edit_fd'.$i.', \'dd/mm/yyyy\', 0, 0)" align="absmiddle" border="0" height="21" width="20"></a>';
|
||
elseif ($format[$i]=='text') $cellvalue ='<textarea name="edit_fd'.$i.'" rows=4 cols=40>' . qsreplace_html_quote(stripslashes($itemvalue)) . '</textarea>';
|
||
elseif ($format[$i]=='enum') {
|
||
$cellvalue='';
|
||
foreach ($formatEnum[$i] as $value) {
|
||
$value=utf8_encode($value);
|
||
$cellvalue.= '<input type="radio" name="edit_fd'.$i.'" value="'.$value. '" ';
|
||
$cellvalue.= qscheckselected($value,$itemvalue,' checked="checked"') .'>'.$value.'<br/>';
|
||
}
|
||
}
|
||
if ($champ[$i]['link']<>'') { // Le champ comporte un lien vers une autre source de donn<6E>es
|
||
$tmp=explode('.', $champ[$i]['link']);
|
||
$database = $tmp[0];
|
||
$table = $tmp[1];
|
||
if (isset($tmp[2])) $cles = 'uniqueKey='.$tmp[2].'&value='.$itemvalue;
|
||
else $cles = 'currentrow_fd'.$i.'='.$itemvalue;
|
||
$cellvalue.= ' <a href="./edit.php?dbtable='.$database.'.'.$table.'&'.$cles.'&refererUrl='.urlencode($_SERVER['REQUEST_URI']).'">Lien</a>';
|
||
}
|
||
}
|
||
else { // Le champ n'est pas <20>ditable
|
||
if ($champ[$i]['link']<>'') { // Le champ comporte un lien vers une autre source de donn<6E>es
|
||
$tmp=explode('.', $champ[$i]['link']);
|
||
$database = $tmp[0];
|
||
$table = $tmp[1];
|
||
if (isset($tmp[2])) $cles = 'uniqueKey='.$tmp[2].'&value='.$itemvalue;
|
||
else $cles = 'currentrow_fd'.$i.'='.$itemvalue;
|
||
$cellvalue = '<a href="./edit.php?dbtable='.$database.'.'.$table.'&'.$cles.'&refererUrl='.urlencode($_SERVER['REQUEST_URI']).'">'.$itemvalue.'</a>';
|
||
}
|
||
elseif (isset($champ[$i]['libs']['table'])) { // Le champ a une table li<6C>e
|
||
$libs=$champ[$i]['libs'];
|
||
//$cellvalue='<input type="text" name="edit_fd'.$i.'" value="'. htmlentities($itemvalue).'">';
|
||
$cellvalue =str_replace(array("\n\r","\r\n","\n","\r"),"<br>",qsmysqlgen_listvisu('SELECT '.$libs['key'].', '.$libs['lib'].' FROM '.$libs['table'].' WHERE '.$libs['key'].' IN ('.str_replace(';',',',$itemvalue).')',
|
||
'edit_fd'.$i, $libs['key'], $libs['lib'],$itemvalue));
|
||
}
|
||
else // On afiche laa valeur du champ
|
||
$cellvalue = $itemvalue;
|
||
}
|
||
if ($cellvalue == '') {
|
||
$cellvalue = ' ';
|
||
}
|
||
print '<td class=' . $css_class . ' align="left">' . $cellvalue . '</td></tr>';
|
||
|
||
}
|
||
}
|
||
*/
|
||
|
||
#----get back url page----
|
||
$backurl = "./liste.php?";
|
||
?>
|
||
<tr>
|
||
<td colspan="2" class="ThRows" align=Center>
|
||
<input type="hidden" name="act" value="n">
|
||
<input type="button" name="QS_Back" value="Retour" OnClick="javascript:window.location='<?php print $backurl; ?>'">
|
||
<input type="submit" name="QS_Submit" value="Recherche">
|
||
<input type="button" name="QS_Clear" value="RAZ" OnClick="location='./search.php'">
|
||
</td>
|
||
</tr>
|
||
</Table><br>
|
||
</Form>
|
||
<?php
|
||
if ($link > 0) {mysql_close($link);}
|
||
?>
|
||
<A NAME=bottom></A>
|
||
</center>
|
||
</body>
|
||
</html>
|