";
if (is_array($_SESSION["search_universes".$n]['segments'])) {
//for ($i = count($_SESSION["search_universes".$n]['segments']) - 1; $i >= 0 ; $i--) {
if (count($_SESSION["search_universes".$n]['segments'])) {
$html .= "";
}
}
$html .= " ";
}
return $html;
}
public static function update_json_search_with_history() {
global $universe_history;
global $segment_history;
global $segment_json_search;
global $universe_id;
global $universe_query;
//on provient de l'historique ou non
if (!empty($universe_history) && isset($segment_history)) {
$search_index = $universe_history;
$segment_json_search = $_SESSION["search_universes".$universe_history]["segments"][$segment_history]['search'];
$universe_id = $_SESSION["search_universes".$universe_history]["universe_id"];
$universe_query = $_SESSION["search_universes".$universe_history]["universe_query"];
}
}
public static function rec_history() {
global $es;
global $user_query;
global $universe_id;
global $universe_query;
global $lvl;
global $id;
global $search_index;
global $search_type;
global $segment_id;
//TODO : ajout l'opac view
if (!empty($universe_id) && empty($segment_id)) {
$_SESSION["nb_queries"] = intval($_SESSION["nb_queries"])+1;
$n = $_SESSION["nb_queries"];
$search_index = $n;
$_SESSION["search_type".$n] = $search_type;
$_SESSION["search_universes".$n] = array();
$_SESSION["search_universes".$n]["universe_query"] = (!empty($user_query) ? $user_query : (!empty($universe_query) ? $universe_query : ""));
$_SESSION["search_universes".$n]["universe_id"] = $universe_id;
$_SESSION["search_universes".$n]["opac_view"] = (isset($_SESSION["opac_view"]) ? $_SESSION["opac_view"] : "default_opac");
}
if ($lvl == "search_segment") {
if (!isset($_SESSION["search_universes".$search_index]["segments"])) {
$_SESSION["search_universes".$search_index]["segments"] = array();
}
$_SESSION["search_universes".$search_index]["segments"][] = array(
'id' => $id,
'search'=> addslashes($es->json_encode_search()),
'human_query' => static::get_segment_human_query()
);
}
}
protected static function get_segment_human_query() {
global $search;
global $es;
global $msg;
if (static::$segment_json_search) {
$es->json_decode_search(static::$segment_json_search);
}
$human_query = "";
if (is_array($search)) {
$human_query = "";
if (count($search) > 1) {
for ($i = 1; $i < count($search) ; $i++) {
if (!in_array($i, static::$undisplayed_search_index)) {
$human_query .= "- ".$es->make_segment_human_field($i)."
";
}
}
} elseif (count($search) == 1) {
//message de base � afficher pour la recherche * dans le segment
$human_query .= "- ".$msg["search_segment_all_fields"]."
";
}
$human_query .= "
";
}
return $human_query;
}
public static function get_history($n) {
global $universe_query;
global $universe_id;
$universe_query = $_SESSION["search_universes".$n]["universe_query"];
$universe_id = $_SESSION["search_universes".$n]["universe_id"];
}
public static function get_human_query($n) {
global $msg;
return sprintf($msg["search_universe_history"], search_universe::get_label_from_id($_SESSION["search_universes".$n]["universe_id"]), stripslashes($_SESSION["search_universes".$n]["universe_query"]));
}
public static function init_universe_query_from_history() {
global $universe_query;
global $universe_history;
global $search_index;
if (!empty($search_index) && isset($_SESSION["search_universes".$search_index]["universe_query"])) {
$universe_query = $_SESSION["search_universes".$search_index]["universe_query"];
}
if (isset($universe_query)) {
return $universe_query;
}
return null;
}
}