. * --------------------------------------------------------------------- */ use Glpi\Event; if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } /// Netpoint class class Netpoint extends CommonDropdown { // From CommonDBTM public $dohistory = true; static $rightname = 'netpoint'; public $can_be_translated = false; function getAdditionalFields() { return [['name' => 'locations_id', 'label' => Location::getTypeName(1), 'type' => 'dropdownValue', 'list' => true]]; } static function getTypeName($nb = 0) { return _n('Network outlet', 'Network outlets', $nb); } function rawSearchOptions() { $tab = parent::rawSearchOptions(); $tab = array_merge($tab, Location::rawSearchOptionsToAdd()); foreach ($tab as &$t) { if ($t['id'] == 3) { $t['datatype'] = 'itemlink'; break; } } return $tab; } /** * Handled Multi add item * * @since 0.83 (before addMulti) * * @param $input array of values **/ function executeAddMulti(array $input) { $this->check(-1, CREATE, $input); for ($i=$input["_from"]; $i<=$input["_to"]; $i++) { $input["name"] = $input["_before"].$i.$input["_after"]; $this->add($input); } Event::log(0, "dropdown", 5, "setup", sprintf(__('%1$s adds several netpoints'), $_SESSION["glpiname"])); } /** * Print out an HTML ""; echo ""; echo ""; echo "\n"; echo "\n"; Html::closeForm(); // Minimal form for massive input. echo "
"; echo ""; echo ""; echo ""; echo ""; echo "\n"; echo "
"._n('Network outlet', 'Network outlets', Session::getPluralNumber())."".__('Name').""; echo " "; Dropdown::showNumber('_from', ['value' => 0, 'min' => 0, 'max' => 400]); echo " --> "; Dropdown::showNumber('_to', ['value' => 0, 'min' => 0, 'max' => 400]); echo " 
"; echo ""; echo ""; echo "
"; echo "
\n"; Html::closeForm(); echo ""; } echo "
"; if ($number < 1) { echo ""; echo ""; echo ""; echo "
".self::getTypeName(1)."".__('No item found')."
\n"; } else { Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number); if ($canedit) { $rand = mt_rand(); Html::openMassiveActionsForm('mass'.__CLASS__.$rand); $massiveactionparams = ['num_displayed' => min($_SESSION['glpilist_limit'], $number), 'container' => 'mass'.__CLASS__.$rand, 'specific_actions' => ['purge' => _x('button', 'Delete permanently')]]; Html::showMassiveActions($massiveactionparams); } echo ""; if ($canedit) { echo ""; } echo ""; // Name echo ""; // Comment echo "\n"; $crit = ['locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']]; Session::initNavigateListItems('Netpoint', //TRANS : %1$s is the itemtype name, %2$s is the name of the item (used for headings of a list) sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName())); foreach ($DB->request('glpi_netpoints', $crit) as $data) { Session::addToNavigateListItems('Netpoint', $data["id"]); echo ""; if ($canedit) { echo ""; } echo ""; echo ""; echo "\n"; } echo "
"; echo Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand); echo "".__('Name')."".__('Comments')."
".Html::getMassiveActionCheckBox(__CLASS__, $data["id"])."".$data['name']."".$data['comment']."
\n"; if ($canedit) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number); } echo "
\n"; } /** * @since 0.84 * * @param $itemtype * @param $base HTMLTableBase object * @param $super HTMLTableSuperHeader object (default NULL * @param $father HTMLTableHeader object (default NULL) * @param $options array **/ static function getHTMLTableHeader($itemtype, HTMLTableBase $base, HTMLTableSuperHeader $super = null, HTMLTableHeader $father = null, array $options = []) { $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } $base->addHeader($column_name, _n('Network outlet', 'Network outlets', 1), $super, $father); } /** * @since 0.84 * * @param $row HTMLTableRow object (default NULL) * @param $item CommonDBTM object (default NULL) * @param $father HTMLTableCell object (default NULL) * @param $options array **/ static function getHTMLTableCellsForItem(HTMLTableRow $row = null, CommonDBTM $item = null, HTMLTableCell $father = null, $options = []) { $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } $row->addCell($row->getHeaderByName($column_name), Dropdown::getDropdownName("glpi_netpoints", $item->fields["netpoints_id"]), $father); } }