static function showForLocation($item)
{
global $DB, $CFG_GLPI;
$ID = $item->getField('id');
$netpoint = new self();
$item->check($ID, READ);
$canedit = $item->canEdit($ID);
if (isset($_GET["start"])) {
$start = intval($_GET["start"]);
} else {
$start = 0;
}
$number = countElementsInTable('glpi_netpoints', ['locations_id' => $ID]);
if ($canedit) {
echo "<div class='first-bloc'>";
// Minimal form for quick input.
echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'>";
echo "<td class='b'>" . _n('Network outlet', 'Network outlets', 1) . "</td>";
echo "<td>" . __('Name') . "</td><td>";
Html::autocompletionTextField($item, "name", array('value' => ''));
echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
echo "<input type='hidden' name='locations_id' value='{$ID}'></td>";
echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>\n";
echo "</table>\n";
Html::closeForm();
// Minimal form for massive input.
echo "<form action='" . $netpoint->getFormURL() . "' method='post'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2 center'>";
echo "<td class='b'>" . _n('Network outlet', 'Network outlets', Session::getPluralNumber()) . "</td>";
echo "<td>" . __('Name') . "</td><td>";
echo "<input type='text' maxlength='100' size='10' name='_before'> ";
Dropdown::showNumber('_from', array('value' => 0, 'min' => 0, 'max' => 400));
echo " --> ";
Dropdown::showNumber('_to', array('value' => 0, 'min' => 0, 'max' => 400));
echo " <input type='text' maxlength='100' size='10' name='_after'><br>";
echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>";
echo "<input type='hidden' name='locations_id' value='{$ID}'>";
echo "<input type='hidden' name='_method' value='AddMulti'></td>";
echo "<td><input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\"\n class='submit'>";
echo "</td></tr>\n";
echo "</table>\n";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($number < 1) {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . self::getTypeName(1) . "</th>";
echo "<th>" . __('No item found') . "</th></tr>";
echo "</table>\n";
} else {
Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
if ($canedit) {
$rand = mt_rand();
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $_SESSION['glpilist_limit'], 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array('purge' => _x('button', 'Delete permanently')));
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixe'><tr>";
if ($canedit) {
echo "<th width='10'>";
Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
echo "</th>";
}
echo "<th>" . __('Name') . "</th>";
// Name
echo "<th>" . __('Comments') . "</th>";
// Comment
echo "</tr>\n";
$crit = array('locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']);
Session::initNavigateListItems('Netpoint', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
foreach ($DB->request('glpi_netpoints', $crit) as $data) {
Session::addToNavigateListItems('Netpoint', $data["id"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
}
echo "<td><a href='" . $netpoint->getFormURL();
echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>";
echo "<td>" . $data['comment'] . "</td>";
echo "</tr>\n";
}
echo "</table>\n";
if ($canedit) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number);
}
echo "</div>\n";
}