当前位置: 首页>>代码示例>>PHP>>正文


PHP makeHref函数代码示例

本文整理汇总了PHP中makeHref函数的典型用法代码示例。如果您正苦于以下问题:PHP makeHref函数的具体用法?PHP makeHref怎么用?PHP makeHref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了makeHref函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CableIDTabHandler

function CableIDTabHandler()
{
    echo '<div class=portlet><h2>Cable ID Helper</h2></div>';
    $rack = spotEntity('rack', $_REQUEST['rack_id']);
    $result = usePreparedSelectBlade('SELECT DISTINCT object_id FROM RackSpace WHERE rack_id = ? ', array($rack['id']));
    $objects = $result->fetchAll(PDO::FETCH_ASSOC);
    $cableIDs = array();
    foreach ($objects as $object) {
        $pals = getObjectPortsAndLinks($object['object_id']);
        foreach ($pals as $portLink) {
            if ($portLink['cableid']) {
                $new = true;
                $dublicate = false;
                foreach ($cableIDs as $key => $cableID) {
                    if ($portLink['object_id'] == $cableID['object1_id'] && $portLink['name'] == $cableID['object1_port'] || $portLink['object_id'] == $cableID['object2_id'] && $portLink['name'] == $cableID['object2_port']) {
                        $new = false;
                        // Link already in List
                    }
                    // Check for duplicate cable ids
                    if ($new && $portLink['cableid'] == $cableID['cableID']) {
                        $dublicate = true;
                        $cableIDs[$key]['dublicate'] = true;
                    }
                }
                if ($new) {
                    $cableID = array();
                    $cableID['cableID'] = $portLink['cableid'];
                    $cableID['object1_id'] = $portLink['object_id'];
                    $cableID['object1_name'] = $portLink['object_name'];
                    $cableID['object1_port'] = $portLink['name'];
                    $cableID['object2_id'] = $portLink['remote_object_id'];
                    $cableID['object2_name'] = $portLink['remote_object_name'];
                    $cableID['object2_port'] = $portLink['remote_name'];
                    $cableID['dublicate'] = $dublicate;
                    array_push($cableIDs, $cableID);
                }
            }
        }
    }
    // Sort by cableIDs
    usort($cableIDs, function ($elem1, $elem2) {
        return strnatcasecmp($elem1['cableID'], $elem2['cableID']);
    });
    // Print table
    echo '<table class="cooltable" align="center" border="0" cellpadding="5" cellspacing="0">' . '<tbody>' . '  <tr>' . '  <th>CableID</th>' . '  <th>Object 1</th>' . '  <th>Object 2</th>' . '  </tr>';
    $i = 0;
    foreach ($cableIDs as $cableID) {
        if ($i % 2) {
            $class = 'row_even tdleft';
        } else {
            $class = 'row_odd tdleft';
        }
        if ($cableID['dublicate']) {
            $class .= ' trerror';
        }
        echo '<tr class="' . $class . '">' . '<td>' . $cableID['cableID'] . '</td>' . '<td><a href="' . makeHref(array('page' => 'object', 'object_id' => $cableID['object1_id'])) . '">' . $cableID['object1_name'] . ': ' . $cableID['object1_port'] . '</a></td>' . '<td><a href="' . makeHref(array('page' => 'object', 'object_id' => $cableID['object2_id'])) . '">' . $cableID['object2_name'] . ': ' . $cableID['object2_port'] . '</a></td>' . '</tr>';
        $i++;
    }
    echo '  </tbody>' . '</table>';
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:60,代码来源:cableIDHelper.php

示例2: formatVSIP

function formatVSIP($vip, $plain_text = FALSE)
{
    $fmt_ip = ip_format($vip['vip']);
    if ($plain_text) {
        return $fmt_ip;
    }
    $ret = '<a href="' . makeHref(array('page' => 'ipaddress', 'ip' => $fmt_ip)) . '">' . $fmt_ip . '</a>';
    return $ret;
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:9,代码来源:slb2-interface.php

示例3: getPatchCableHeapCursorCode

function getPatchCableHeapCursorCode($heap, $zoom_heap_id)
{
    global $pageno, $tabno;
    if ($heap['logc'] == 0) {
        return '&nbsp;';
    }
    $linkparams = array('page' => $pageno, 'tab' => $tabno);
    if ($heap['id'] == $zoom_heap_id) {
        $imagename = 'Zooming';
        $imagetext = 'hide event log';
    } else {
        $imagename = 'Zoom';
        $imagetext = 'display event log';
        $linkparams['zoom_heap_id'] = $heap['id'];
    }
    return '<a href="' . makeHref($linkparams) . '">' . getImageHREF($imagename, $imagetext) . '</a>';
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:17,代码来源:interface-cables.php

示例4: snmplive_tabhandler

function snmplive_tabhandler($object_id)
{
    addCSS(<<<ENDCSS
        .ifoperstatus-default { background-color:#ddd; }
        .ifoperstatus-1, .ifoperstatus-up { background-color:#00ff00; }
        .ifoperstatus-2, .ifoperstatus-down { background-color:#ff0000; }
        .ifoperstatus-3, .ifoperstatus-testing { background-color:#ffff66; }
        .ifoperstatus-4, .ifoperstatus-unknown { background-color:#ffffff; }
        .ifoperstatus-5, .ifoperstatus-dormant { background-color:#90bcf5; }
        .ifoperstatus-6, .ifoperstatus-notPresent { }
        .ifoperstatus-7, .ifoperstatus-lowerLayerDown { }

        .port-groups { border-spacing:1px;display:table; }
        .port-group { display:table-cell;border:3px solid #000;background-color:#c0c0c0; }

        .port-column { display:table-cell;position:relative; }

        .port { position:relative;width:42px;height:100px;border:2px solid #000;overflow:hidden; }
        .port-pos-1 { margin-bottom:1px; }
        .port-pos-2 { }
        .port-pos-0 { margin-top:1px; }

        .port-header { position:absolute }
        .port-header-pos-1 { top:0px; }
        .port-header-pos-0 { bottom:0px; }

        .port-status { position:absolute;min-width:42px;text-align:center;font-size:10pt; }

        .port-status-pos-1 { top:35px; }
        .port-status-pos-0 { bottom:35px; }

        .port-info { position:absolute;width:90%;background-color:#ddd;overflow:hidden; }
        .port-info-pos-1 { top: 80px; }
        .port-info-pos-0 { bottom: 80px;}

        .port-name {  font-size:10pt;margin:0px auto;width:40px;text-align:center; }
        .port-number { font-size:8pt;color:#eee; }

        .port-detail { position:fixed;z-index:1000;top:0px;right:0px;border:3px solid #000;background-color:#fff }
        .port-detail-links { background-color:#ccc }
        .hidden { visibility:hidden; }
        .info-footer { }

ENDCSS
, TRUE);
    echo "<div id=\"info\"></div>";
    if (isset($_GET['debug'])) {
        $debug = $_GET['debug'];
    } else {
        $debug = 0;
    }
    $object = spotEntity('object', $object_id);
    amplifyCell($object);
    if (isset($_GET['modules'])) {
        $modules = $_GET['modules'];
    } else {
        $modules = false;
    }
    if ($modules) {
        unset($_GET['modules']);
    } else {
        $_GET['modules'] = 1;
    }
    echo "<a href=" . makeHref($_GET) . ">" . ($modules ? "Hide" : "Show") . " Modules</a>";
    pl_layout_default($object, 0, false, $modules);
    addJS(<<<ENDJS
       function togglevisibility(elem, hide)
        {
                if(hide)
                        elem.css('visibility', 'hidden');
                else
                        elem.css('visibility', 'visible');
                //a.show();
                //a.hide();
        }

       function setdetail(elem, hide)
        {
                var a = \$( "#port" + elem.id + "-detail");

                togglevisibility(a, hide);
        }

         function setports( data, textStatus, jqHXR ) {
                if(data.debug)
                        \$( "#info" ).html(\$( "#info" ).html() + "DEBUG: " + data.name + ": " + data.debug);

                for(var index in data.ports)
                {
                        setport(data, data.ports[index]);
                }
         }

        function setportstatus( obj, port , id , detail)
        {

                tagidsuffix = "";

                if(detail)
                        tagidsuffix = tagidsuffix + "-detail";
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:snmplive.php

示例5: menu

 function menu($less, $more)
 {
     echo '<span class="nav-menu">';
     $prev = $this->query;
     $prev['page'] = $this->page - 1;
     if ($less == true) {
         echo '<a ' . makeHref($prev) . '>Prev Page</a>';
     }
     if ($less && $more) {
         echo '&nbsp;|&nbsp;';
     }
     $next = $this->query;
     $next['page'] = $this->page + 1;
     if ($more == true) {
         echo '<a ' . makeHref($next) . '>Next Page</a>';
     }
     echo '</span>';
 }
开发者ID:environmentalinformatics-marburg,项目名称:cvs,代码行数:18,代码来源:bibtexbrowser.php

示例6: getConfiguredQuickLinks

function getConfiguredQuickLinks()
{
    $ret = array();
    foreach (explode(',', getConfigVar('QUICK_LINK_PAGES')) as $page_code) {
        if (!empty($page_code)) {
            $title = getPageName($page_code);
            if (!empty($title)) {
                $ret[] = array('href' => makeHref(array('page' => $page_code)), 'title' => $title);
            }
        }
    }
    return $ret;
}
开发者ID:rhysm,项目名称:racktables,代码行数:13,代码来源:database.php

示例7: renderVMReport


//.........这里部分代码省略.........
            }
            foreach ($aRow['ipV6List'] as $key => $aDetails) {
                if (function_exists('ip6_format')) {
                    $key = ip6_format($key);
                }
                if (trim($key) != '') {
                    $aCSVRow[2] .= $key . ' ';
                }
            }
            $aCSVRow[2] = trim($aCSVRow[2]);
            $aCSVRow[3] = str_replace('&quot;', "'", $aRow['sComment']);
            $aCSVRow[4] = $aRow['sContact'];
            $aCSVRow[5] = $aRow['sOS'];
            $aCSVRow[6] = '';
            foreach ($aRow['container'] as $key => $aDetails) {
                $aCSVRow[6] .= trim($aDetails['container_name']) . ' ';
            }
            $aCSVRow[6] = trim($aCSVRow[6]);
            fputcsv($outstream, $aCSVRow);
        }
        fclose($outstream);
        exit(0);
        # Exit normally after send CSV to browser
    }
    // Load stylesheet and jquery scripts
    addCSS('css/extensions/style.css');
    addJS('js/extensions/jquery-latest.js');
    addJS('js/extensions/jquery.tablesorter.js');
    addJS('js/extensions/picnet.table.filter.min.js');
    // Display the stat array
    echo "<h2>Virtual machines report ({$iTotal})</h2><ul>";
    echo '<a href="index.php?page=reports&tab=vm&csv">CSV Export</a>';
    echo '<table id="reportTable" class="tablesorter">
            <thead>
              <tr>
                <th>Name</th>
                <th>MAC</th>
                <th>IP(s)</th>
                <th>Comment</th>
                <th>Contact</th>
                <th>OS</th>
                <th>Hypervisor</th>
               </tr>
             </thead>
           <tbody>';
    foreach ($aResult as $id => $aRow) {
        echo '<tr>
                <td><a href="' . makeHref(array('page' => 'object', 'object_id' => $id)) . '">' . $aRow['sName'] . '</a></td>
                <td>';
        foreach ($aRow['ports'] as $portNumber => $aPortDetails) {
            if (trim($aPortDetails['l2address']) != '') {
                echo $aPortDetails['l2address'] . '<br/>';
            }
        }
        echo '  </td>' . '  <td>';
        foreach ($aRow['ipV4List'] as $key => $aDetails) {
            if (function_exists('ip4_format')) {
                $key = ip4_format($key);
            }
            if (trim($key) != '') {
                echo $key . '<br/>';
            }
        }
        foreach ($aRow['ipV6List'] as $key => $aDetails) {
            if (function_exists('ip6_format')) {
                $key = ip6_format($key);
            } else {
                $key = new IPv6Address($key);
            }
            if (trim($key) != '') {
                echo $key . '<br/>';
            }
        }
        echo '  </td>
                <td>' . $aRow['sComment'] . '</td>
                <td>' . $aRow['sContact'] . '</td>
                <td>' . $aRow['sOS'] . '</td>
                <td>';
        foreach ($aRow['container'] as $key => $aDetails) {
            echo '<a href="' . makeHref(array('page' => 'object', 'object_id' => $key)) . '">' . $aDetails['container_name'] . '</a><br/>';
        }
        echo '</td>
              </tr>';
    }
    echo '  </tbody>
          </table>';
    echo '<script type="text/javascript">
            $(document).ready(function()
              {
                $.tablesorter.defaults.widgets = ["zebra"];
                $("#reportTable").tablesorter(
                    { headers: {
                      2: { sorter: "ipAddress" }
                    }, sortList: [[0,0]] }
                );
                $("#reportTable").tableFilter();
              }
            );
          </script>';
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:vm-report.php

示例8: formatAttributeValue

function formatAttributeValue($record)
{
    if ('date' == $record['type']) {
        return datetimestrFromTimestamp($record['value']);
    }
    if (!isset($record['key'])) {
        if ($record['id'] == 3) {
            // FQDN attribute
            foreach (getMgmtProtosConfig() as $proto => $filter) {
                try {
                    if (considerGivenConstraint(NULL, $filter)) {
                        $blank = preg_match('/^https?$/', $proto) ? 'target=_blank' : '';
                        return "<a {$blank} title='Open {$proto} session' class='mgmt-link' href='" . $proto . '://' . $record['a_value'] . "'>{$record['a_value']}</a>";
                    }
                } catch (RackTablesError $e) {
                    // syntax error in $filter
                    continue;
                }
            }
        }
        return isset($record['href']) ? "<a href=\"" . $record['href'] . "\">{$record['a_value']}</a>" : $record['a_value'];
    }
    $href = makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cfe' => '{$attr_' . $record['id'] . '_' . $record['key'] . '}'));
    $result = "<a href='{$href}'>" . $record['a_value'] . "</a>";
    if (isset($record['href'])) {
        $result .= "&nbsp;<a class='img-link' href='{$record['href']}'>" . getImageHREF('html', 'vendor&apos;s info page') . "</a>";
    }
    return $result;
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:29,代码来源:interface.php

示例9: ImportTab

function ImportTab()
{
    global $nextorder;
    global $Version;
    global $taglist;
    ?>

  <style type='text/css'>
  tr.has_problems 
  {
    background-color: #ffa0a0;
  }
  </style>

  <!--Legend-->
  <table align=right>
  <tr class=trerror><td colspan=2>Unknown object</td></tr>
  <tr><td class=row_even>Existing </td><td class=row_odd> object</td></tr>
  </table>

  <center><h1>Import yaml objects </h1><h2>from /yamls/</h2></center>
<?php 
    startPortlet();
    echo "<table with=90% align=center border=0 cellpadding=5 cellspacing=0 align=center class=cooltable><tr valign=top>";
    echo "<form method=post name=ImportObject action='?module=redirect&page=depot&tab=yaml_import&op=RunImport'>";
    echo "<tr valign=top><th>Assign tags</th><th align=center>Name</th><th align=center>Import ?</th></tr>";
    // taglist on display - left handed
    echo "<tr valign=top><td rowspan=\"0\">";
    renderNewEntityTags('object');
    echo "</td></tr>";
    $order = 'odd';
    # Find and read loop through all .yaml files in the yaml directory.
    //  if ($handle = opendir('./yamls/'))
    if ($files = scandir('./yamls/')) {
        //    while (false !== ($file = readdir($handle)))
        foreach ($files as $file) {
            # Since puppet names the files $FQDN.yaml, we don't have to inspect the file during the first run.
            if (preg_match('/\\.yaml/', $file)) {
                $name = preg_replace('/\\.yaml/', '', $file);
                # Do a search on the row 'name' passing the one name, and retrieving the ID.
                $object = getSearchResultByField('RackObject', array('id'), 'name', $name, '', 2);
                if ($object) {
                    $url = makeHref(array('page' => 'object', 'tab' => 'default', 'object_id' => $object[0]['id']));
                    echo "<tr class=row_{$order}><td align=left><a href=\"{$url}\">" . $name . "</a></td>\n";
                } else {
                    echo "<tr class=trerror><td align=left>" . $name . "</td>\n";
                }
                echo "<td align=center> <input type=checkbox name=objectname[] value={$name}></td></tr>\n";
                $order = $nextorder[$order];
            }
        }
    }
    // tags ?
    //  echo "<tr><td rowspan=\"0\">";
    //  renderNewEntityTags('object');
    //  echo "</td></tr>";
    echo "<tr><td align=left><font size=1em color=gray>version {$Version}</font></td><td align=right><input type=submit name=got_very_fast_data value='Import selected items'></td><td></td></tr></table></td></tr>";
    echo "</form>";
    echo "</table>";
    finishPortlet();
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:61,代码来源:yaml_import.php

示例10: PingTab

function PingTab($id)
{
    $pingtimeout = "50";
    if (isset($_REQUEST['pg'])) {
        $page = $_REQUEST['pg'];
    } else {
        $page = 0;
    }
    global $pageno, $tabno;
    $maxperpage = getConfigVar('IPV4_ADDRS_PER_PAGE');
    $range = spotEntity('ipv4net', $id);
    loadIPAddrList($range);
    echo "<center><h1>{$range['ip']}/{$range['mask']}</h1><h2>{$range['name']}</h2></center>\n";
    echo "<table class=objview border=0 width='100%'><tr><td class=pcleft>";
    startPortlet('icmp ping comparrison:');
    $startip = ip4_bin2int($range['ip_bin']);
    $endip = ip4_bin2int(ip_last($range));
    $realstartip = $startip;
    $realendip = $endip;
    $numpages = 0;
    if ($endip - $startip > $maxperpage) {
        $numpages = ($endip - $startip) / $maxperpage;
        $startip = $startip + $page * $maxperpage;
        $endip = $startip + $maxperpage - 1;
    }
    echo "<center>";
    if ($numpages) {
        echo '<h3>' . ip4_format(ip4_int2bin($startip)) . ' ~ ' . ip4_format(ip4_int2bin($endip)) . '</h3>';
    }
    for ($i = 0; $i < $numpages; $i++) {
        if ($i == $page) {
            echo "<b>{$i}</b> ";
        } else {
            echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $id, 'pg' => $i)) . "'>{$i}</a> ";
        }
    }
    echo "</center>";
    echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n";
    echo "<tr><th>address</th><th>name</th><th>response</th></tr>\n";
    $idx = 1;
    $box_counter = 1;
    $cnt_ok = $cnt_noreply = $cnt_mismatch = 0;
    for ($ip = $startip; $ip <= $endip; $ip++) {
        $ip_bin = ip4_int2bin($ip);
        $addr = isset($range['addrlist'][$ip_bin]) ? $range['addrlist'][$ip_bin] : array('name' => '', 'reserved' => 'no');
        $straddr = ip4_format($ip_bin);
        system("/usr/sbin/fping -q -c 1 -t {$pingtimeout} {$straddr}", $pingreply);
        // FIXME: This is a huge and ugly IF/ELSE block. Prettify anyone?
        if (!$pingreply) {
            if (!empty($addr['name']) and $addr['reserved'] == 'no' or !empty($addr['allocs'])) {
                echo '<tr class=trok';
                $cnt_ok++;
            } else {
                echo $addr['reserved'] == 'yes' ? '<tr class=trwarning' : '<tr class=trerror';
                $cnt_mismatch++;
            }
        } else {
            if (!empty($addr['name']) and $addr['reserved'] == 'no' or !empty($addr['allocs'])) {
                echo '<tr class=trwarning';
                $cnt_noreply++;
            } else {
                echo '<tr';
            }
        }
        echo "><td class='tdleft";
        if (isset($range['addrlist'][$ip_bin]['class']) and strlen($range['addrlist'][$ip_bin]['class'])) {
            echo ' ' . $range['addrlist'][$ip_bin]['class'];
        }
        echo "'><a href='" . makeHref(array('page' => 'ipaddress', 'ip' => $straddr)) . "'>{$straddr}</a></td>";
        echo "<td class=tdleft>{$addr['name']}</td><td class=tderror>";
        if (!$pingreply) {
            echo "Yes";
        } else {
            echo "No";
        }
        echo "</td></tr>\n";
        $idx++;
    }
    echo "</td></tr>";
    echo "</table>";
    echo "</form>";
    finishPortlet();
    echo "</td><td class=pcright>";
    startPortlet('stats');
    echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
    echo "<tr class=trok><th class=tdright>OKs:</th><td class=tdleft>{$cnt_ok}</td></tr>\n";
    echo "<tr class=trwarning><th class=tdright>Did not reply:</th><td class=tdleft>{$cnt_noreply}</td></tr>\n";
    if ($cnt_mismatch) {
        echo "<tr class=trerror><th class=tdright>Unallocated answer:</th><td class=tdleft>{$cnt_mismatch}</td></tr>\n";
    }
    echo "</table>\n";
    finishPortlet();
    echo "</td></tr></table>\n";
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:94,代码来源:ping.php

示例11: formatVLANName

function formatVLANName($vlaninfo, $context = 'markup long')
{
    switch ($context) {
        case 'option':
            $ret = $vlaninfo['vlan_id'];
            if ($vlaninfo['vlan_descr'] != '') {
                $ret .= ' ' . niftyString($vlaninfo['vlan_descr']);
            }
            return $ret;
        case 'label':
            $ret = $vlaninfo['vlan_id'];
            if ($vlaninfo['vlan_descr'] != '') {
                $ret .= ' <i>(' . niftyString($vlaninfo['vlan_descr']) . ')</i>';
            }
            return $ret;
        case 'plain long':
            $ret = 'VLAN' . $vlaninfo['vlan_id'];
            if ($vlaninfo['vlan_descr'] != '') {
                $ret .= ' (' . niftyString($vlaninfo['vlan_descr'], 20, FALSE) . ')';
            }
            return $ret;
        case 'hyperlink':
            $ret = '<a href="';
            $ret .= makeHref(array('page' => 'vlan', 'vlan_ck' => $vlaninfo['domain_id'] . '-' . $vlaninfo['vlan_id']));
            $ret .= '">' . formatVLANName($vlaninfo, 'markup long') . '</a>';
            return $ret;
        case 'markup long':
        default:
            $ret = 'VLAN' . $vlaninfo['vlan_id'];
            $ret .= ' @' . niftyString($vlaninfo['domain_descr']);
            if ($vlaninfo['vlan_descr'] != '') {
                $ret .= ' <i>(' . niftyString($vlaninfo['vlan_descr']) . ')</i>';
            }
            return $ret;
    }
}
开发者ID:rhysm,项目名称:racktables,代码行数:36,代码来源:functions.php

示例12: getWattsPerRow

function getWattsPerRow()
{
    // assertions
    // find the needed attributes
    global $nextorder;
    // Was this function called with a specific row_id?
    if (isset($_REQUEST['row_id'])) {
        assertStringArg('row_id');
        $row_toshow = $_REQUEST['row_id'];
    } else {
        $row_toshow = -1;
    }
    //from renderRackspace(), interface.php:151
    $found_racks = array();
    $rows = array();
    $cellfilter = getCellFilter();
    $rackCount = 0;
    $order = 'odd';
    // get rackspace information
    foreach (getAllRows() as $row_id => $rowInfo) {
        $rackList = filterCellList(listCells('rack', $row_id), $cellfilter['expression']);
        $found_racks = array_merge($found_racks, $rackList);
        $rows[] = array('location_id' => $rowInfo['location_id'], 'location_name' => $rowInfo['location_name'], 'row_id' => $row_id, 'row_name' => $rowInfo['name'], 'racks' => $rackList);
        $rackCount += count($rackList);
    }
    // Main layout starts.
    echo "<table border=0 class=objectview cellspacing=0 cellpadding=0>";
    // Left portlet with list of rows.
    echo "<tr><td class=pcleft width='50%'>";
    startPortlet('Rack Rows (' . count($rows) . ')');
    echo "<table border=0 cellspacing=0 cellpadding=3 width='100%'>\n";
    foreach ($rows as $row) {
        $row_id = $row['row_id'];
        $row_name = $row['row_name'];
        $row_location = $row['location_name'];
        $rackList = $row['racks'];
        echo "<tr class=row_{$order}><td width='20%'></td><td class=tdleft>";
        if (!count($rackList)) {
            echo "{$row_location} - {$row_name} (empty row)";
        } else {
            echo "<a href='" . makeHref(array('page' => 'reports', 'tab' => 'watts_per_row', 'row_id' => $row_id)) . "'>{$row_location} - {$row_name}</a>";
        }
        echo "<td><tr>\n";
        $order = $nextorder[$order];
    }
    echo "</td></tr>\n";
    echo "</table><br>\n";
    finishPortlet();
    echo "</td><td class=pcright>";
    // Right Portlet: Draw the racks in the selected row
    if ($row_toshow > -1) {
        $rowInfo = getRowInfo($row_toshow);
        $cellfilter = getCellFilter();
        $rackList = filterCellList(listCells('rack', $row_toshow), $cellfilter['expression']);
        $rackwidth = getRackImageWidth() * getConfigVar('ROW_SCALE');
        // Maximum number of racks per row is proportionally less, but at least 1.
        $maxPerRow = max(floor(getConfigVar('RACKS_PER_ROW') / getConfigVar('ROW_SCALE')), 1);
        $rackListIdx = 0;
        $rowTotalWattage = 0;
        $order = 'odd';
        startPortlet('Racks within ' . $rowInfo['name'] . ' (' . count($rackList) . ')');
        echo "<table border=0 cellspacing=5 align='center'><tr>";
        foreach ($rackList as $rack) {
            $rackTotalWattage = 0;
            // see renderRack(), interface.php:311
            $rackData = spotEntity('rack', $rack['id']);
            amplifyCell($rackData);
            $objectChildren = getEntityRelatives('children', 'object', $objectData['id']);
            foreach ($rackData['mountedObjects'] as $object) {
                $objectData = spotEntity('object', $object);
                amplifyCell($objectData);
                foreach (getAttrValues($objectData['id']) as $record) {
                    if ($record['name'] == 'Wattage consumption') {
                        $rackTotalWattage += $record['value'];
                    }
                }
            }
            if ($rackListIdx % $maxPerRow == 0) {
                echo $rackListIdx > 0 ? '</tr><tr>' : '<tr>';
            }
            echo "<td align=center class=row_{$order}><a href='" . makeHref(array('page' => 'rack', 'rack_id' => $rack['id'])) . "'>";
            echo "<img border=0 width={$rackwidth} height=" . getRackImageHeight($rack['height']) * getConfigVar('ROW_SCALE');
            echo " title='{$rack['height']} units'";
            echo "src='?module=image&img=minirack&rack_id={$rack['id']}'>";
            echo "<br>{$rack['name']} ({$rackTotalWattage})</a></td>";
            $order = $nextorder[$order];
            $rackListIdx++;
            $rowTotalWattage += $rackTotalWattage;
        }
        echo "</tr><tr><td align=center colspan=";
        print count($rackList);
        echo "><br><b>The row total for attribute Wattage consuption is:  {$rowTotalWattage}</b></td>\n";
        echo "</tr></table>\n";
        finishPortlet();
    }
    echo "</td></tr></table>";
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:97,代码来源:wattage_consumption.php

示例13: renderServerReport


//.........这里部分代码省略.........
                }
            }
            foreach ($aRow['ipV6List'] as $key => $aDetails) {
                if (function_exists('ip6_format')) {
                    $key = ip6_format($key);
                }
                if (trim($key) != '') {
                    $aCSVRow[2] .= $key . ' ';
                }
            }
            $aCSVRow[2] = trim($aCSVRow[2]);
            $aCSVRow[3] = str_replace('&quot;', "'", $aRow['sComment']);
            $aCSVRow[4] = $aRow['sContact'];
            $aCSVRow[5] = $aRow['HWtype'];
            $aCSVRow[6] = $aRow['OEMSN'];
            $aCSVRow[7] = $aRow['HWExpDate'];
            $aCSVRow[8] = $aRow['sOS'];
            $aCSVRow[9] = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $aRow['sLocation']);
            fputcsv($outstream, $aCSVRow);
        }
        fclose($outstream);
        exit(0);
        # Exit normally after send CSV to browser
    }
    // Load stylesheet and jquery scripts
    echo '<link rel="stylesheet" href="extensions/jquery/themes/racktables/style.css" type="text/css"/>';
    echo '<script type="text/javascript" src="extensions/jquery/jquery-latest.js"></script>';
    echo '<script type="text/javascript" src="extensions/jquery/jquery.tablesorter.js"></script>';
    echo '<script type="text/javascript" src="extensions/jquery/picnet.table.filter.min.js"></script>';
    // Display the stat array
    echo '<h2>Server report (' . $iTotal . ')</h2><ul>';
    echo '<a href="index.php?page=reports&tab=server&csv">CSV Export</a>';
    echo '<table id="reportTable" class="tablesorter">
          <thead>
            <tr>
              <th>Name</th>
              <th>MAC</th>
              <th>IP(s)</th>
              <th>Comment</th>
              <th>Contact</th>
              <th>Type</th>
              <th>OEM S/N</th>
              <th>HW Expire Date</th>
              <th>OS</th>
              <th>Location</th>
            </tr>
          </thead>
        <tbody>';
    foreach ($aResult as $id => $aRow) {
        echo '<tr>
              <td><a href="' . makeHref(array('page' => 'object', 'object_id' => $id)) . '">' . $aRow['sName'] . '</a></td>
              <td>';
        foreach ($aRow['ports'] as $portNumber => $aPortDetails) {
            if (trim($aPortDetails['l2address']) != '') {
                echo $aPortDetails['l2address'] . '<br/>';
            }
        }
        echo '  </td>
              <td>';
        foreach ($aRow['ipV4List'] as $key => $aDetails) {
            if (function_exists('ip4_format')) {
                $key = ip4_format($key);
            }
            if (trim($key) != '') {
                echo $key . '<br/>';
            }
        }
        foreach ($aRow['ipV6List'] as $key => $aDetails) {
            if (function_exists('ip6_format')) {
                $key = ip6_format($key);
            }
            if (trim($key) != '') {
                echo $key . '<br/>';
            }
        }
        echo '</td>
            <td>' . makeLinksInText($aRow['sComment']) . '</td>
            <td>' . $aRow['sContact'] . '</td>
            <td>' . $aRow['HWtype'] . '</td>
            <td>' . $aRow['OEMSN'] . '</td>
            <td>' . $aRow['HWExpDate'] . '</td>
            <td>' . $aRow['sOS'] . '</td>
            <td>' . $aRow['sLocation'] . '</td>
          </tr>';
    }
    echo '  </tbody>
        </table>';
    echo '<script type="text/javascript">
          $(document).ready(function()
          {
            $.tablesorter.defaults.widgets = ["zebra"];
            $("#reportTable").tablesorter(
              { headers: {
                2: { sorter: "ipAddress" },
              }, sortList: [[0,0]] }
            )
            $("#reportTable").tableFilter();
          });
       </script>';
}
开发者ID:xtha,项目名称:salt,代码行数:101,代码来源:server-report.php

示例14: renderChapter

function renderChapter($tgt_chapter_no)
{
    global $nextorder;
    $words = readChapter($tgt_chapter_no, 'a');
    $wc = count($words);
    if (!$wc) {
        echo "<center><h2>(no records)</h2></center>";
        return;
    }
    $refcnt = getChapterRefc($tgt_chapter_no, array_keys($words));
    $attrs = getChapterAttributes($tgt_chapter_no);
    echo "<br><table class=cooltable border=0 cellpadding=5 cellspacing=0 align=center>\n";
    echo "<tr><th colspan=4>{$wc} record(s)</th></tr>\n";
    echo "<tr><th>Origin</th><th>Key</th><th>Refcnt</th><th>Word</th></tr>\n";
    $order = 'odd';
    foreach ($words as $key => $value) {
        echo "<tr class=row_{$order}><td>";
        printImageHREF($key < 50000 ? 'computer' : 'favorite');
        echo "</td><td class=tdright>{$key}</td><td>";
        if ($refcnt[$key]) {
            $cfe = '';
            foreach ($attrs as $attr_id) {
                if (!empty($cfe)) {
                    $cfe .= ' or ';
                }
                $cfe .= '{$attr_' . $attr_id . '_' . $key . '}';
            }
            if (!empty($cfe)) {
                $href = makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cfe' => $cfe));
                echo '<a href="' . $href . '">' . $refcnt[$key] . '</a>';
            } else {
                echo $refcnt[$key];
            }
        }
        echo "</td><td>{$value}</td></tr>\n";
        $order = $nextorder[$order];
    }
    echo "</table>\n<br>";
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:39,代码来源:interface-config.php

示例15: addAttributesToNetworkSummary

function addAttributesToNetworkSummary($ret, $cell, $summary)
{
    if (!isset($cell['realm']) || $cell['realm'] !== 'ipv4net' && $cell['realm'] !== 'ipv6net') {
        return $ret;
    }
    foreach (getAttrValuesForNetwork($cell) as $record) {
        if (strlen($record['value']) and permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $record['id'])))) {
            if (!isset($record['key'])) {
                $value = formatAttributeValue($record);
            } else {
                $href = makeHref(array('page' => 'flatip', 'tab' => 'default', 'attr_id' => $record['id'], 'attr_value' => $record['key'], 'clear-cf' => ''));
                $value = '<a href="' . $href . '">' . $record['a_value'] . '</a>';
            }
            $ret['{sticker}' . $record['name']] = $value;
        }
    }
    return $ret;
}
开发者ID:epx998,项目名称:racktables-contribs,代码行数:18,代码来源:network-attrs.php


注:本文中的makeHref函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。