Хранилища Subversion www_nix-files

Редакция

Редакция 9 | Редакция 14 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 9 Редакция 13
Строка 13... Строка 13...
13
    case 0:
13
    case 0:
14
        // table header
14
        // table header
15
        $nets =& $db->query("SELECT * FROM networks");
15
        $nets =& $db->query("SELECT * FROM networks");
16
        echo "<table>";
16
        echo "<table>";
17
        echo "<tr>";
17
        echo "<tr>";
18
        echo "<th>&nbsp;</th><th>&nbsp;</th><th>Ресурс</th>";
18
        echo "<th>&nbsp;</th><th>&nbsp;</th><th>Ресурс</th>\n";
19
       
19
       
20
        $netlist = array();
20
        $netlist = array();
21
        $netcount = $nets->numRows();
21
        $netcount = $nets->numRows();
22
        $n = 0;
22
        $n = 0;
23
        while ($nets->fetchInto($info_nets, DB_FETCHMODE_ASSOC)) {
23
        while ($nets->fetchInto($info_nets, DB_FETCHMODE_ASSOC)) {
24
            // network name & link
24
            // network name & link
25
            if ($info_nets['link']=="") { echo "<th>".$info_nets['network']."</th>"; }
25
            if ($info_nets['link']=="") { echo " <th>".$info_nets['network']."</th>\n"; }
26
            else { echo "<th><a href='".$info_nets['link']."'>".$info_nets['network']."</a></th>"; }
26
            else { echo " <th><a href='".$info_nets['link']."'>".$info_nets['network']."</a></th>\n"; }
27
            // netlist
27
            // netlist
28
            $netlist[$n] = $info_nets['id'];
28
            $netlist[$n] = $info_nets['id'];
29
            $n++;
29
            $n++;
30
        }
30
        }
31
       
31
       
32
        echo "</tr>";
32
        echo "</tr>\n";
33
        // table body
33
        // table body
34
        $cats =& $db->query("SELECT * FROM categories");
34
        $cats =& $db->query("SELECT * FROM categories");
35
        while ($cats->fetchInto($info_cats, DB_FETCHMODE_ASSOC)) {
35
        while ($cats->fetchInto($info_cats, DB_FETCHMODE_ASSOC)) {
36
            $res =& $db->query("SELECT * FROM resources WHERE category_id=".$info_cats['id']);
36
            $res =& $db->query("SELECT * FROM resources WHERE category_id=".$info_cats['id']);
37
            $first = true;
37
            $first = true;
38
            while ($res->fetchInto($info_res, DB_FETCHMODE_ASSOC)) {
38
            while ($res->fetchInto($info_res, DB_FETCHMODE_ASSOC)) {
39
                echo "<tr>";
39
                echo "<tr>\n";
40
               
40
               
41
                // add rowspan on first resource on category
41
                // add rowspan on first resource on category
42
                if ($first) {
42
                if ($first) {
43
                    echo "<td rowspan='".$res->numRows()."'>".$info_cats['category']."</td>";
43
                    echo " <td rowspan='".$res->numRows()."'>".$info_cats['category']."</td>\n";
44
                    $first = false;
44
                    $first = false;
45
                }
45
                }
46
               
46
               
47
                // resource picture
47
                // resource picture
48
                echo "<td><img src='".$info_res['picture']."' alt='".$info_res['resource']."'></td>";
48
                echo " <td><img src='".$info_res['picture']."' alt='".$info_res['resource']."'></td>\n";
49
               
49
               
50
                // resource name & link
50
                // resource name & link
51
                if ($info_res['link_talk']=="") { echo "<td>".$info_res['resource']."</td>"; }
51
                if ($info_res['link_talk']=="") { echo "<td>".$info_res['resource']."</td>"; }
52
                else { echo "<td><a href='".$info_res['link_talk']."'>".$info_res['resource']."</a></td>"; }
52
                else { echo " <td><a href='".$info_res['link_talk']."'>".$info_res['resource']."</a></td>\n"; }
53
               
53
               
54
                // resource state by network
54
                // resource state by network
55
                for ($i=0;$i<$netcount;$i++) {
55
                for ($i=0;$i<$netcount;$i++) {
56
                    $curstate =& $db->getOne("SELECT state_id FROM res_net_stat WHERE resource_id=".$info_res['id']." AND network_id=".$netlist[$i]);
56
                    $curstate =& $db->getOne("SELECT state_id FROM res_net_stat WHERE resource_id=".$info_res['id']." AND network_id=".$netlist[$i]);
57
                    $curimg = "./img/state/unknown.png";
57
                    $curimg = "./img/state/unknown.png";
58
                    if ($curstate == null) {
58
                    if ($curstate == null) {
59
                        echo "<td>&mdash;</td>";
59
                        echo " <td>&mdash;</td>\n";
60
                    }
60
                    }
61
                    else {
61
                    else {
62
                        // !replace in future!
62
                        // !replace in future!
63
                        switch ($curstate) {
63
                        switch ($curstate) {
64
                            case '1':
64
                            case '1':
Строка 72... Строка 72...
72
                            break;
72
                            break;
73
                            case '4':
73
                            case '4':
74
                                $curimg = "./img/state/freeze.png";
74
                                $curimg = "./img/state/freeze.png";
75
                            break;
75
                            break;
76
                        }
76
                        }
77
                        echo "<td><a href='".$info_res['link_res']."'><img src='".$curimg."' alt='nop'></a></td>";
77
                        echo " <td><a href='".$info_res['link_res']."'><img src='".$curimg."' alt='nop'></a></td>\n";
78
                    }
78
                    }
79
                }
79
                }
80
                echo "</tr>";
80
                echo "</tr>\n";
81
            }
81
            }
82
        }
82
        }
83
        // table footer
83
        // table footer
84
        echo "</table>";
84
        echo "</table>";
85
        include "./inc/legend.htm";
85
        include "./inc/legend.htm";