get_global_value($name); $selector = ""; return $selector; } protected function gen_selector_asc_desc($name='') { global $msg, $charset; $selected = $this->get_global_value($name); $selector = ""; return $selector; } public function get_already_selected() { global $msg, $charset; global $add_field; global $delete_field; global $fields; //Affichage des champs deja saisis $r=""; $n=0; $r.="\n"; if (!empty($fields) && is_array($fields)) { for ($i=0; $i";//Colonne 1 $r.=""; $r.=""; $r.=""; $r.=""; $r.="";//Colonne 6 $r.="\n"; $n++; } } } $r.="
";//Colonne 2 if ($f[0]=="f") { if($f[2] && isset(self::$fields[$this->type]["FIELD"][$f[1]]["TABLE"]) && isset($msg[self::$fields[$this->type]["FIELD"][$f[1]]["TABLE"][0]["TABLEFIELD"][$f[2]]["NAME"]])) { $r.=htmlentities($msg[self::$fields[$this->type]["FIELD"][$f[1]]["TABLE"][0]["TABLEFIELD"][$f[2]]["NAME"]],ENT_QUOTES,$charset); } elseif (isset($msg[self::$fields[$this->type]["FIELD"][$f[1]]["NAME"]])) { $r.=htmlentities($msg[self::$fields[$this->type]["FIELD"][$f[1]]["NAME"]],ENT_QUOTES,$charset); } else { $r.=htmlentities(self::$fields[$this->type]["FIELD"][$f[1]]["NAME"],ENT_QUOTES,$charset); } } elseif(array_key_exists($f[0],static::$pp)) { $r.=htmlentities(static::$pp[$f[0]]->t_fields[$f[2]]["TITRE"],ENT_QUOTES,$charset); } $r.="";//Colonne 3 $r.=$this->gen_selector_asc_desc("asc_desc_".$n."_".$fields[$i]); $r.="";//Colonne 4 $r.=$this->gen_selector_type("type_".$n."_".$fields[$i]); $r.="
"; return $r; } public function format_fields() { global $fields; $to_format=array(); for ($i=0; $iget_global_value("asc_desc_".$i."_".$fields[$i]); $to_format[$i]["TYPE"]=$this->get_global_value("type_".$i."_".$fields[$i]); } return $to_format; } public function unformat_fields($to_unformat) { global $fields; $fields=array(); for ($i=0; $iset_global_value("asc_desc_".$i."_".$fields[$i], $to_unformat[$i]["ASC_DESC"]); $this->set_global_value("type_".$i."_".$fields[$i], $to_unformat[$i]["TYPE"]); } } public static function get_types() { return array( "alpha" => "msg:frbr_sort_field_alpha", "num" => "msg:frbr_sort_field_num", "date" => "msg:frbr_sort_field_date", ); } public static function get_directions() { return array( "asc" => "msg:tri_croissant", "desc" => "msg:tri_decroissant" ); } public function get_human_query($fields) { global $msg; global $charset; if (!is_array($fields)) { $fields = encoding_normalize::json_decode($fields, true); } $human_query = ""; foreach ($fields as $field) { $f=explode("_",$field['NAME']); $title = ""; if ($f[0] == "authperso") { $groups = $this->grouped(); foreach($groups as $group) { foreach ($group as $id => $label) { if ($id == $field['NAME']) { $title = $label; break; } } } }else if($f[2] && isset(static::$fields[$this->type]["FIELD"][$f[1]]["TABLE"])) { $title = $msg[static::$fields[$this->type]["FIELD"][$f[1]]["TABLE"][0]["TABLEFIELD"][$f[2]]["NAME"]]; } elseif (isset($msg[static::$fields[$this->type]["FIELD"][$f[1]]["NAME"]])) { $title = $msg[static::$fields[$this->type]["FIELD"][$f[1]]["NAME"]]; } else { $title = static::$fields[$this->type]["FIELD"][$f[1]]["NAME"]; } if ($human_query) { $human_query .= ", "; } $human_query .= " ".htmlentities($title,ENT_QUOTES,$charset)." ".htmlentities(get_msg_to_display(static::get_types()[$field['TYPE']]),ENT_QUOTES,$charset)." (".htmlentities(get_msg_to_display(static::get_directions()[$field['ASC_DESC']]),ENT_QUOTES,$charset).") "; } return $human_query; } }