Skip to content

Instantly share code, notes, and snippets.

@amirmojiry
Created July 12, 2020 05:56
Show Gist options
  • Save amirmojiry/a74aec4cc14b82309913fc6a98edf897 to your computer and use it in GitHub Desktop.
Save amirmojiry/a74aec4cc14b82309913fc6a98edf897 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Methods Time Table
</title>
<style>
table, td {
border: 1px solid black;
}
table {
border-collapse: collapse;
}
td {
width: 1px;
height: 10px;
margin-bottom: 1em;
}
tr {
border: 2px;
}
table {
margin-bottom: 20px;
}
<?php
$data_file = fopen("data.csv", "r");
while( ($data_line = fgetcsv($data_file)) !== FALSE) {
$time = $data_line[1];
$method1_color = "#FF00FF"; //صورتی
$method2_color = "#AFEEEE"; //فیروزه ای
$method3_color = "#000000"; //سیاه
$method_type = $data_line[0];
if ($method_type == 1) {
$color = $method1_color;
}
elseif ($method_type == 2) {
$color = $method2_color;
}
elseif ($method_type == 3) {
$color = $method3_color;
}
echo "#td-$time {
background-color: $color;
}";
}
?>
</style>
</head>
<body>
<?php
for($i=0; $i<=5000; $i+=500) {
$min_i = $i;
$max_i = $i+500;
echo "
<div>
<span style='float: left'>$min_i</span>
<span style='float: right'>$max_i</span>
</div>";
echo "<table><tr>";
for ($j=$i; $j < $i+500; $j++) {
echo "<td id='td-$j'></td>";
}
echo "</tr></table>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment