} } $linked = Search::getMetaItemtypeAvailable($_POST["itemtype"]); $rand = mt_rand(); $rowid = 'metasearchrow' . $_POST['itemtype'] . $rand; echo "<tr class='metacriteria' id='{$rowid}'><td class='left' colspan='2'>"; echo "<table class='tab_format'><tr class='left'>"; echo "<td width='30%'>"; echo "<img class='pointer' src=\"" . $CFG_GLPI["root_doc"] . "/pics/meta_moins.png\" alt='-' title=\"" . __s('Delete a global search criterion') . "\" onclick=\"" . Html::jsGetElementbyID($rowid) . ".remove();\">"; echo " "; // Display link item (not for the first item) $value = ''; if (isset($metacriteria["link"])) { $value = $metacriteria["link"]; } Dropdown::showFromArray("metacriteria[" . $_POST["num"] . "][link]", Search::getLogicalOperators(), array('value' => $value, 'width' => '40%')); // Display select of the linked item type available foreach ($linked as $key) { if (!isset($metanames[$key])) { if ($linkitem = getItemForItemtype($key)) { $metanames[$key] = $linkitem->getTypeName(); } } } $value = ''; if (isset($metacriteria['itemtype']) && !empty($metacriteria['itemtype'])) { $value = $metacriteria['itemtype']; } $rand = Dropdown::showItemTypes("metacriteria[" . $_POST["num"] . "][itemtype]", $linked, array('width' => '50%', 'value' => $value)); $field_id = Html::cleanId("dropdown_metacriteria[" . $_POST["num"] . "][itemtype]{$rand}"); echo "</td><td>";
$criteria = $_SESSION['glpisearch'][$_POST["itemtype"]]['criteria'][$_POST["num"]]; } else { foreach ($options as $key => $val) { if (is_array($val)) { $criteria['field'] = $key; break; } } } // Display link item if ($_POST["num"] > 0) { $value = ''; if (isset($criteria["link"])) { $value = $criteria["link"]; } Dropdown::showFromArray("criteria[" . $_POST["num"] . "][link]", Search::getLogicalOperators(), array('value' => $value)); } $selected = $first = ''; $values = array(); // display select box to define search item if ($CFG_GLPI['allow_search_view'] == 2) { $values['view'] = __('Items seen'); } reset($options); $group = ''; foreach ($options as $key => $val) { // print groups if (!is_array($val)) { $group = $val; } else { if (!isset($val['nosearch']) || $val['nosearch'] == false) {