<?php
if($resavisu['valeur']=='1') { 
	$nbres = mysqli_num_rows(mysqli_query($bdd,"SELECT freqres_id FROM ".$prefix."_freqres WHERE code_freqres = '".$jouraffvisu.$plage_horname[$h]."' AND espace_id = '".$espid."' AND statut = '0'"));		
	$quonb = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT hor_resa, quota_resa FROM ".$prefix."_horaires WHERE hor_name = '".$plage_horname[$h]."'"));
	if($freq_gestion_jourscren['valeur']=='0') {
		if(substr($quonb['hor_resa'],0,3)=='000'||@$tabevent_info['close']=='1'||($individu==1&&$classe==1&&$nodiv['valeur']==0)) {
			$titlres = FREQ_CREN2;
		}
		else {
			if(substr($quonb['quota_resa'],0,3)=='000') {
				$titlres = RESA6.DOTS.' '.$nbres.'/∞';
			}
			else {
				$titlres = RESA6.DOTS.' '.$nbres.'/'.ltrim(substr($quonb['quota_resa'],0,3), '0');
			}
		}
	}
	else {
		if (preg_match('/' . $jouraffvisuD . '(\d{3})/', $quonb['quota_resa'], $matches)) {
		    $extract = $matches[1];
		}
		if (preg_match('/' . $jouraffvisuD . '(\d{3})/', $quonb['hor_resa'], $matches)) {
		    $extract_hor = $matches[1];
		}
		if($extract_hor=='000'||@$tabevent_info['close']=='1'||($individu==1&&$classe==1&&$nodiv['valeur']==0)) {
			$titlres = FREQ_CREN2;
		}
		else {
			if($extract=='000') {
				$titlres = RESA6.DOTS.' '.$nbres.'/∞';
			}
			else {
				$titlres = RESA6.DOTS.' '.$nbres.'/'.ltrim($extract, '0');
			}
		}
	}
	$edt_cell .= ' title="'.$titlres.'"'; 
}
?>