DOCTYPE HTML html head meta charset utf-8 title Заявления ОГ title hea

 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
<!DOCTYPE HTML><html><head><meta charset="utf-8"><title>Заявления в ОГ</title></head><body><?php
$dir = './claim';
$month = array(1 => "Январь", 2 => "Февраль", 3 => "Март", 4 => "Апрель", 5 => "Май", 6 => "Июнь", 7 => "Июль", 8 => "Август", 9 => "Сентябрь", 10 => "Октябрь", 11 => "Ноябрь", 12 => "Декабрь");
function check($var) {
return ($var != '.' && $var != '..');
}
foreach (array_filter(scandir($dir), 'check') as $mon)
foreach (array_filter(scandir($dir.'/'.$mon), 'check') as $photo) {
$photo = explode('_', $photo);
$all[$mon][$photo[0]][$photo[1]][] = $photo[2];
}
foreach ($all as $mon => $var1) {
echo '<table width="400px" border="1" cellspacing="0"><tr><th colspan="3">'.$month[$mon].'</th></tr><tr><th>День</th><th>Заказ</th><th>Фото</th></tr>';
foreach ($var1 as $day => $var2) {
$row = '';
$rowspan = 0;
foreach ($var2 as $order => $var3) {
if ($rowspan > 0) $row .= '<tr>';
$row .= '<td>'.$order.'</td><td>';
foreach ($var3 as $i => $link)
$row .= ' <a href="'.$dir.'/'.$mon.'/'.$day.'_'.$order.'_'.$link.'">['.($i+1).']</a>';
$row .= '</td></tr>';
$rowspan++;
}
echo '<tr><td';
if ($rowspan > 1) echo ' rowspan="'.$rowspan.'"';
echo '>'.$day.'</td>'.$row;
}
echo '</table><br>';
}
?><p><b>NB!</b> [1] - первым всегда чек</p></body></html>