Exemplo n.º 1
0
function renderFlatIP()
{
    if (isset($_REQUEST['attr_id']) && isset($_REQUEST['attr_value'])) {
        $params = array('attr_id' => $_REQUEST['attr_id'], 'attr_value' => $_REQUEST['attr_value']);
        $av = $_REQUEST['attr_value'];
        if ($av === 'NULL') {
            $av = NULL;
        }
        $nets = fetchNetworksByAttr($_REQUEST['attr_id'], $av, TRUE);
    } else {
        $params = array();
        $nets = array_merge(listCells('ipv4net'), listCells('ipv6net'));
    }
    $cf = getCellFilter();
    $nets = filterCellList($nets, $cf['expression']);
    echo "<table border=0 class=objectview>\n";
    echo "<tr><td class=pcleft>";
    startPortlet(sprintf("Networks (%d)", count($nets)));
    echo '<ol>';
    foreach ($nets as $network) {
        echo '<li>';
        renderCell($network);
        echo '</li>';
    }
    echo '</ol>';
    finishPortlet();
    echo '</td><td class=pcright>';
    renderCellFilterPortlet($cf, 'ipv4net', $nets, $params);
    echo '</td></tr></table>';
}
Exemplo n.º 2
0
function renderCellList($realm = NULL, $title = 'items', $do_amplify = FALSE, $celllist = NULL)
{
    if ($realm === NULL) {
        global $pageno;
        $realm = $pageno;
    }
    global $nextorder;
    $order = 'odd';
    $cellfilter = getCellFilter();
    if (!isset($celllist)) {
        $celllist = applyCellFilter($realm, $cellfilter);
    } else {
        $celllist = filterCellList($celllist, $cellfilter['expression']);
    }
    echo "<table border=0 class=objectview>\n";
    echo "<tr><td class=pcleft>";
    if ($realm != 'file' || !renderEmptyResults($cellfilter, 'files', count($celllist))) {
        if ($do_amplify) {
            array_walk($celllist, 'amplifyCell');
        }
        startPortlet($title . ' (' . count($celllist) . ')');
        echo "<table class=cooltable border=0 cellpadding=5 cellspacing=0 align=center>\n";
        foreach ($celllist as $cell) {
            echo "<tr class=row_{$order}><td>";
            renderCell($cell);
            echo "</td></tr>\n";
            $order = $nextorder[$order];
        }
        echo '</table>';
        finishPortlet();
    }
    echo '</td><td class=pcright>';
    renderCellFilterPortlet($cellfilter, $realm, $celllist);
    echo "</td></tr></table>\n";
}