network.php 1.39 KB
<?php
session_start();
include("head.php");
include("header.php");
require_once("accesBase.php");
$capteurs = getSensors();
$raspberrys = getRaspberrys();
?>
<div class="row">
	<div class="col-4 col-md-4 offset-md-4 offset-4">
	<br/>
		<h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fas fa-network-wired"></i> Le réseau</h1>
		<?php
		foreach($raspberrys as $raspberry)
		{
			$ip = $raspberry['ip'];
			?>
			<table class="table table-striped table-hover">
				<thead class="thead-dark">
					<th width="15%"><img src="img/pi.png" alt="Raspberry" style="width:auto; height:50px;"></th>
					<th width="85%" colspan="3"><p style="font-size: 14px;"><?php echo $ip;?></p></th>
				</thead>
				<tbody>
					<?php
					foreach($capteurs as $capteur)
					{
						if($capteur['raspberry'] != $ip) { continue; }
						?>
						<tr>
							<?php
							if(strcmp($capteur['type'], "Température") == 0)
							{
								$source = "img/temperature.png";
							}
							else if(strcmp($capteur['type'], "Distance") == 0)
							{
								$source = "img/pi.png";
							}
							?>
							<td><img src="<?php echo $source;?>" alt="Capteur" style="width:auto; height:50px;"></td>
							<?php
							
							?>
							<td>ok</td>
							<td>ok</td>
							<td>ok</td>
						</tr>
						<?php
					}
					?>
				</tbody>
			</table>
			<?php
		}
		?>
	</div>
</div>