label=$label; $this->whereId=$whereId; $this->linkId=$linkId; $this->where=$where; $this->select=$select; $this->selectPrelim=$selectPrelim; $this->from=$from; $this->fromPrelim=$fromPrelim; $this->group=$group; $this->order=$order; $this->countId=$countId; $this->pics=$pics; $this->labelChamps=$labelChamps; $this->sqlChamps=$sqlChamps; $this->typeChamps=$typeChamps; $this->isNumber=$isNumber; $this->columnEdit=$columnEdit; $this->selFinal=$selFinal; } function getSelect() { $toRet = ""; $prems = true; foreach( $this->select as $key=>$val ) { if( !$prems ) $toRet .= ","; $toRet .= $key." AS \"".$val."\""; $prems = false; } return $toRet; } function getFullRequest() { $ret = "SELECT ".$this->getSelect(); if( $this->from || $this->fromPrelim ) { $ret .= " FROM "; if( $this->from ) { $ret .= $this->from; $dej = 1; } if( $this->fromPrelim ) { if( $dej ) $ret .= ","; $ret .= $this->fromPrelim; } } if( $this->where ) $ret .= " WHERE ".$this->where; if( $this->group ) $ret .= " GROUP BY ".$this->group; if( $this->order ) $ret .= " ORDER BY ".$this->order; return $ret; } function getSelectPrelim() { if( ! is_array($this->selectPrelim) ) return; $toRet = ""; $prems = true; foreach( $this->selectPrelim as $key=>$val ) { if( !$prems ) $toRet .= ","; $toRet .= $key." AS \"".$val."\""; $prems = false; } return $toRet; } function toHtml($link) // renvoie la page html présentant la requete { $result=NULL; $html="
\n"; $html.="label\">"; if(isset($this->labelChamps[0])) foreach($this->labelChamps as $lbl) // On parcourt le tableau des parametres { $fond=($x == 1 ? "#FFFFFF" : "#F2F2F2"); // on alterne les couleurs de ligne $x = ($x == 1 ? 0 : 1) ; if($lbl==NULL) break; $html.=""; if($this->typeChamps[$i]!="FREE"&&substr($this->sqlChamps[$i],0,6)=="SELECT") // Si c'est une combo { $result = mysql_query( $this->sqlChamps[$i], $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); // on execute la requete remplissant la combo //echo $this->sqlChamps[$i]; $nomColonne= mysql_fetch_field($result); } $html.=""; } if(isset($this->labelChamps[0])) $html.="
".$this->label."\n"; $i=0; $html.="
".$lbl."\n"; switch($this->typeChamps[$i]) { case "COMBO": $html.="

\n";break; } if($this->typeChamps[$i]=="COMBO") { if(substr($this->sqlChamps[$i],0,6)=="SELECT") while($item = mysql_fetch_object($result)) { // Ajouter $item dans la combo $cl=$nomColonne->name; if((isset($_POST[$varr])&&$item->$cl!=$vall) || !isset($_POST[$varr])) $html.="\n"; // on met l'objet trouvé dans la combo } else { $bouts = explode(",", $this->sqlChamps[$i]); foreach($bouts as $le) if($le!=$vall) $html.="\n"; // on met l'objet trouvé dans la combo } } if($this->typeChamps[$i]=="COMBO") $html.="

\n"; $i++; $html.="

\n"; $html.="


\n"; return $html; } } } ?>