echo "<tr class='tab_bg_1'><td width='120'>" . __('By location') . "</td>"; echo "<td>"; Location::dropdown(array('entity' => $_SESSION["glpiactive_entity"])); echo "</td><td class='center' width='120'>"; echo "<input type='submit' value=\"" . __s('Display report') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); echo "<form name='form2' method='post' action='report.switch.list.php'>"; echo "<table class='tab_cadre' width='500'>"; echo "<tr class='tab_bg_1'><td width='120'>" . __('By hardware') . "</td>"; echo "<td>"; NetworkEquipment::dropdown(array('name' => 'switch')); echo "</td><td class='center' width='120'>"; echo "<input type='submit' value=\"" . __s('Display report') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); if (countElementsInTableForMyEntities("glpi_netpoints") > 0) { echo "<form name='form3' method='post' action='report.netpoint.list.php'>"; echo "<table class='tab_cadre' width='500'>"; echo "<tr class='tab_bg_1'><td width='120'>" . __('By network outlet') . "</td>"; echo "<td>"; Netpoint::dropdownNetpoint("prise", 0, -1, 1, $_SESSION["glpiactive_entity"]); echo "</td><td class='center' width='120'>"; echo "<input type='submit' value=\"" . __s('Display report') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); } Html::footer();
/** * @covers ::countElementsInTableForMyEntities */ public function testCountElementsInTableForMyEntities() { $this->Login(); $this->setEntity('_test_root_entity', true); $this->assertEquals(6, countElementsInTableForMyEntities('glpi_computers')); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc11"')); // SQL restrict $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc11'])); // Criteria $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc01"')); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc01'])); $this->setEntity('_test_root_entity', false); $this->assertEquals(2, countElementsInTableForMyEntities('glpi_computers')); $this->assertEquals(0, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc11"')); $this->assertEquals(0, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc11'])); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc01"')); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc01'])); $this->setEntity('_test_child_1', false); $this->assertEquals(2, countElementsInTableForMyEntities('glpi_computers')); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc11"')); $this->assertEquals(1, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc11'])); $this->assertEquals(0, countElementsInTableForMyEntities('glpi_computers', 'name="_test_pc01"')); $this->assertEquals(0, countElementsInTableForMyEntities('glpi_computers', ['name' => '_test_pc01'])); }
/** * Print out an HTML "<select>" for a dropdown with preselected value * * @param $itemtype itemtype used for create dropdown * @param $options array of possible options: * - name : string / name of the select (default is depending itemtype) * - value : integer / preselected value (default -1) * - comments : boolean / is the comments displayed near the dropdown (default true) * - toadd : array / array of specific values to add at the begining * - entity : integer or array / restrict to a defined entity or array of entities * (default -1 : no restriction) * - entity_sons : boolean / if entity restrict specified auto select its sons * only available if entity is a single value not an array * (default false) * - toupdate : array / Update a specific item on select change on dropdown * (need value_fieldname, to_update, * url (see Ajax::updateItemOnSelectEvent for information) * and may have moreparams) * - used : array / Already used items ID: not to display in dropdown * (default empty) * - on_change : string / value to transmit to "onChange" * - rand : integer / already computed rand value * - condition : string / aditional SQL condition to limit display * - displaywith : array / array of field to display with request * - emptylabel : Empty choice's label (default self::EMPTY_VALUE) * - display_emptychoice : Display emptychoice ? (default true) * - display : boolean / display or get string (default true) * - permit_select_parent : boolean / for tree dropdown permit to see parent items not available by default (default false) * * @return boolean : false if error and random id if OK **/ static function show($itemtype, $options = array()) { global $DB, $CFG_GLPI; if ($itemtype && !($item = getItemForItemtype($itemtype))) { return false; } $table = $item->getTable(); $params['name'] = $item->getForeignKeyField(); $params['value'] = $itemtype == 'Entity' ? $_SESSION['glpiactive_entity'] : ''; $params['comments'] = true; $params['entity'] = -1; $params['entity_sons'] = false; $params['toupdate'] = ''; $params['used'] = array(); $params['toadd'] = array(); $params['on_change'] = ''; $params['condition'] = ''; $params['rand'] = mt_rand(); $params['displaywith'] = array(); //Parameters about choice 0 //Empty choice's label $params['emptylabel'] = self::EMPTY_VALUE; //Display emptychoice ? $params['display_emptychoice'] = $itemtype != 'Entity'; $params['display'] = true; $params['permit_select_parent'] = false; if (is_array($options) && count($options)) { foreach ($options as $key => $val) { $params[$key] = $val; } } $output = ''; $name = $params['emptylabel']; $comment = ""; $limit_length = $_SESSION["glpidropdown_chars_limit"]; // Check default value for dropdown : need to be a numeric if (strlen($params['value']) == 0 || !is_numeric($params['value'])) { $params['value'] = 0; } if ($params['value'] > 0 || $itemtype == "Entity" && $params['value'] >= 0) { $tmpname = self::getDropdownName($table, $params['value'], 1); if ($tmpname["name"] != " ") { $name = $tmpname["name"]; $comment = $tmpname["comment"]; if (Toolbox::strlen($name) > $_SESSION["glpidropdown_chars_limit"]) { if ($item instanceof CommonTreeDropdown) { $pos = strrpos($name, ">"); $limit_length = max(Toolbox::strlen($name) - $pos, $_SESSION["glpidropdown_chars_limit"]); if (Toolbox::strlen($name) > $limit_length) { $name = "…" . Toolbox::substr($name, -$limit_length); } } else { $limit_length = Toolbox::strlen($name); } } else { $limit_length = $_SESSION["glpidropdown_chars_limit"]; } } } // Manage entity_sons if (!($params['entity'] < 0) && $params['entity_sons']) { if (is_array($params['entity'])) { // translation not needed - only for debug $output .= "entity_sons options is not available with entity option as array"; } else { $params['entity'] = getSonsOf('glpi_entities', $params['entity']); } } $use_ajax = false; if ($CFG_GLPI["use_ajax"]) { $nb = 0; if ($item->isEntityAssign()) { if (!($params['entity'] < 0)) { $nb = countElementsInTableForEntity($table, $params['entity'], $params['condition']); } else { $nb = countElementsInTableForMyEntities($table, $params['condition']); } } else { $nb = countElementsInTable($table, $params['condition']); } $nb -= count($params['used']); if ($nb > $CFG_GLPI["ajax_limit_count"]) { $use_ajax = true; } } $param = array('searchText' => '__VALUE__', 'value' => $params['value'], 'itemtype' => $itemtype, 'myname' => $params['name'], 'limit' => $limit_length, 'toadd' => $params['toadd'], 'comment' => $params['comments'], 'rand' => $params['rand'], 'entity_restrict' => $params['entity'], 'update_item' => $params['toupdate'], 'used' => $params['used'], 'on_change' => $params['on_change'], 'condition' => $params['condition'], 'emptylabel' => $params['emptylabel'], 'display_emptychoice' => $params['display_emptychoice'], 'displaywith' => $params['displaywith'], 'display' => false, 'permit_select_parent' => $params['permit_select_parent']); if ($item->canView()) { $param['update_link'] = 1; } $default = "<select name='" . $params['name'] . "' id='dropdown_" . $params['name'] . $params['rand'] . "'>"; $default .= "<option value='" . $params['value'] . "'>{$name}</option></select>"; $output .= Ajax::dropdown($use_ajax, "/ajax/dropdownValue.php", $param, $default, $params['rand'], false); // Display comment if ($params['comments']) { $options_tooltip = array('contentid' => "comment_" . $params['name'] . $params['rand'], 'display' => false); if ($item->canView()) { if ($params['value'] && $item->getFromDB($params['value']) && $item->canViewItem()) { $options_tooltip['link'] = $item->getLinkURL(); } else { $options_tooltip['link'] = $item->getSearchURL(); } $options_tooltip['linkid'] = "comment_link_" . $params['name'] . $params['rand']; $options_tooltip['linktarget'] = '_blank'; } $output .= Html::showToolTip($comment, $options_tooltip); if ($item instanceof CommonDropdown && $item->canCreate() && !isset($_GET['popup'])) { $output .= "<img alt='' title=\"" . __s('Add') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n onClick=\"var w = window.open('" . $item->getFormURL() . "?popup=1&rand=" . $params['rand'] . "' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">"; } // Display specific Links if ($itemtype == "Supplier") { if ($item->getFromDB($params['value'])) { $output .= $item->getLinks(); } } if ($itemtype == 'ITILCategory' && Session::haveRight('knowbase', 'r')) { if ($params['value'] && $item->getFromDB($params['value'])) { $output .= ' ' . $item->getLinks(); } } } if ($params['display']) { echo $output; return $params['rand']; } else { return $output; } }
/** * Make a select box for connections * * @param $itemtype type to connect * @param $fromtype from where the connection is * @param $myname select name * @param $entity_restrict Restrict to a defined entity (default = -1) * @param $onlyglobal display only global devices (used for templates) (default 0) * @param $used array Already used items ID: not to display in dropdown * * @return nothing (print out an HTML select box) */ static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array()) { global $CFG_GLPI; $rand = mt_rand(); $use_ajax = false; if ($CFG_GLPI["use_ajax"]) { $nb = 0; if ($entity_restrict >= 0) { $nb = countElementsInTableForEntity(getTableForItemType($itemtype), $entity_restrict); } else { $nb = countElementsInTableForMyEntities(getTableForItemType($itemtype)); } if ($nb > $CFG_GLPI["ajax_limit_count"]) { $use_ajax = true; } } $params = array('searchText' => '__VALUE__', 'fromtype' => $fromtype, 'itemtype' => $itemtype, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used); $default = "<select name='{$myname}'><option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n </select>\n"; Ajax::dropdown($use_ajax, "/ajax/dropdownConnect.php", $params, $default, $rand); return $rand; }
static function board() { global $DB; // FI Computers $fusionComputers = 0; $restrict_entity = getEntitiesRestrictRequest(" AND", 'comp'); $query_fi_computers = "SELECT COUNT(comp.`id`) as nb_computers\n FROM glpi_computers comp\n LEFT JOIN glpi_plugin_fusioninventory_inventorycomputercomputers fi_comp\n ON fi_comp.`computers_id` = comp.`id`\n WHERE comp.`is_deleted` = '0'\n AND comp.`is_template` = '0'\n AND fi_comp.`id` IS NOT NULL\n {$restrict_entity}"; $res_fi_computers = $DB->query($query_fi_computers); if ($data_fi_computers = $DB->fetch_assoc($res_fi_computers)) { $fusionComputers = $data_fi_computers['nb_computers']; } // All Computers $allComputers = countElementsInTableForMyEntities('glpi_computers', "`is_deleted`='0' AND `is_template`='0'"); $dataComputer = array(); $dataComputer[] = array('key' => 'FusionInventory computers : ' . $fusionComputers, 'y' => $fusionComputers, 'color' => '#3dff7d'); $dataComputer[] = array('key' => 'Other computers : ' . ($allComputers - $fusionComputers), 'y' => $allComputers - $fusionComputers, 'color' => "#dedede"); // SNMP $networkequipment = 0; $restrict_entity = getEntitiesRestrictRequest(" AND", 'net'); $query_fi_net = "SELECT COUNT(net.`id`) as nb_net\n FROM glpi_networkequipments net\n LEFT JOIN glpi_plugin_fusioninventory_networkequipments fi_net\n ON fi_net.`networkequipments_id` = net.`id`\n WHERE net.`is_deleted` = '0'\n AND net.`is_template` = '0'\n AND fi_net.`id` IS NOT NULL\n {$restrict_entity}"; $res_fi_net = $DB->query($query_fi_net); if ($data_fi_net = $DB->fetch_assoc($res_fi_net)) { $networkequipment = $data_fi_net['nb_net']; } $printer = 0; $restrict_entity = getEntitiesRestrictRequest(" AND", 'printers'); $query_fi_printers = "SELECT COUNT(printers.`id`) as nb_printers\n FROM glpi_printers printers\n LEFT JOIN glpi_plugin_fusioninventory_printers fi_printer\n ON fi_printer.`printers_id` = printers.`id`\n WHERE printers.`is_deleted` = '0'\n AND printers.`is_template` = '0'\n AND fi_printer.`id` IS NOT NULL\n {$restrict_entity}"; $res_fi_printers = $DB->query($query_fi_printers); if ($data_fi_printers = $DB->fetch_assoc($res_fi_printers)) { $printer = $data_fi_printers['nb_printers']; } $dataSNMP = array(); $dataSNMP[] = array('key' => 'NetworkEquipments (SNMP) : ' . $networkequipment, 'y' => $networkequipment, 'color' => '#3d94ff'); $dataSNMP[] = array('key' => 'Printers (SNMP) : ' . $printer, 'y' => $printer, 'color' => '#3dff7d'); // switches ports $allSwitchesPortSNMP = 0; $restrict_entity = getEntitiesRestrictRequest(" AND", 'networkports'); $query_fi_networkports = "SELECT COUNT(networkports.`id`) as nb_networkports\n FROM glpi_networkports networkports\n LEFT JOIN glpi_plugin_fusioninventory_networkports fi_networkports\n ON fi_networkports.`networkports_id` = networkports.`id`\n WHERE networkports.`is_deleted` = '0'\n AND fi_networkports.`id` IS NOT NULL\n {$restrict_entity}"; $res_fi_networkports = $DB->query($query_fi_networkports); if ($data_fi_networkports = $DB->fetch_assoc($res_fi_networkports)) { $allSwitchesPortSNMP = $data_fi_networkports['nb_networkports']; } $query = "SELECT `glpi_networkports`.`id` FROM `glpi_networkports`\n LEFT JOIN `glpi_plugin_fusioninventory_networkports`\n ON `glpi_plugin_fusioninventory_networkports`.`networkports_id` = `glpi_networkports`.`id`\n LEFT JOIN glpi_networkports_networkports\n ON (`networkports_id_1`=`glpi_networkports`.`id`\n OR `networkports_id_2`=`glpi_networkports`.`id`)\n WHERE `glpi_plugin_fusioninventory_networkports`.`id` IS NOT NULL\n AND `glpi_networkports_networkports`.`id` IS NOT NULL\n {$restrict_entity}"; $result = $DB->query($query); $networkPortsLinked = $DB->numrows($result); $dataPortL = array(); $dataPortL[] = array('key' => 'SNMP switch network ports linked : ' . $networkPortsLinked, 'y' => $networkPortsLinked, 'color' => '#3dff7d'); $dataPortL[] = array('key' => 'SNMP switch network ports not linked : ' . ($allSwitchesPortSNMP - $networkPortsLinked), 'y' => $allSwitchesPortSNMP - $networkPortsLinked, 'color' => '#dedede'); // Ports connected at last SNMP inventory $networkPortsConnected = 0; $restrict_entity = getEntitiesRestrictRequest(" AND", 'networkports'); $query_fi_networkports = "SELECT COUNT(networkports.`id`) as nb_networkports\n FROM glpi_networkports networkports\n LEFT JOIN glpi_plugin_fusioninventory_networkports fi_networkports\n ON fi_networkports.`networkports_id` = networkports.`id`\n WHERE networkports.`is_deleted` = '0'\n AND (fi_networkports.`ifstatus`='1'\n OR fi_networkports.`ifstatus`='up')\n and fi_networkports.`id` IS NOT NULL\n {$restrict_entity}"; $res_fi_networkports = $DB->query($query_fi_networkports); if ($data_fi_networkports = $DB->fetch_assoc($res_fi_networkports)) { $networkPortsConnected = $data_fi_networkports['nb_networkports']; } $dataPortC = array(); $dataPortC[] = array('key' => 'Ports connected : ' . $networkPortsConnected, 'y' => $networkPortsConnected, 'color' => '#3dff7d'); $dataPortC[] = array('key' => 'Ports not connected : ' . ($allSwitchesPortSNMP - $networkPortsConnected), 'y' => $allSwitchesPortSNMP - $networkPortsConnected, 'color' => '#dedede'); // Number of computer inventories in last hour, 6 hours, 24 hours $dataInventory = PluginFusioninventoryInventoryComputerStat::getLastHours(); // Deploy $restrict_entity = getEntitiesRestrictRequest(" AND", 'glpi_plugin_fusioninventory_taskjobs'); $query = "SELECT `plugin_fusioninventory_tasks_id`\n FROM glpi_plugin_fusioninventory_taskjobs\n WHERE method LIKE '%deploy%'\n {$restrict_entity}\n GROUP BY `plugin_fusioninventory_tasks_id`"; $result = $DB->query($query); $a_tasks = array(); while ($data = $DB->fetch_array($result)) { $a_tasks[] = $data['plugin_fusioninventory_tasks_id']; } $pfTask = new PluginFusioninventoryTask(); $data = $pfTask->getJoblogs($a_tasks); $dataDeploy = array(); $dataDeploy[0] = array('key' => 'Prepared and waiting', 'y' => 0, 'color' => '#efefef'); $dataDeploy[1] = array('key' => 'Running', 'y' => 0, 'color' => '#aaaaff'); $dataDeploy[2] = array('key' => 'Successfull', 'y' => 0, 'color' => '#aaffaa'); $dataDeploy[3] = array('key' => 'In error', 'y' => 0, 'color' => '#ff0000'); foreach ($data['tasks'] as $lev1) { foreach ($lev1['jobs'] as $lev2) { foreach ($lev2['targets'] as $lev3) { $dataDeploy[2]['y'] += count($lev3['counters']['agents_success']); $dataDeploy[3]['y'] += count($lev3['counters']['agents_error']); $dataDeploy[0]['y'] += count($lev3['counters']['agents_prepared']); $dataDeploy[1]['y'] += count($lev3['counters']['agents_running']); } } } for ($k = 0; $k < 4; $k++) { $dataDeploy[$k]['key'] .= " : " . $dataDeploy[$k]['y']; } echo "<table align='center'>"; echo "<tr height='280'>"; echo "<td width='380'>"; self::showChart('computers', $dataComputer); echo "</td>"; echo "<td width='380'>"; $title = __('Number of computer inventories of last hours', 'fusioninventory'); $title = ''; self::showChartBar('nbinventory', $dataInventory, $title); echo "</td>"; echo "<td width='380'>"; self::showChart('deploy', $dataDeploy, __('Deployment', 'fusioninventory')); echo "</td>"; echo "</tr>"; echo "<tr height='280'>"; echo "<td>"; self::showChart('snmp', $dataSNMP); echo "</td>"; echo "<td>"; self::showChart('ports', $dataPortL); echo "</td>"; echo "<td>"; self::showChart('portsconnected', $dataPortC); echo "</td>"; echo "</tr>"; echo "</table>"; }
/** * Permet l'affichage dynamique d'une liste déroulante imbriquee * * @static * @param array ($itemtype,$myname,$value,$entity_restrict,$action,$span) */ static function showGenericDropdown($itemtype, $options = array()) { global $DB, $CFG_GLPI; $item = getItemForItemtype($itemtype); if ($itemtype && !($item = getItemForItemtype($itemtype))) { return false; } $table = $item->getTable(); /*$options["table"] = $table; $options["rand"] = $rand; $params['name'] = $item->getForeignKeyField(); $params['value'] = ($itemtype=='Entity' ? $_SESSION['glpiactive_entity'] : ''); $params['entity'] = -1; $params['entity_sons'] = false; $params['toupdate'] = ''; $params['used'] = array(); $params['toadd'] = array(); $params['on_change'] = ''; $params['condition'] = ''; $params['rand'] = mt_rand(); $params['displaywith'] = array(); //Parameters about choice 0 //Empty choice's label $params['emptylabel'] = self::EMPTY_VALUE;*/ $params['comments'] = true; $params['condition'] = ''; $params['entity'] = -1; $params['entity_sons'] = false; $params['rand'] = mt_rand(); $params['used'] = array(); $params['table'] = $table; $params['emptylabel'] = Dropdown::EMPTY_VALUE; //Display emptychoice ? $params['display_emptychoice'] = true; //In case of Entity dropdown, display root entity ? $params['display_rootentity'] = false; //specific $params['action'] = ""; $params['span'] = ""; $params['sort'] = false; if (is_array($options) && count($options)) { foreach ($options as $key => $val) { $params[$key] = $val; } } $name = $params['emptylabel']; $comment = ""; $limit_length = $_SESSION["glpidropdown_chars_limit"]; if (strlen($params['value']) == 0 || !is_numeric($params['value'])) { $params['value'] = 0; } if ($params['value'] > 0) { $tmpname = Dropdown::getDropdownName($table, $params['value'], 1); if ($tmpname["name"] != " ") { $name = $tmpname["name"]; $comment = $tmpname["comment"]; if (Toolbox::strlen($name) > $_SESSION["glpidropdown_chars_limit"]) { if ($item instanceof CommonTreeDropdown) { $pos = strrpos($name, ">"); $limit_length = max(Toolbox::strlen($name) - $pos, $_SESSION["glpidropdown_chars_limit"]); if (Toolbox::strlen($name) > $limit_length) { $name = "…" . Toolbox::substr($name, -$limit_length); } } else { $limit_length = Toolbox::strlen($name); } } else { $limit_length = $_SESSION["glpidropdown_chars_limit"]; } } } // Manage entity_sons if (!($params['entity'] < 0) && $params['entity_sons']) { if (is_array($params['entity'])) { echo "entity_sons options is not available with array of entity"; } else { $params['entity'] = getSonsOf('glpi_entities', $params['entity']); } } $use_ajax = false; if ($CFG_GLPI["use_ajax"]) { $nb = 0; if ($item->isEntityAssign()) { if (!($params['entity'] < 0)) { $nb = countElementsInTableForEntity($table, $params['entity'], $params['condition']); } else { $nb = countElementsInTableForMyEntities($table, $params['condition']); } } else { $nb = countElementsInTable($table, $params['condition']); } $nb -= count($params['used']); if ($nb > $CFG_GLPI["ajax_limit_count"]) { $use_ajax = true; } } $param = array('searchText' => '__VALUE__', 'value' => $params['value'], 'itemtype' => $itemtype, 'myname' => $params['name'], 'limit' => $limit_length, 'comment' => $params['comments'], 'rand' => $params['rand'], 'entity_restrict' => $params['entity'], 'used' => $params['used'], 'condition' => $params['condition'], 'emptylabel' => $params['emptylabel'], 'display_emptychoice' => $params['display_emptychoice'], 'display_rootentity' => $params['display_rootentity'], 'action' => $params['action'], 'span' => $params['span'], 'sort' => $params['sort']); $default = "<select name='" . $params['name'] . "' id='dropdown_" . $params['name'] . $params['rand'] . "'>"; $default .= "<option value='" . $params['value'] . "'>{$name}</option></select>"; Ajax::dropdown($use_ajax, "/plugins/resources/ajax/dropdownValue.php", $param, $default, $params['rand']); // Display comment if ($params['comments']) { $options_tooltip = array('contentid' => "comment_" . $param['myname'] . $params['rand']); if ($params['value'] && $item->getFromDB($params['value'])) { $options_tooltip['link'] = $item->getLinkURL(); $options_tooltip['linktarget'] = '_blank'; } Html::showToolTip($comment, $options_tooltip); if ($item instanceof CommonDropdown && $item->canCreate() && !isset($_GET['popup'])) { echo "<img alt='' title=\"" . _sx('button', 'Add') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n onClick=\"var w = window.open('" . $item->getFormURL() . "?popup=1&rand=" . $params['rand'] . "' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">"; } } return $params['rand']; }