$a_details[] = $actionstatus; } } } $n = new OptimizedListInfos($a_cmd, _T("Command", "msc")); $n->addExtraInfo($a_creator, _T("Creator", "msc")); $n->addExtraInfo($a_date, _T("Creation date", "msc")); $n->addExtraInfo($a_target, _T("Target", "msc")); $n->addActionItemArray($a_start); $n->addActionItemArray($a_pause); $n->addActionItemArray($a_stop); $n->addActionItemArray($a_details); $n->disableFirstColumnActionLink(); # TODO put several columns actions $n->setParamInfo($params); $n->setTableHeaderPadding(1); $n->setItemCount($count); $n->setNavBar(new AjaxNavBar($count, $filter)); $n->start = 0; $n->end = $maxperpage; $n->display(); ?> <!-- inject styles --> <link rel="stylesheet" href="modules/msc/graph/css/msc_commands.css" type="text/css" media="screen" /> <style> li.pause_old a {
$hosts[] = $r["hostname"]; //rtrim($r[1],"."); $types[] = $r["type"]; $values[] = getRecordValueDescription($zone, $r["type"], $r["value"]); $params[] = array("zone" => $zone, "reverse" => $reverse, "id" => $r["id"], "serial" => $serial); $actionsMod[] = $editAction; if ($r["hostname"] === $curzone . "." && $r["type"] === "TXT" || $r["type"] == "SOA") { $actionsDel[] = $emptyAction; } else { $actionsDel[] = $delAction; } } //print_r($values); $typeAsc = $sortby == "type" ? intval(!$asc) : "1"; $hostnameAsc = $sortby == "hostname" ? intval(!$asc) : "1"; $typeUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "type", "asc" => $typeAsc)); $hostnameUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "hostname", "asc" => $hostnameAsc)); $n = new OptimizedListInfos($hosts, "<a href='" . $hostnameUrl . "'>" . _T("Host name", "network") . "</a>"); $n->setTableHeaderPadding(1); $n->setNavBar(new AjaxNavBar(count($records), $filter)); $n->setItemCount(count($records)); $n->start = 0; $n->end = count($recordsatpage) - 1; $n->addExtraInfo($types, "<a href='" . $typeUrl . "'>" . _T("Record type", "network")) . "</a>"; $n->addExtraInfo($values, _T("Record parameters", "network")); $n->setName(_T("Host", "network")); $n->setParamInfo($params); $n->disableFirstColumnActionLink(); $n->addActionItemArray($actionsMod); $n->addActionItemArray($actionsDel); $n->display();
function display_part($part, $get, $simpleTableParts, $displayNavBar = True, $partTitle = null) { $uuid = ''; if (isset($get['uuid'])) { $uuid = $get['uuid']; } elseif (isset($get['objectUUID'])) { $uuid = $get['objectUUID']; } $maxperpage = isset($get['maxperpage']) ? $get['maxperpage'] : 0; $filter = isset($get["filter"]) ? $get['filter'] : ''; if (isset($get["start"])) { $start = $get["start"]; } else { $start = 0; } $end = $start + $maxperpage; $hide_win_updates = isset($get['hide_win_updates']) ? $get['hide_win_updates'] : False; $hide_win_updates = strtolower($hide_win_updates) == 'true' ? True : False; $history_delta = isset($get['history_delta']) ? $get['history_delta'] : False; $options = array('hide_win_updates' => $hide_win_updates, 'history_delta' => $history_delta); // Get current part inventory $inv = getLastMachineGlpiPart($uuid, $part, $start, $end, $filter, $options); $itemCount = countLastMachineGlpiPart($uuid, $part, $filter, $options); if (!is_array($inv)) { $inv = array(); } // this piece of code re-format inventory array // $all variable will contain part's inventory $all = array(); $i = 0; foreach ($inv as $line) { foreach ($line as $vals) { /* * If $vals[1] is an empty string or an array, don't use the _T() function * Empty fields are replaced by a trademark text by transifex * if it's an array, it's an editable field */ $vals[1] = str_replace('@@FALSE_POSITIVE@@', _T(' (Not an antivirus)', 'glpi'), $vals[1]); $all[$vals[0]][$i] = ''; if (!is_array($vals[1]) && $vals[1] != '') { // translatable fields $all[$vals[0]][$i] = _T($vals[1]); } elseif (is_array($vals[1])) { // editable fields $all[$vals[0]][$i] = $vals[1]; } } $i++; } /* * simpleTableParts are parts who are *not* displayed * in a multi-line table */ // Simple table if (in_array($part, $simpleTableParts)) { $key = array(); $val = array(); foreach (array_keys($all) as $k) { $key[] = _T($k, 'glpi'); if ($k == 'Serial Number') { $val[] = str_replace('@@WARRANTY_LINK_TEXT@@', _T('Click here to see this computer on manufacturer website', 'glpi'), $all[$k][0]); } else { /* * if $all[$k][0] is an array, it's an editable value * $editable = array(uniquename, type, value) */ if (is_array($all[$k][0])) { $editable = $all[$k][0]; $val[] = sprintf('<label class="editableField" name="%s" data="%s" style="height:1em;">%s</label>', $editable[0], $editable[1], $editable[2]) . sprintf('<input type="text" class="editableField" name="%s" value="%s" style="display:none" />', $editable[0], $editable[2]); } else { $val[] = $all[$k][0]; } } } $n = new ListInfos($key, _T("Properties", "glpi")); $n->addExtraInfo($val, _T("Value", "glpi")); /* * $_GET['maxperpage'] is set to 10 by default * If there is more than 10 elements, they don't be displayed * So setRowsPerPage equal to number of elements to display */ $n->setRowsPerPage(count($all)); $n->drawTable(0); } else { $n = null; // If nothing found, display a "nothing found" message // except on Hardware tab (identified by $partTitle == null) => display nothing if (count($all) == 0 && $partTitle == null) { switch ($part) { case 'History': printf('<p>%s</p>', _T('No record found for this period.', 'glpi')); break; case 'Antivirus': printf('<p>%s</p>', _T('Unable to detect any Antivirus software on this machine.', 'glpi')); printf('<p>%s</p>', _T('Please ensure you are running GLPI with FusionInventory plugin and FusionInventory Agent on this client.', 'glpi')); break; default: printf('<p>%s</p>', _T('No record found.', 'glpi')); } } // Put datas in a ListInfos object foreach ($all as $k => $v) { if ($n == null) { $n = new OptimizedListInfos($v, _T($k, 'glpi')); } else { $n->addExtraInfo($v, _T($k, 'glpi')); } } // display table if ($n) { $n->setItemCount($itemCount); $n->setNavBar(new AjaxNavBar($itemCount, $filter)); $n->disableFirstColumnActionLink(); $n->setTableHeaderPadding(1); $n->start = 0; $n->end = $itemCount; // Display a title (it happens in Hardware tab) if ($partTitle) { printf("<h2>%s</h2>", $partTitle); } // Display table with (or not) NavBar $n->display($displayNavBar, $displayNavBar); if ($partTitle) { echo "<br />"; } } } }