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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
| <script language="JAVASCRIPT">
function glisse(d1,d2,lng,pos)
{
var action = new Control.Slider(d1, d2, {
sliderValue:pos,
range: $R(0,lng),
values: $R(0,lng)
// ,
// onSlide: function(v) { $(d1).innerHTML = v },
// onChange: function(v) { $(d1).innerHTML = v }
});
}
</script>
<?
include "conf.modif.php";
function calendrier()
{
$aff = "";
$today = mktime();
$nbj = 0;
$day[0] = date("d-m-y",$today);
for ($d = 0; $d <= (365); $d++)
{
$nextday = $today + 60*60*24*$d;
if ( date("w",$nextday) > 0 AND date("w",$nextday) < 5 AND $old_m == date("n",$nextday) )
{
$nbj++;
$aff .= "<div style='display:inline; width:10px; height:4px; border-right: 1px solid #C8C8C8;'></div>";
$m = date("n",$nextday);
}
elseif (date("w",$nextday) == 5 AND $old_m == date("n",$nextday))
{
$nbj++;
$aff .= "<div style='display:inline; width:10px; height:4px; border-right: 2px solid #969696;'></div>";
$m = date("n",$nextday);
}
elseif (date("w",$nextday) > 0 AND date("w",$nextday) < 6 AND $old_m != date("n",$nextday))
{
$nbj++;
$aff .= "<div style='display:inline; width:10px; height:4px; border-right: 3px solid #484848;'></div>";
$m = date("n",$nextday);
}
$old_m = $m;
}
return array($aff,$nbj);
}
$calendrier = calendrier();
$sql = "SELECT a.*, b.jour AS duree, c.nom as description ";
$sql .= "FROM ".$table_phase." a, ".$table_phase_temps." b, ".$table_grp." c ";
$sql .= "WHERE a.id = b.id ";
$sql .= "AND a.grp = c.id ";
$sql .= "ORDER BY a.etape ASC, a.phase ASC, a.sphase ASC";
$res = mysql_query( $sql );
// echo mysql_errno() . ": " . mysql_error(). "<BR>\n";
?>
<table>
<tr>
<td colspan="2">
<div id="scrollable1" style="
display: inline;
float: left;
width: 100%;
height: 550px;
border: 1px solid #ccc;
overflow: hidden;
white-space: nowrap;
">
<?
echo "<table BGCOLOR='#3965A5' width='100%' border='0'>";
$i=0;
$titreProjet[$i] = "";
$titreProjet1[$i] = "";
$projet[$i] = "";
while ($enr = mysql_fetch_object( $res )) {
if ( $enr->phase == 0 AND $enr->sphase == 0 AND $enr->grp == 0 AND $enr->sgrp == 0 ) {
$etape = $enr->etape;
$letape = $alpha[$enr->etape];
$letape_descr = str_replace("'","\'",$enr->nom);
} else {
$i++;
$desc[$i] = "<TABLE BORDER=2 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR=red ALIGN=center width=400px>";
$desc[$i] .= "<tr BGCOLOR=#FFFFFF>";
$desc[$i] .= "<td>";
$desc[$i] .= "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=3 BORDERCOLOR=red ALIGN=left>";
$desc[$i] .= "<tr BGCOLOR=#FFFFFF>";
$desc[$i] .= "<td align=left valign=top NOWRAP>";
$desc[$i] .= $letape;
$desc[$i] .= "</td>";
$desc[$i] .= "<td align=right valign=top NOWRAP>";
$desc[$i] .= ":";
$desc[$i] .= "</td>";
$desc[$i] .= "<td>";
$desc[$i] .= $letape_descr;
$desc[$i] .= "</td>";
$desc[$i] .= "</tr>";
$desc[$i] .= "<tr BGCOLOR=#FFFFFF>";
$desc[$i] .= "<td align=right valign=top NOWRAP>";
$desc[$i] .= $letape."-".$enr->phase."-".$enr->sphase;
$desc[$i] .= "</td>";
$desc[$i] .= "<td align=right valign=top NOWRAP>";
$desc[$i] .= ":";
$desc[$i] .= "</td>";
$desc[$i] .= "<td>";
$desc[$i] .= str_replace("'","\'",$enr->nom);
$desc[$i] .= "</td>";
$desc[$i] .= "</tr>";
$desc[$i] .= "<tr BGCOLOR=#FFFFFF>";
$desc[$i] .= "<td align=right valign=top NOWRAP>";
$desc[$i] .= "Acteur";
$desc[$i] .= "</td>";
$desc[$i] .= "<td align=right valign=top NOWRAP>";
$desc[$i] .= ":";
$desc[$i] .= "</td>";
$desc[$i] .= "<td>";
$desc[$i] .= $enr->description;
$desc[$i] .= "</td>";
$desc[$i] .= "</tr>";
$desc[$i] .= "</table>";
$desc[$i] .= "</td>";
$desc[$i] .= "</tr>";
$desc[$i] .= "</table>";
$titreProjet[$i] .= "<TR>\n";
$titreProjet[$i] .= "<TD align='center' width='40px'>\n";
$titreProjet[$i] .= "<input type='hidden' name='etape[".$i."]' id ='etape[".$i."]' value='".$etape."'>";
$titreProjet[$i] .= "<input type='hidden' name='phase[".$i."]' id ='phase[".$i."]' value='".$enr->phase."'>";
$titreProjet[$i] .= "<input type='hidden' name='sphase[".$i."]' id ='sphase[".$i."]' value='".$enr->sphase."'>";
$titreProjet[$i] .= "<input type='button' name='g[".$i."]' id ='g[".$i."]' value='".$letape."-".$enr->phase."-".$enr->sphase."' ";
$titreProjet[$i] .= "onMouseOver=\"Change_objet('monObjet','".$desc[$i]."',x+30,y-20)\" ";
$titreProjet[$i] .= "onMouseOut=\"Change_objet('monObjet','',0,0)\" ";
$titreProjet[$i] .= "style='text-align:center; width:40px; cursor:hand;'>";
$titreProjet[$i] .= "</TD>\n";
$titreProjet[$i] .= "<TD align='center' width='15px'>\n";
$titreProjet[$i] .= "<input type='checkbox' name='cb[".$i."]' id ='cb[".$i."]' style='width:12px; cursor:hand;'>";
$titreProjet[$i] .= "</TD>\n";
$titreProjet[$i] .= "<TD align='center' width='15px'>\n";
$titreProjet[$i] .= "<select name='dep[".$i."]' id='dep[".$i."]'>";
$titreProjet[$i] .= "<option value=''>dep</option>";
$titreProjet[$i] .= "</select>";
$titreProjet[$i] .= "</TD>\n";
$titreProjet1[$i] .= "</TR>\n";
$projet[$i] .= "<DIV id='piste".$i."' style='width:".($calendrier[1]*10)."px; height=24px; background-color:#FFFFFF; overflow: none;'>";
$projet[$i] .= $calendrier[0];
$projet[$i] .= "<DIV id='curseur".$i."' style='width:".($enr->duree*10)."px; height=20px; background-color:#00E673; text-align:center;'>";
$projet[$i] .= $enr->duree;
$projet[$i] .= "</DIV>";
$projet[$i] .= "</DIV>";
// definition de la position par rapport à la rependence
$duree[$enr->id] = $enr->duree;
$dec[$enr->id] = $dec[$enr->dep] + $duree[$enr->dep];
$projet[$i] .= "<script language=\"JAVASCRIPT\">";
$projet[$i] .= "glisse('curseur".$i."','piste".$i."','".($calendrier[1]-$enr->duree)."','".$dec[$enr->id]."')";
$projet[$i] .= "</script>";
}
}
for ($ligne = 1; $ligne<= $i; $ligne++)
{
echo $titreProjet[$ligne];
if ($ligne == 1)
{
echo "<td rowspan='".$i."'>";
echo "<DIV id='project' style='
width: 900px;
display: inline;
float: left;
border: 1px solid #ccc;
overflow: hidden;
white-space: nowrap;
'>";
for ($pligne = 1; $pligne<= $i; $pligne++)
{
echo $projet[$pligne];
}
echo "</td>";
echo "</DIV>";
}
echo $titreProjet1[$ligne];
}
echo "<input type='hidden' name='text7' value='$i'>";
echo "</table>";
?>
</div>
</td>
<td>
<div id="track1" style="
float: left;
width: 15px;
height: 550px;
margin-left: 10px;
background-color: #ccc;
"><div id="handle1" style="
width: 15px;
height: 20px;
background-color: #f00;
cursor: move;
"></div></div>
</td>
</tr>
<tr>
<td>
<div style="
width:120px;
"> </div>
</td>
<td>
<div id="track2" style="
display: inline;
float: left;
clear: both;
width: 900px;
height: 15px;
margin-top: 10px;
background-color:#ccc;
"><div id="handle2" style="
width: 20px;
height: 15px;
background-color: #f00;
cursor: move;
"></div></div>
</td>
</tr>
</table>
<script language="JAVASCRIPT">
// vertical slider control
var slider1 = new Control.Slider('handle1', 'track1', {
axis: 'vertical',
range: $R(0,15),
values: $R(0,15),
onSlide: function(v) { scrollVertical(v, $('scrollable1'), slider1); },
onChange: function(v) { scrollVertical(v, $('scrollable1'), slider1);}
});
// scroll the element vertically based on its width and the slider maximum value
function scrollVertical(value, element, slider) {
element.scrollTop = Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight));
}
var slider2 = new Control.Slider('handle2', 'track2', {
range: $R(0,100),
values: $R(0,100),
onSlide: function(v) { scrollHorizontal(v, $('project'), slider2); },
onChange: function(v) { scrollHorizontal(v, $('project'), slider2); }
});
// scroll the element horizontally based on its width and the slider maximum value
function scrollHorizontal(value, element, slider) {
element.scrollLeft = Math.round(value/slider.maximum*(element.scrollWidth-element.offsetWidth));
}
// mouse wheel code from http://adomas.org/javascript-mouse-wheel/
function handle(delta) {
slider1.setValueBy(-delta);
}
/** Event handler for mouse wheel event. */
function wheel(event){
var delta = 0;
if (!event) /* For IE. */
event = window.event;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
/** In Opera 9, delta differs in sign as compared to IE. */
if (window.opera)
delta = -delta;
} else if (event.detail) { /** Mozilla case. */
/** In Mozilla, sign of delta is different than in IE.
* Also, delta is multiple of 3.
*/
delta = -event.detail/3;
}
/** If delta is nonzero, handle it.
* Basically, delta is now positive if wheel was scrolled up,
* and negative, if wheel was scrolled down.
*/
if (delta)
handle(delta);
/** Prevent default actions caused by mouse wheel.
* That might be ugly, but we handle scrolls somehow
* anyway, so don't bother here..
*/
if (event.preventDefault)
event.preventDefault();
event.returnValue = false;
}
// mozilla
Event.observe('scrollable1', 'DOMMouseScroll', wheel);
// IE/Opera
Event.observe('scrollable1', 'mousewheel', wheel);
</script> |
Partager