ryxeo-glpi-git / ajax / autocompletion.php @ b67d8923
Historique | Voir | Annoter | Télécharger (2,28 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: autocompletion.php 7882 2009-01-23 18:24:05Z moyo $
|
4 |
-------------------------------------------------------------------------
|
5 |
GLPI - Gestionnaire Libre de Parc Informatique
|
6 |
Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
7 |
|
8 |
http://indepnet.net/ http://glpi-project.org
|
9 |
-------------------------------------------------------------------------
|
10 |
|
11 |
LICENSE
|
12 |
|
13 |
This file is part of GLPI.
|
14 |
|
15 |
GLPI is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
17 |
the Free Software Foundation; either version 2 of the License, or
|
18 |
(at your option) any later version.
|
19 |
|
20 |
GLPI is distributed in the hope that it will be useful,
|
21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
GNU General Public License for more details.
|
24 |
|
25 |
You should have received a copy of the GNU General Public License
|
26 |
along with GLPI; if not, write to the Free Software
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
--------------------------------------------------------------------------
|
29 |
*/
|
30 |
|
31 |
// ----------------------------------------------------------------------
|
32 |
// Original Author of file: Julien Dombre
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
|
37 |
define('GLPI_ROOT','..'); |
38 |
// Include plugin if it is a plugin table
|
39 |
if (!ereg("plugin",$_POST['table'])){ |
40 |
$AJAX_INCLUDE=1; |
41 |
} |
42 |
include (GLPI_ROOT."/inc/includes.php"); |
43 |
header("Content-Type: text/html; charset=UTF-8"); |
44 |
header_nocache(); |
45 |
|
46 |
checkLoginUser(); |
47 |
$entity=""; |
48 |
if (isset($_POST['entity_restrict'])&&$_POST['entity_restrict']>=0&&in_array($_POST['table'],$CFG_GLPI["specif_entities_tables"])){ |
49 |
$entity=" AND FK_entities='".$_POST['entity_restrict']."' "; |
50 |
} |
51 |
|
52 |
$query="SELECT DISTINCT `".$_POST['field']."` AS VAL FROM `".$_POST['table']."` WHERE `".$_POST['field']."` LIKE '".$_POST[$_POST['myname']]."%' AND `".$_POST['field']."` <> '".$_POST[$_POST['myname']]."' $entity ORDER BY `".$_POST['field']."` LIMIT 0,20"; |
53 |
if ($result=$DB->query($query)) |
54 |
if ($DB->numrows($result)>0){ |
55 |
echo "<ul class='autocomp'>"; |
56 |
while ($data=$DB->fetch_array($result)) |
57 |
echo "<li class='autocomp'>".cleanInputText($data["VAL"])."</li>"; |
58 |
echo "</ul>"; |
59 |
} |
60 |
|
61 |
?>
|