-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0_baseselector.php
36 lines (27 loc) · 1.45 KB
/
0_baseselector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$BASE= isset($_GET["BASE"]) ? htmlentities($_GET["BASE"]) : "" ;
echo "<form method=\"get\" action=\"?\">";
$nb_base=0;
$list_bases=array();
while( ( $db = $dbs->fetchColumn( 0 ) ) !== false )
{ if (strpos($db, $prefix) !== false ) {
$list_bases[]="<option value=\"".str_replace($prefix, "", $db)."\">".strtoupper( str_replace($prefix, "", $db) )."</option>";
$first_base = ($nb_base==0) ? str_replace($prefix, "", $db) : $first_base ;
$nb_base=$nb_base+1;
}
}
if ($nb_base=="0") echo "<p style=\"text-align:center;\">Aucun inventaire détecté !</p>";
elseif ($nb_base=="1") $database = ($BASE=="") ? $first_base : $BASE ;
//else $database = ($BASE=="") ? $first_base : $BASE ;
echo "<p style=\"text-align:center;\">";
echo "<select name=\"BASE\" onchange=\"submit();\" data-placeholder=\"Choose…\" class=\"chosen-select\" tabindex=\"0\">";
echo "<option value=\"\">− Sélectionnez une base −</option>";
foreach ($list_bases as $d) {
echo str_replace("value=\"".str_replace($prefix, "", $database)."\">", "value=\"".str_replace($prefix, "", $database)."\" selected>", $d);
}
echo "</select> ";
if (isset($i)) { if ($i!="") echo "<input id=\"i\" name=\"i\" type=\"hidden\" value=\"$i\">"; }
echo "<span id=\"linkbox\" onclick=\"TINY.box.show({iframe:'database_add.php',width:200,height:200,closejs:function(){location.reload()}})\" title=\"Ajouter une nouvelle base d’inventaire\">+</span>";
echo "</p>";
echo "</form>";
?>