本文整理汇总了PHP中Search::makeTextSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::makeTextSearch方法的具体用法?PHP Search::makeTextSearch怎么用?PHP Search::makeTextSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::makeTextSearch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_mreporting_addWhere
function plugin_mreporting_addWhere($link, $nott, $type, $ID, $val, $searchtype)
{
$searchopt =& Search::getOptions($type);
$table = $searchopt[$ID]["table"];
$field = $searchopt[$ID]["field"];
$SEARCH = Search::makeTextSearch($val, $nott);
exit;
switch ($table . "." . $field) {
case "glpi_plugin_mreporting_configs.graphtype":
return $link . " `{$table}`.`{$field}` = '{$val}' ";
}
return "";
}
示例2: getEntitiesRestrictRequest
$recursive = $item->maybeRecursive();
$where = getEntitiesRestrictRequest("WHERE", $_POST['table'], '', $entity, $recursive);
} else {
$where = "WHERE 1";
}
if (isset($_POST['used']) && !empty($_POST['used'])) {
$where .= " AND `id` NOT IN ('" . implode("','", $_POST['used']) . "') ";
}
if ($item->maybeDeleted()) {
$where .= " AND `is_deleted` = '0' ";
}
if ($item->maybeTemplate()) {
$where .= " AND `is_template` = '0' ";
}
if (strlen($_POST['searchText']) > 0) {
$search = Search::makeTextSearch($_POST['searchText']);
$where .= " AND (`name` " . $search . "\n OR `id` = '" . $_POST['searchText'] . "'";
if (FieldExists($_POST['table'], "contact")) {
$where .= " OR `contact` " . $search;
}
if (FieldExists($_POST['table'], "serial")) {
$where .= " OR `serial` " . $search;
}
if (FieldExists($_POST['table'], "otherserial")) {
$where .= " OR `otherserial` " . $search;
}
$where .= ")";
}
//If software or plugins : filter to display only the objects that are allowed to be visible in Helpdesk
if (in_array($_POST['itemtype'], $CFG_GLPI["helpdesk_visible_types"])) {
$where .= " AND `is_helpdesk_visible` = '1' ";
示例3: intval
if (!isset($_POST['page'])) {
$_POST['page'] = 1;
$_POST['page_limit'] = $CFG_GLPI['dropdown_max'];
}
$start = intval(($_POST['page'] - 1) * $_POST['page_limit']);
$limit = intval($_POST['page_limit']);
$LIMIT = "LIMIT {$start},{$limit}";
$one_item = -1;
if (isset($_POST['_one_id'])) {
$one_item = $_POST['_one_id'];
}
if ($one_item >= 0) {
$where .= " AND `glpi_netpoints`.`id` = '{$one_item}'";
} else {
if (strlen($_POST['searchText']) > 0) {
$where = " WHERE (`glpi_netpoints`.`name` " . Search::makeTextSearch($_POST['searchText']) . "\n OR `glpi_locations`.`completename` " . Search::makeTextSearch($_POST['searchText']) . ")";
} else {
$where = " WHERE 1 ";
}
}
if (!(isset($_POST["devtype"]) && $_POST["devtype"] != 'NetworkEquipment' && isset($_POST["locations_id"]) && $_POST["locations_id"] > 0)) {
if (isset($_POST["entity_restrict"]) && $_POST["entity_restrict"] >= 0) {
$where .= " AND `glpi_netpoints`.`entities_id` = '" . $_POST["entity_restrict"] . "'";
} else {
$where .= getEntitiesRestrictRequest(" AND ", "glpi_locations");
}
}
$query = "SELECT `glpi_netpoints`.`comment` AS comment,\n `glpi_netpoints`.`id`,\n `glpi_netpoints`.`name` AS netpname,\n `glpi_locations`.`completename` AS loc\n FROM `glpi_netpoints`\n LEFT JOIN `glpi_locations` ON (`glpi_netpoints`.`locations_id` = `glpi_locations`.`id`) ";
if (isset($_POST["devtype"]) && !empty($_POST["devtype"])) {
$query .= "LEFT JOIN `glpi_networkportethernets`\n ON (`glpi_netpoints`.`id` = `glpi_networkportethernets`.`netpoints_id`)\n LEFT JOIN `glpi_networkports`\n ON (`glpi_networkports`.`id` = `glpi_networkportethernets`.`id`\n AND `glpi_networkports`.`instantiation_type` = 'NetworkPortEthernet'\n AND `glpi_networkports`.`itemtype`";
if ($_POST["devtype"] == 'NetworkEquipment') {
示例4: getEntitiesRestrictRequest
$recursive = $item->maybeRecursive();
$where = getEntitiesRestrictRequest("WHERE", $_GET['table'], '', $entity, $recursive);
} else {
$where = "WHERE 1";
}
if (isset($_GET['used']) && !empty($_GET['used'])) {
$where .= " AND `id` NOT IN ('" . implode("','", $_GET['used']) . "') ";
}
if ($item->maybeDeleted()) {
$where .= " AND `is_deleted` = '0' ";
}
if ($item->maybeTemplate()) {
$where .= " AND `is_template` = '0' ";
}
if (strlen($_GET['searchText']) > 0) {
$search = Search::makeTextSearch($_GET['searchText']);
$where .= " AND (`name` " . $search . "\n OR `id` = '" . $_GET['searchText'] . "'";
if (FieldExists($_GET['table'], "contact")) {
$where .= " OR `contact` " . $search;
}
if (FieldExists($_GET['table'], "serial")) {
$where .= " OR `serial` " . $search;
}
if (FieldExists($_GET['table'], "otherserial")) {
$where .= " OR `otherserial` " . $search;
}
$where .= ")";
}
//If software or plugins : filter to display only the objects that are allowed to be visible in Helpdesk
if (in_array($_GET['itemtype'], $CFG_GLPI["helpdesk_visible_types"])) {
$where .= " AND `is_helpdesk_visible` = '1' ";
示例5: addWhere
/**
* Generic Function to add where to a request
*
* @param $link link string
* @param $nott is it a negative serach ?
* @param $itemtype item type
* @param $ID ID of the item to search
* @param $searchtype searchtype used (equals or contains)
* @param $val item num in the request
* @param $meta is a meta search (meta=2 in search.class.php)
*
* @return select string
**/
static function addWhere($link, $nott, $itemtype, $ID, $searchtype, $val, $meta = 0)
{
$searchopt =& Search::getOptions($itemtype);
$table = $searchopt[$ID]["table"];
$field = $searchopt[$ID]["field"];
$inittable = $table;
$addtable = '';
/*if ($table != getTableForItemType($itemtype)
&& $searchopt[$ID]["linkfield"] != getForeignKeyFieldForTable($table)) {
$addtable = "_".$searchopt[$ID]["linkfield"];
$table .= $addtable;
}*/
if (isset($searchopt[$ID]['joinparams'])) {
$complexjoin = Search::computeComplexJoinID($searchopt[$ID]['joinparams']);
if (!empty($complexjoin)) {
$table .= "_" . $complexjoin;
}
}
if ($meta && getTableForItemType($itemtype) != $table) {
$table .= "_" . $itemtype;
}
// Hack to allow search by ID on every sub-table
if (preg_match('/^\\$\\$\\$\\$([0-9]+)$/', $val, $regs)) {
return $link . " (`{$table}`.`id` " . ($nott ? "<>" : "=") . $regs[1] . " " . ($regs[1] == 0 ? " OR `{$table}`.`id` IS NULL" : '') . ") ";
}
// Preparse value
if (isset($searchopt[$ID]["datatype"])) {
switch ($searchopt[$ID]["datatype"]) {
case "datetime":
case "date":
case "date_delay":
$format_use = "Y-m-d";
if ($searchopt[$ID]["datatype"] == 'datetime') {
$format_use = "Y-m-d H:i:s";
}
// Parsing relative date
if ($val == 'NOW') {
$val = date($format_use);
}
if (preg_match("/^(-?)(\\d+)(\\w+)\$/", $val, $matches)) {
if (in_array($matches[3], array('YEAR', 'MONTH', 'WEEK', 'DAY', 'HOUR'))) {
$nb = intval($matches[2]);
if ($matches[1] == '-') {
$nb = -$nb;
}
// Use it to have a clean delay computation (MONTH / YEAR have not always the same duration)
$hour = date("H");
$minute = date("i");
$second = 0;
$month = date("n");
$day = date("j");
$year = date("Y");
switch ($matches[3]) {
case "YEAR":
$year += $nb;
break;
case "MONTH":
$month += $nb;
break;
case "WEEK":
$day += 7 * $nb;
break;
case "DAY":
$day += $nb;
break;
case "HOUR":
$hour += $nb;
break;
}
$val = date($format_use, mktime($hour, $minute, $second, $month, $day, $year));
}
}
break;
}
}
switch ($searchtype) {
case "contains":
$SEARCH = Search::makeTextSearch($val, $nott);
break;
case "equals":
if ($nott) {
$SEARCH = " <> '{$val}'";
} else {
$SEARCH = " = '{$val}'";
}
break;
case "notequals":
//.........这里部分代码省略.........
示例6: getEntitiesRestrictRequest
if (isset($_GET["entity_restrict"]) && !($_GET["entity_restrict"] < 0)) {
$where .= getEntitiesRestrictRequest("AND", $_GET['table'], "entities_id", $_GET["entity_restrict"], $multi);
if (is_array($_GET["entity_restrict"]) && count($_GET["entity_restrict"]) > 1) {
$multi = true;
}
} else {
$where .= getEntitiesRestrictRequest("AND", $_GET['table'], '', '', $multi);
if (count($_SESSION['glpiactiveentities']) > 1) {
$multi = true;
}
}
}
}
$field = "name";
if ($_GET['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND {$field} " . Search::makeTextSearch($_GET['searchText']);
}
$query = "SELECT *\n FROM `" . $_GET['table'] . "`\n {$where} ";
if ($config->fields['use_view_all_object'] && $_GET["name"] != "type") {
$query .= "ORDER BY `locations_id`";
} else {
if ($multi) {
$query .= " ORDER BY `entities_id`, {$field}\n {$LIMIT}";
} else {
$query .= " ORDER BY {$field}\n {$LIMIT}";
}
}
$result = $DB->query($query);
$out = array();
$number = $DB->numrows($result);
if ($number != 0 && $_GET["locations_id"] == -1) {
示例7: header
*/
/** @file
* @brief
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownSelectSoftwareLicense.php")) {
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkRight("software", "w");
// Make a select box
$rand = mt_rand();
$where = "";
if (strlen($_POST['searchText']) > 0 && $_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `glpi_softwares`.`name` " . Search::makeTextSearch($_POST['searchText']) . " ";
}
$where .= getEntitiesRestrictRequest(' AND', 'glpi_softwarelicenses', 'entities_id', $_POST["entity_restrict"], true);
$query = "SELECT DISTINCT `glpi_softwares`.`id`,\n `glpi_softwares`.`name`\n FROM `glpi_softwares`\n INNER JOIN `glpi_softwarelicenses`\n ON (`glpi_softwares`.`id` = `glpi_softwarelicenses`.`softwares_id`)\n WHERE `glpi_softwares`.`is_deleted` = '0'\n AND `glpi_softwares`.`is_template` = '0'\n {$where}\n ORDER BY `glpi_softwares`.`name`";
$result = $DB->query($query);
echo "<select name='softwares_id' id='item_type{$rand}'>\n";
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n";
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$softwares_id = $data["id"];
$output = $data["name"];
echo "<option value='{$softwares_id}' title=\"" . Html::cleanInputText($output) . "\">" . Toolbox::substr($output, 0, $_SESSION["glpidropdown_chars_limit"]) . "</option>";
}
}
echo "</select>\n";
$paramsselsoft = array('softwares_id' => '__VALUE__', 'entity_restrict' => $_POST['entity_restrict'], 'myname' => $_POST['myname']);
示例8: getEntitiesRestrictRequest
$where .= getEntitiesRestrictRequest("AND", "glpi_plugin_domains_domains", '', '', true);
}
if (isset($_POST['used'])) {
$where .= " AND `id` NOT IN (0";
if (is_array($_POST['used'])) {
$used = $_POST['used'];
} else {
$used = Toolbox::decodeArrayFromInput($_POST['used']);
}
foreach ($used as $val) {
$where .= ",{$val}";
}
$where .= ") ";
}
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `glpi_plugin_domains_domains`.`name` " . Search::makeTextSearch($_POST['searchText']);
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,{$NBMAX}";
if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
$query = "SELECT * \n\t\tFROM `glpi_plugin_domains_domains` \n\t\t{$where} \n\t\tORDER BY `entities_id`, `name` {$LIMIT}";
$result = $DB->query($query);
echo "<select name=\"" . $_POST['myname'] . "\">";
echo "<option value=\"0\">" . Dropdown::EMPTY_VALUE . "</option>";
if ($DB->numrows($result)) {
$prev = -1;
while ($data = $DB->fetch_array($result)) {
if ($data["entities_id"] != $prev) {
if ($prev >= 0) {
示例9: getSqlSearchResult
static function getSqlSearchResult($count = true, $entity_restrict = -1, $value = 0, $used = array(), $search = '')
{
global $DB, $CFG_GLPI;
// No entity define : use active ones
if ($entity_restrict < 0) {
$entity_restrict = $_SESSION["glpiactiveentities"];
}
$joinprofile = false;
$where = " `glpi_plugin_resources_resources`.`is_deleted` = '0'\n AND `glpi_plugin_resources_resources`.`is_leaving` = '0'\n AND `glpi_plugin_resources_resources`.`is_template` = '0' ";
$where .= getEntitiesRestrictRequest('AND', 'glpi_plugin_resources_resources', '', $entity_restrict, true);
if (is_numeric($value) && $value || count($used)) {
$where .= " AND `glpi_plugin_resources_resources`.`id` NOT IN (0";
if (is_numeric($value)) {
$first = false;
$where .= $value;
} else {
$first = true;
}
if (is_array($used)) {
foreach ($used as $val) {
if ($first) {
$first = false;
} else {
$where .= ",";
}
$where .= $val;
}
}
$where .= ")";
}
if ($count) {
$query = "SELECT COUNT(DISTINCT `glpi_plugin_resources_resources`.`id` ) AS cpt\n FROM `glpi_plugin_resources_resources` ";
} else {
$query = "SELECT DISTINCT `glpi_plugin_resources_resources`.*,\n `glpi_users`.`registration_number`,\n `glpi_users`.`name` AS username\n FROM `glpi_plugin_resources_resources`\n LEFT JOIN `glpi_plugin_resources_resources_items`\n ON (`glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`\n = `glpi_plugin_resources_resources`.`id`)\n LEFT JOIN `glpi_users`\n ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n AND `glpi_plugin_resources_resources_items`.`itemtype` = 'User') ";
}
if ($count) {
$query .= " WHERE {$where} ";
} else {
if (strlen($search) > 0 && $search != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND (`glpi_plugin_resources_resources`.`name` " . Search::makeTextSearch($search) . "\n OR `glpi_plugin_resources_resources`.`firstname` " . Search::makeTextSearch($search) . "\n OR `glpi_users`.`registration_number` " . Search::makeTextSearch($search) . "\n OR `glpi_users`.`name` " . Search::makeTextSearch($search) . "\n OR CONCAT(`glpi_plugin_resources_resources`.`name`,' ',`glpi_plugin_resources_resources`.`firstname`,' ',`glpi_users`.`registration_number`,' ',`glpi_users`.`name`) " . Search::makeTextSearch($search) . ")";
}
$query .= " WHERE {$where} ";
if ($_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE) {
$query .= " ORDER BY `glpi_plugin_resources_resources`.`firstname`,\n `glpi_plugin_resources_resources`.`name` ";
} else {
$query .= " ORDER BY `glpi_plugin_resources_resources`.`firstname`,\n `glpi_plugin_resources_resources`.`name` ";
}
if ($search != $CFG_GLPI["ajax_wildcard"]) {
$query .= " LIMIT 0," . $CFG_GLPI["dropdown_max"];
}
}
return $DB->query($query);
}
示例10: array
if (strstr($link, '[DOMAIN]')) {
// DOMAIN
if (isset($item->fields['domains_id'])) {
$shellExecute = "onClick=\"window.open('" . $CFG_GLPI["root_doc"] . "/plugins/shellcommands/front/shellcommand.exec.php?plugin_shellcommands_shellcommands_id=" . $shell_item->getName() . "&value=" . Dropdown::getDropdownName("glpi_domains", $item->getField('domains_id')) . "' ,'mywindow', 'height=300, width=700, top=100, left=100, scrollbars=yes' )\"";
}
} else {
if (strstr($link, '[IP]') || strstr($link, '[MAC]')) {
// IP or MAC
$ip = array();
$mac = array();
$resultSelectCommand[0] = Dropdown::EMPTY_VALUE;
$ipCount = 0;
$macCount = 0;
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
// if search text is called (ajax dropdown)
$where = " AND `glpi_networkports`.`name` " . Search::makeTextSearch($_POST['searchText']);
} else {
$where = '';
}
// We search all ip and mac addresses
$query2 = "SELECT `glpi_networkports`.*, `glpi_ipaddresses`.`name` as ip\n FROM `glpi_networkports`\n LEFT JOIN `glpi_networknames`\n ON (`glpi_networknames`.`items_id`=`glpi_networkports`.`id`) \n LEFT JOIN `glpi_ipaddresses`\n ON (`glpi_networknames`.`id`=`glpi_ipaddresses`.`items_id`) \n WHERE `glpi_networkports`.`items_id` = '" . $_POST['itemID'] . "' \n {$where} \n AND `glpi_networkports`.`itemtype` = '" . $item->getType() . "' \n ORDER BY `glpi_networkports`.`logical_number`";
$result2 = $DB->query($query2);
if ($DB->numrows($result2) > 0) {
while ($data2 = $DB->fetch_array($result2)) {
if (!empty($data2["ip"]) && $data2["ip"] != '0.0.0.0') {
if (!empty($data2["name"])) {
$ip[$ipCount]['name'] = $data2["name"];
} else {
$ip[$ipCount]['name'] = '(' . __('Network port') . ' ' . $data2["id"] . ')';
}
$ip[$ipCount]['ip'] = $data2["ip"];
示例11: getEntitiesRestrictRequest
}
}
if ($item->isEntityAssign()) {
// allow opening ticket on recursive object (printer, software, ...)
$where = getEntitiesRestrictRequest("WHERE", $table, '', $_SESSION['glpiactiveentities'], $item->maybeRecursive());
} else {
$where = "WHERE 1";
}
if ($item->maybeDeleted()) {
$where .= " AND `is_deleted` = '0' ";
}
if ($item->maybeTemplate()) {
$where .= " AND `is_template` = '0' ";
}
if (strlen($_REQUEST['searchText']) > 0 && $_REQUEST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$search = Search::makeTextSearch($_REQUEST['searchText']);
$where .= " AND (`name` " . $search . "\n OR `id` = '" . $_REQUEST['searchText'] . "'\n OR `serial` " . $search . "\n OR `otherserial` " . $search . ")";
}
//If software or plugins : filter to display only the objects that are allowed to be visible in Helpdesk
if (in_array($_REQUEST['itemtype'], $CFG_GLPI["helpdesk_visible_types"])) {
$where .= " AND `is_helpdesk_visible` = '1' ";
}
if (isset($_REQUEST['current_item']) && $_REQUEST['current_item'] > 0) {
$where .= " AND `id` != " . $_REQUEST['current_item'];
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,{$NBMAX}";
if ($_REQUEST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
$query = "SELECT *\n FROM {$table}\n {$where}\n ORDER BY `name`\n {$LIMIT}";
示例12: plugin_resources_addWhere
function plugin_resources_addWhere($link, $nott, $type, $ID, $val)
{
$searchopt =& Search::getOptions($type);
$table = $searchopt[$ID]["table"];
$field = $searchopt[$ID]["field"];
$SEARCH = Search::makeTextSearch($val, $nott);
switch ($table . "." . $field) {
case "glpi_plugin_resources_managers.name":
case "glpi_plugin_resources_recipients_leaving.name":
case "glpi_plugin_resources_recipients.name":
$ADD = " OR `" . $table . "`.`firstname` LIKE '%" . $val . "%' OR `" . $table . "`.`realname` LIKE '%" . $val . "%' ";
if ($nott && $val != "NULL") {
$ADD = " OR `{$table}`.`{$field}` IS NULL";
}
return $link . " (`{$table}`.`{$field}` {$SEARCH} " . $ADD . " ) ";
break;
}
return "";
}
示例13: die
}
if (!defined('GLPI_ROOT')) {
die("Can not acces directly to this file");
}
Session::checkLoginUser();
// Make a select box with preselected values
if (!isset($_POST["limit"])) {
$_POST["limit"] = $_SESSION["glpidropdown_chars_limit"];
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,{$NBMAX}";
$sql = "SELECT `id`, `name`, `ranking`\n FROM `glpi_rules`\n WHERE `sub_type` = '" . $_POST["type"] . "'";
if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
} else {
$sql .= " AND `name` " . Search::makeTextSearch($_POST['searchText']);
}
if (isset($_POST['entity_restrict']) && $_POST['entity_restrict'] != '') {
$sql .= " AND `glpi_rules`.`entities_id` = '" . $_POST['entity_restrict'] . "'";
}
$sql .= " ORDER BY `ranking` ASC " . $LIMIT;
$result = $DB->query($sql);
echo "<select id='dropdown_" . $_POST["myname"] . $_POST["rand"] . "' name='" . $_POST['myname'] . "' size='1'>";
if (isset($_POST['searchText']) && $_POST['searchText'] != $CFG_GLPI["ajax_wildcard"] && $DB->numrows($result) == $NBMAX) {
echo "<option value='0'>--" . __('Limited view') . "--</option>";
} else {
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>";
}
if ($DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$ID = $data['id'];
示例14:
exit;
}
$item = new $_POST['itemtype']();
// Make a select box with preselected values
if (!isset($_POST["limit"])) {
$_POST["limit"] = $CFG_GLPI["dropdown_chars_limit"];
}
$NBMAX = $CFG_GLPI["dropdown_max"];
$LIMIT = "LIMIT 0,{$NBMAX}";
if ($_POST['searchText'] == $CFG_GLPI["ajax_wildcard"]) {
$LIMIT = "";
}
$where = "WHERE `id` <> '" . $_POST['value'] . "' ";
$field = "name";
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"]) {
$where .= " AND `{$field}` " . Search::makeTextSearch($_POST['searchText']);
}
$query = "SELECT *\n FROM `" . $_POST['table'] . "`\n {$where}\n ORDER BY `{$field}`\n {$LIMIT}";
$result = $DB->query($query);
echo "<select id='dropdown_" . $_POST["myname"] . $_POST["rand"] . "' name=\"" . $_POST['myname'] . "\">";
if ($_POST['searchText'] != $CFG_GLPI["ajax_wildcard"] && $DB->numrows($result) == $NBMAX) {
echo "<option value='0\\'>--" . __('Limited view') . "--</option>";
} else {
echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>";
}
$number = $DB->numrows($result);
if ($number != 0) {
echo "<option value=\"" . $_POST['itemtype'] . ";-1\">" . __('All types', 'archires') . "</option>";
}
$output = Dropdown::getDropdownName($_POST['table'], $_POST['value']);
if (!empty($output) && $output != " ") {
示例15: plugin_projet_addWhere
function plugin_projet_addWhere($link, $nott, $type, $ID, $val)
{
$searchopt =& Search::getOptions($type);
$table = $searchopt[$ID]["table"];
$field = $searchopt[$ID]["field"];
$SEARCH = Search::makeTextSearch($val, $nott);
switch ($table . "." . $field) {
case "glpi_plugin_projet_projets_projets.plugin_projet_projets_id_1":
return $link . " ((`{$table}`.`plugin_projet_projets_id_2` = '{$val}')\n AND `glpi_plugin_projet_projets`.`id` <> '{$val}')";
break;
case "glpi_plugin_projet_tasks_tasks.plugin_projet_tasks_id_1":
return $link . " ((`{$table}`.`plugin_projet_tasks_id_2` = '{$val}')\n AND `glpi_plugin_projet_tasks`.`id` <> '{$val}')";
break;
}
return "";
}