Esempio n. 1
0
 function display_result()
 {
     global $class_path, $charset, $msg;
     $aff = "";
     if ($this->query) {
         $execute_query = mysql_query($this->query);
         $aff .= "<table class='" . $this->css["table"]["class"] . "' style='" . $this->css["table"]["style"] . "'>";
         $parity = 0;
         $header = "";
         $s = explode(",", $this->displaycolumns);
         for ($n = 0; $n < count($s); $n++) {
             if (substr($s[$n], 0, 1) == "#" && $this->params["REFERENCE"][0]["DYNAMICFIELDS"] == "yes") {
                 //champs perso
                 require_once $class_path . "/parametres_perso.class.php";
                 $cp = new parametres_perso($this->params["REFERENCE"][0]["PREFIXNAME"]);
                 if (!$cp->no_special_fields) {
                     $id = substr($s[$n], 1);
                     $header .= "<th>" . htmlentities($cp->t_fields[$id][TITRE], ENT_QUOTES, $charset) . "</th>";
                 }
             } elseif (array_key_exists($s[$n], $this->fixedfields)) {
                 //champs fixes
                 $header .= "<th>" . $msg[str_replace("msg:", "", $this->fixedfields[$s[$n]]["NAME"])] . "</th>";
             } elseif (array_key_exists($s[$n], $this->specialfields)) {
                 //champs spéciaux
                 $header .= "<th>" . $msg[str_replace("msg:", "", $this->specialfields[$s[$n]]["NAME"])] . "</th>";
             } else {
                 $header .= "<th>&nbsp;</th>";
             }
         }
         $aff .= $header;
         while ($result = mysql_fetch_array($execute_query)) {
             $onmouseout = $this->scripts["row"]["onmouseout"];
             $onmouseover = $this->scripts["row"]["onmouseover"];
             $onmousedown = $this->scripts["row"]["onmousedown"];
             if ($parity % 2) {
                 $pair_impair = $this->css["row_even"]["class"];
                 $pair_impair_style = $this->css["row_even"]["style"];
                 $onmouseout = str_replace('!!parity!!', $this->css["row_even"]["class"], $onmouseout);
                 $onmouseover = str_replace('!!parity!!', $this->css["row_even"]["class"], $onmouseover);
                 $onmouseout = str_replace('!!parity!!', $this->css["row_even"]["class"], $onmouseout);
             } else {
                 $pair_impair = $this->css["row_odd"]["class"];
                 $pair_impair_style = $this->css["row_odd"]["style"];
                 $onmouseout = str_replace('!!parity!!', $this->css["row_odd"]["class"], $onmouseout);
                 $onmouseover = str_replace('!!parity!!', $this->css["row_odd"]["class"], $onmouseover);
                 $onmousedown = str_replace('!!parity!!', $this->css["row_odd"]["class"], $onmousedown);
             }
             $ligne = "";
             $s = explode(",", $this->displaycolumns);
             //parcours des champs
             for ($i = 0; $i < count($s); $i++) {
                 //détermination de la valeur
                 if (substr($s[$i], 0, 1) == "#" && $this->params["REFERENCE"][0]["DYNAMICFIELDS"] == "yes") {
                     //champs perso
                     require_once $class_path . "/parametres_perso.class.php";
                     $cp = new parametres_perso($this->params["REFERENCE"][0]["PREFIXNAME"]);
                     $id = substr($s[$i], 1);
                     $cp->get_values($result[$this->params["REFERENCEKEY"][0]["value"]]);
                     if (!$cp->no_special_fields) {
                         //    						$temp=$result[$this->params["REFERENCE"][0]["PREFIXNAME"]."_custom_".$cp->t_fields[$id]["DATATYPE"].$id];
                         $onmouseout = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmouseout);
                         $onmouseover = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmouseover);
                         $onmousedown = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmousedown);
                         $temp = $cp->get_formatted_output($cp->values[$id], $id);
                         if (!$temp) {
                             $temp = "&nbsp;";
                         }
                         $ligne .= "<td class='" . $this->css["cols"][$i]["class"] . "' style='" . $this->css["cols"][$i]["style"] . "'>" . $temp . "</td>";
                     }
                 } elseif (array_key_exists($s[$i], $this->fixedfields)) {
                     //champs fixes
                     $f = array();
                     if ($this->fixedfields[$s[$i]]["LINK"]) {
                         for ($x = 0; $x < count($this->fixedfields[$s[$i]]["LINK"]); $x++) {
                             if ($this->fixedfields[$s[$i]]["LINK"][$x]["TYPE"] == "nn") {
                                 if ($this->fixedfields[$s[$i]]["TABLEALIAS"][0]["NAME"]) {
                                     $f[0] = $this->fixedfields[$s[$i]]["TABLEALIAS"][0]["NAME"];
                                 } else {
                                     $f[0] = $this->fixedfields[$s[$i]]["TABLEFIELD"][0]["NAME"];
                                 }
                             } else {
                                 if ($this->fixedfields[$s[$i]]["TABLEALIAS"][0][value]) {
                                     $f[0] = $this->fixedfields[$s[$i]]["TABLEALIAS"][0][value];
                                 } else {
                                     $f[0] = $this->fixedfields[$s[$i]]["TABLEFIELD"][0][value];
                                 }
                             }
                         }
                     } else {
                         if ($this->fixedfields[$s[$i]]["TABLEALIAS"][0][value]) {
                             $f = explode(",", $this->fixedfields[$s[$i]]["TABLEALIAS"][0][value]);
                         } else {
                             $f = explode(",", $this->fixedfields[$s[$i]]["TABLEFIELD"][0][value]);
                         }
                     }
                     $b = 0;
                     $ligne .= "<td class='" . $this->css["cols"][$i]["class"] . "' style='" . $this->css["cols"][$i]["style"] . "'>";
                     while ($b < count($f)) {
                         $temp = $result[$f[$b]];
                         if ($temp == '') {
                             $temp = "&nbsp;";
                         }
                         $ligne .= $temp . "&nbsp;";
                         $b++;
                     }
                     $ligne .= "</td>";
                     $onmouseout = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmouseout);
                     $onmouseover = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmouseover);
                     $onmousedown = str_replace("!!" . $s[$i] . "!!", rawurlencode($temp), $onmousedown);
                 } else {
                     $name_function = $this->specialfields[$s[$i]]["FUNCTION"];
                     $r = "";
                     $key = $result[$this->params["REFERENCEKEY"][0][value]];
                     eval("\$r=" . $name_function . "(\$key);");
                     $ligne .= $r;
                 }
             }
             if ($this->filter_name == "empr" && !array_search("b", $s)) {
                 require_once $class_path . "/emprunteur.class.php";
                 $code_b = emprunteur::get_cb_empr($result[$this->params["REFERENCEKEY"][0][value]]);
                 if ($code_b) {
                     $onmouseout = str_replace("!!b!!", $code_b, $onmouseout);
                     $onmouseover = str_replace("!!b!!", $code_b, $onmouseover);
                     $onmousedown = str_replace("!!b!!", $code_b, $onmousedown);
                 }
             }
             $onmouseout = str_replace("!!" . $this->params["REFERENCEKEY"][0][value] . "!!", $result[$this->params["REFERENCEKEY"][0][value]], $onmouseout);
             $onmouseover = str_replace("!!" . $this->params["REFERENCEKEY"][0][value] . "!!", $result[$this->params["REFERENCEKEY"][0][value]], $onmouseover);
             $onmousedown = str_replace("!!" . $this->params["REFERENCEKEY"][0][value] . "!!", $result[$this->params["REFERENCEKEY"][0][value]], $onmousedown);
             $aff .= "<tr class='" . $pair_impair . "' style='{$pair_impair_style}' onmouseover=\"this.className='surbrillance';" . $onmouseover . "\" onmouseout=\"" . $onmouseout . "\" onmousedown='" . $onmousedown . "'>";
             $aff .= $ligne;
             $aff .= "</tr>";
             $parity += 1;
         }
         $aff .= "</table>";
     }
     return $aff;
 }