"; } switch($action){ case 'add': $groupexpl_form = str_replace("!!deb_saisie!!", htmlentities(stripslashes($f_user_input),ENT_QUOTES,$charset), $groupexpl_form); $groupexpl_form=str_replace('!!statut_principal!!',do_selector('docs_statut', 'statut_principal', ""),$groupexpl_form); $groupexpl_form=str_replace('!!statut_others!!',do_selector('docs_statut', 'statut_others', ""),$groupexpl_form); if($pmb_lecteurs_localises){ $f_loc=$deflt_docs_location; $loc_select .= "
"; } $groupexpl_form=str_replace('!!location!!',$loc_select, $groupexpl_form); print $groupexpl_form; break; case 'update': require_once("$class_path/groupexpl.class.php"); $groupexpl = new groupexpl(); $value['name'] = $name; $value['location'] = $f_loc; $value['statut_principal'] = $statut_principal; $value['statut_others'] = $statut_others; $value['comment'] = $comment; $groupexpl->save($value); $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form); $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input),ENT_QUOTES,$charset), $sel_search_form); print $sel_search_form; print $jscript; show_results($dbh, $user_input, $nbr_lignes, $page); break; case "add_expl": if($id_groupexpl) { print $jscript; $informations = array(); $groupexpl=new groupexpl($id_groupexpl); $exemplaires = explode(",",$expl_list); $flag_error = 0; if(count($exemplaires)) { foreach ($exemplaires as $cb) { $added = $groupexpl->add_expl($cb); if($added) { $informations[$cb] = $groupexpl->info_message; print ""; } else { $id_group = $groupexpl->get_id_group_from_cb($cb); $error_html_message = "".$groupexpl->get_name_group_from_id($id_group).""; $informations[$cb] = $groupexpl->error_message." ".$error_html_message; $flag_error = 1; } } } if($flag_error) { foreach ($informations as $cb=>$information) { $query="SELECT expl_id FROM exemplaires WHERE expl_cb='".$cb."'"; $result=pmb_mysql_query($query); if($result && pmb_mysql_num_rows($result)) { $id = pmb_mysql_result($result,0,0); $nt = new mono_display_expl('',$id, 0); print "
".$nt->result.$aff."".$information."
"; } } $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form); $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input),ENT_QUOTES,$charset), $sel_search_form); print $sel_search_form; show_results($dbh, $user_input, $nbr_lignes, $page); } else { print ""; } } break; default: $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form); $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input),ENT_QUOTES,$charset), $sel_search_form); print $sel_search_form; print $jscript; show_results($dbh, $user_input, $nbr_lignes, $page); break; } function show_results($dbh, $user_input, $nbr_lignes=0, $page=0, $id = 0) { global $nb_per_page; global $base_url; global $caller; global $charset; global $msg; global $expl_list_id ; // on récupére le nombre de lignes qui vont bien if (!$id) { if($user_input=="") { $requete = "SELECT COUNT(1) FROM groupexpl"; } else { $aq=new analyse_query(stripslashes($user_input)); if ($aq->error) { error_message($msg["searcher_syntax_error"],sprintf($msg["searcher_syntax_error_desc"],$aq->current_car,$aq->input_html,$aq->error_message)); exit; } $requete="select count(distinct id_groupexpl) from groupexpl where groupexpl_name like '%".$user_input."%'"; } $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_result($res, 0, 0); } else $nbr_lignes=1; if(!$page) $page=1; $debut =($page-1)*$nb_per_page; if($nbr_lignes) { $expl_list = explode(",",$expl_list_id); $expl_list_cb = array(); foreach ($expl_list as $id_expl) { $query="SELECT expl_cb FROM exemplaires WHERE expl_id='".$id_expl."'"; $result=pmb_mysql_query($query); if($result && pmb_mysql_num_rows($result)) { $cb = pmb_mysql_result($result,0,0); $expl_list_cb[] = $cb; } } $last_id_used = session::get_last_used("groupexpl"); if($last_id_used) { print "
".$msg["selector_last_groupexpl_used"]."
"; $query = "select id_groupexpl, groupexpl_name from groupexpl where id_groupexpl=".$last_id_used; $result = pmb_mysql_query($query); while($group = pmb_mysql_fetch_object($result)) { print pmb_bidi(" id_groupexpl."&expl_list=".implode(",", $expl_list_cb)."\"> $group->groupexpl_name
"); } print "
"; } // on lance la vraie requête if (!$id) { if($user_input=="") { $requete = "SELECT groupexpl.* FROM groupexpl"; $requete .= " ORDER BY groupexpl_name LIMIT $debut,$nb_per_page "; } else { $requete="select groupexpl.* from groupexpl where groupexpl_name like '%".$user_input."%' order by groupexpl_name LIMIT $debut,$nb_per_page"; } } else $requete="select groupexpl.* FROM groupexpl where id_groupexpl='".$id."'"; $res = @pmb_mysql_query($requete, $dbh); while(($group=pmb_mysql_fetch_object($res))) { print pmb_bidi(" id_groupexpl."&expl_list=".implode(",", $expl_list_cb)."\"> $group->groupexpl_name
"); } pmb_mysql_free_result($res); // constitution des liens $nbepages = ceil($nbr_lignes/$nb_per_page); $suivante = $page+1; $precedente = $page-1; // affichage pagination print "
 
"; $url_base = $base_url."&user_input=".rawurlencode(stripslashes($user_input)); $nav_bar = aff_pagination ($url_base, $nbr_lignes, $nb_per_page, $page, 10, false, true) ; print $nav_bar; print "
"; } } print $sel_footer;