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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<html>
<!-- import the calendar script -->
<script type="text/javascript" src="calendar.js"></script>
<!-- import the language module -->
<script type="text/javascript" src="calendar-fr.js"></script>
<!-- other languages might be available in the lang directory; please check
your distribution archive. -->
<!-- helper script that uses the calendar -->
<script type="text/javascript">
function JsCal() {
this.selected = function(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked) {
cal.callCloseHandler(); // this calls "onClose" (see above)
}
}
this.closeHandler = function(cal) {
cal.hide(); // hide the calendar
}
this.showCalendar = function(id, format, showsTime, showsOtherMonths) {
var el = document.getElementById(id);
// first-time call, create the calendar.
var cal = new Calendar(1, null, this.selected, this.closeHandler);
// uncomment the following line to hide the week numbers
cal.weekNumbers = true;
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
}
if (showsOtherMonths) {
cal.showsOtherMonths = true;
}
this._dynarch_popupCalendar = cal; // remember it in the global var
cal.setRange(1900, 2070); // min/max year allowed.
cal.create();
cal.setDateFormat(format); // set the specified date format
cal.parseDate(el.value); // try to parse the text in field
cal.sel = el; // inform it what input field we use
// the reference element that we pass to showAtElement is the button that
// triggers the calendar. In this example we align the calendar bottom-right
// to the button.
cal.showAtElement(el, "B1"); // show the calendar
return false;
}
}
</script>
</head>
<script>
toto = new JsCal();
</script>
<?php
// appel du fichier contenant les paramètres de connexion au SGBD
include_once "connexion.php";
$res_req = pg_query($dbconnect, "SELECT machine FROM machine");
if ( $row = pg_fetch_assoc ( $res_req ) ) {
?><form name="form1" method="POST" action=""><?php
echo "<select name=formdata[] multiple size=10>" ;
do {
extract ( $row );
echo "<option value=\"$machine\">$machine</option>" ;
}
while( $row = pg_fetch_assoc ( $res_req ) );
echo "</select>" ;
echo "<input type=submit>" ;
?>
<b>Debut :</b> <input type="text" name="date1" method= "POST" id="sel1" size="10">
<a href='#' id='sel1' onClick="return toto.showCalendar('sel1', '%Y-%m-%d', false,true);"><img src="img.gif"> </a>
<b>Fin :</b> <input type="text" name="date2" id="sel2" method= "POST" size="10">
<a href='#' id='sel2' onClick="return toto.showCalendar('sel2', '%Y-%m-%d', false,true);"> <img src="img.gif"> </a>
</form>
<?php
}
if (isset($_POST["date1"])) $date1=$_POST["date1"];
if (isset($_POST["date2"])) $date2=$_POST["date2"];
echo "$date1";
echo "$date2";
?>
<div style="text-align: center;"><big><span
style="font-weight: bold;">Liste des Maintenances</span></big><br>
</div>
<br>
<br>
<table >
<th>Machine</th>
<th>Debut</th>
<th>Fin</th>
<?php
if (isset($_POST["formdata"])&& !empty($_POST["formdata"])) {
// Show data
foreach( $_POST['formdata'] AS $data ) {
echo "$data";
$list_values = implode(',',"$data");
echo "$list_values" ;
$requete=pg_query($dbconnect,"select machine, deb, fin
FROM evt where machine in ('$data') and to_char(deb,'YYYY-MM-DD') >= '$date1' and to_char(fin ,'YYYY-MM-DD') <= '$date2' order by deb order by deb, fin");
while($row = pg_fetch_row($requete)){
$machine = $row[0];
$deb = $row[1];
$fin = $row[2];
echo "
<tr>
<td> $machine </td>
<td> $deb </td>
<td> $fin </td>
</tr>";
}
}
}
pg_close();
?>
</table>
</html> |
Partager