$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();
// Create an array with the inventory dates $inventories = array(); // Create an array with the "new_machine" booleans $new_machines = array(); // Create an array with $params needed for cliquable first column $params = array(); foreach ($incoming as $inc) { $machines[] = $inc[0]; $inventories[] = _toDate($inc[1]); $new_machines[] = $inc[2]; $params[] = array('hostname' => $inc[0], 'uuid' => $inc[3]); } // Create the listinfos widget, the first column is the machine name $l = new OptimizedListInfos($machines, _T("Computer name")); // Add the second column, which is the inventory date $l->addExtraInfo($inventories, _T("Inventory date")); // Add the third column, which is the boolean "new_machine" $l->addExtraInfo($new_machines, _T("New computer")); // Add actions item, to make first column cliquable $l->addActionItem(new ActionItem(_T("View", "inventory"), "invtabs", "display", "inventory", "base", "computers")); $l->addActionItem(new ActionPopupItem(_T("Information", "inventory"), "infos", "info", "inventory", "inventory", "inventory")); $l->setParamInfo($params); // Navbar for an Ajax widget $l->setItemCount($count); $l->setNavBar(new AjaxNavBar($count, $filter)); // Item counter label $l->setName(_T("Elements")); $l->setTableHeaderPadding(0); $l->start = 0; $l->end = count($machines); $l->display();