AnonSec Team
Server IP : 10.128.40.6  /  Your IP : 216.73.216.233
Web Server : Apache
System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : logmcpe ( 111175)
PHP Version : 7.3.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/logmcpe/www/MC/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/MC/g.php
<?php
include_once 'code/init.php' ;
print_header();
if(!empty($_GET['inter']))
	$_POST = array_merge_recursive($_POST, $_GET) ;
$q = dbi_query("SELECT * FROM ".TABLE_CONFIG." WHERE agence_id=$agence") ;
$conf = array() ;
while($r = dbi_fetch_row($q))
	$conf[$r['key']] = $r['value'] ;
define('RIEN','FFFFFF');
define('DISPO',$conf['dispo']);
define('PONCT',$conf['prest']);
define('PONCT_HORS_DISPO',$conf['presthd']);
define('RECUR',$conf['prestr']);
define('RECUR_HORS_DISPO',$conf['prestrhd']);
define('CHEVAUCHEMENT',$conf['prestc']);
if(empty($_GET))
{
?>
<form action="g.php" method="post" name="vues">
<TABLE width="650" align="left">
<tr><td style="border-right:none" align="left">
<?=get_intervenants_drop_down('inter[]', 'multiple', @$_POST['inter'], false)?>
<a onclick="var select = document.vues.elements[0].options ; for(i = 0 ; i < select.length ; i++) select[i].selected = true; return false" href="">S&eacute;lectionner tout</a>&nbsp;|&nbsp;<a onclick="var select = document.vues.elements[0].options ; for(i = 0 ; i < select.length ; i++) select[i].selected = false; return false" href="">D&eacute;s&eacute;lectionner tout</a>
</td>
<td style="border-right:none" width="300" align="left">
Afficher :<br />
<input type="radio" name="dispo" value="1" onclick="this.form.rec.disabled = this.form.pon.disabled = this.checked ;"<?=isset($_POST['dispo']) && $_POST['dispo'] == 1 ? ' checked' : ''?>> Uniquement les disponibilit&eacute;s<br />
<input type="radio" name="dispo" value="2" onclick="this.form.rec.disabled = this.form.pon.disabled = !this.checked ;"<?=!isset($_POST['dispo']) || $_POST['dispo'] == 2 ? ' checked' : ''?>> Les disponibilit&eacute;s avec<br />
<blockquote><label for="rec"><input type="checkbox" name="rec" id="rec"<?=isset($_POST['rec']) || empty($_POST) || $_POST['dispo'] == 1 ? ' checked' : ''?><?=isset($_POST['dispo']) && $_POST['dispo'] == 1 ? ' disabled' : ''?>> Prestations r&eacute;currentes</label><br>
<label for="pon"><input type="checkbox" name="pon" id="pon"<?=isset($_POST['pon']) || empty($_POST) || $_POST['dispo'] == 1 ? ' checked' : ''?><?=isset($_POST['dispo']) && $_POST['dispo'] == 1 ? ' disabled' : ''?>>  Prestations ponctuelles</label></blockquote><br>
<select name="type">
<option value="1"<?=!isset($_POST['type']) || $_POST['type'] == 1 ? ' selected' : ''?>>Par intervenant et par jour</option>
<option value="2"<?=isset($_POST['type']) && $_POST['type'] == 2 ? ' selected' : ''?>>Par jour et par intervenant</option>
</select>
<input type="submit" class="bigbutton" value="Afficher" onClick="this.disabled=true;this.form.submit();">
</td></tr>
</TABLE>
</form>
<?php
}
?>
<style type="text/css">
<!--
td, th {
	border-right:solid 1px black;
}
-->
</style>
<?php
if(!empty($_POST['inter']))
{
	define('HSTART', substr($conf['hstart'], 0, 2)*4+substr($conf['hstart'], 2, 2)/15) ;
	define('HEND', substr($conf['hend'], 0, 2)*4+substr($conf['hend'], 2, 2)/15) ;
	$tab = array() ;
	foreach($_POST['inter'] as $inter)
	{
		list($tab[$inter]['nom']) = dbi_fetch_row(dbi_query("SELECT concat_ws(' ', inter_genre, inter_nom, inter_pnom) FROM ".TABLE_INTERV." WHERE inter_id = $inter")) ;
		$tab[$inter]['jours'] = array_fill(0, 7, array_fill(HSTART, HEND-HSTART, 0)) ;
		$dispo = dbi_query("SELECT * FROM ".TABLE_DISPO." WHERE inter_id=$inter AND agence_id=$agence order by dispo_hdeb") ;
		while ($d = dbi_fetch_row($dispo))
		{
			sscanf(sprintf("%06d", $d['dispo_Hdeb']), "%02d%02d00", $h, $m) ;
			$deb = $h*4+$m/15 ;
			for ($i = 0 ; $i < $d['dispo_Hduree']/15 && $deb+$i <= HEND; $i++)
				$tab[$inter]['jours'][$d['dispo_jour']][$deb+$i] = 1 ;
		}
		if(isset($_POST['dispo']) && $_POST['dispo'] == 2)
		{
			$presta = dbi_query("SELECT * FROM ".TABLE_PREST." WHERE inter_id=$inter AND agence_id=$agence AND ((presta_recur = '' AND presta_date_debut >= CURDATE()+0) OR (presta_recur = '1' AND (presta_date_fin is null or presta_date_fin >= curdate()+0)))") ;
			while($p = dbi_fetch_row($presta))
			{
				sscanf(sprintf("%06d", $p['presta_Hdeb']), "%02d%02d00", $h, $m) ;
				$deb = $h*4+$m/15 ;
				$jour = $p['presta_recur'] ? strpos($p['presta_jour'], 'y') : date('w', int2time($p['presta_date_debut'])) ;
				for ($i = 0 ; $i < $p['presta_Hduree']/15 && $deb+$i <= HEND ; $i++)
				{
					switch ($tab[$inter]['jours'][$jour][$deb+$i])
					{
						case 0 :	$tab[$inter]['jours'][$jour][$deb+$i] = ($p['presta_recur']+1)*2 ;
									break ;
						case 1 :	$tab[$inter]['jours'][$jour][$deb+$i] = ($p['presta_recur']+1)*2+1;
									break ;
						case 2 :
						case 3 :
						case 4 :
						case 5 :	$tab[$inter]['jours'][$jour][$deb+$i] = 6 ;
					}
				}
			}
			for ($i = 0 ; $i < 7 ; $i++)
				for ($j = HSTART ; $j < HEND ; $j++)
					if((in_array($tab[$inter]['jours'][$i][$j], array(4,5)) && !isset($_POST['rec'])) || (in_array($tab[$inter]['jours'][$i][$j], array(2,3)) && !isset($_POST['pon'])) || ($tab[$inter]['jours'][$i][$j] == 6 && !isset($_POST['rec']) && !isset($_POST['pon'])))
						$tab[$inter]['jours'][$i][$j] = 0 ;
		}
	}
?>
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="cal" align="left">
<?php
$heures = '	<tr class="tr_cal1">
		<th colspan="2">' ;
	for($i = HSTART ; $i < HEND ; $i++)
		if ($i%2 == 0)
			$heures .= sprintf('<th class="cal" colspan="2" nowrap style="font-size:9px">&nbsp;%02dh%02d&nbsp;</th>', intval($i/4), ($i%4)*15) ;
$heures .= '	</tr>' ;
?>
<?php
	$sem = array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi') ;

$colors = array(RIEN, DISPO, PONCT_HORS_DISPO, PONCT, RECUR_HORS_DISPO, RECUR, CHEVAUCHEMENT) ;
	switch($_POST['type'])
	{
		case 1 :
			$i = 0 ;
			foreach($tab as $int)
			{
				echo $heures ;
				printf('<tr><td rowspan="'.strlen($conf['jour']).'" class="td_cal%2$d">%1$s</td>', $int['nom'], $i%2) ;
				for($jour = 1 ; $jour <= 7 ; $jour++)
				{
					if(substr_count($conf['jour'], $jour%7))
					{
						$j = $int['jours'][$jour%7] ;
						printf('<td class="td_cal%2$d">%1$s</td>', $sem[$jour%7], $i%2) ; 
						foreach($j as $h)
							printf('<td '.($h ? 'style="background-color:#%1$s !important;" ' : '').'class="td_cal%2$d"></td>', $colors[$h], $i%2) ;
						echo "</tr><tr>" ;
						$i++;
					}
				}
				echo '</tr>' ;
			}
			break;
		case 2 :
			$i = 0 ;
			$j = 0 ;
			for($jour = 1 ; $jour <= 7 ; $jour++, $j++)
			{
				if(substr_count($conf['jour'], $jour%7))
				{
					echo $heures ;
					printf('<tr><td rowspan="%3$d" class="td_cal%2$d">%1$s</td>', $sem[$jour%7], $j%2, count($tab)) ;
					foreach($tab as $int)
					{
						printf('<td class="td_cal%2$d">%1$s</td>', $int['nom'], $i%2) ; 
						foreach($int['jours'][$jour%7] as $h)
							printf('<td '.($h ? 'style="background-color:#%1$s !important;" ' : '').'class="td_cal%2$d"></td>', $colors[$h], $i%2) ;
						echo "</tr><tr>" ;
						$i++;
					}
					echo '</tr>' ;
				}
			}
			break;
	}
	echo $heures ;
}
?>
</body>
</html>

AnonSec - 2021