users_autocomplete_list.php 1.67 KB
Newer Older
SNA's avatar
SNA committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?php
/*
*    Copyright 2008,2009 Maarch
*
*  This file is part of Maarch Framework.
*
*   Maarch Framework is free software: you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation, either version 3 of the License, or
*   (at your option) any later version.
*
*   Maarch Framework is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
*/

SNA's avatar
SNA committed
21
require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php");
SNA's avatar
SNA committed
22 23 24 25 26

$req = new request();

$select = array();
$select[$_SESSION['tablename']['users']]= array('lastname', 'firstname', 'user_id');
27

28 29
$where = " (lower(lastname) like lower(:input) "
	."or lower(firstname) like lower(:input) "
30
	."or user_id like :input) and (status = 'OK' or status = 'ABS') " . $enabledUser;
SNA's avatar
SNA committed
31 32 33

$other = 'order by lastname, firstname';

34 35 36
$arrayPDO = array(":input" => $_REQUEST['Input']."%");

$res = $req->PDOselect($select, $where, $arrayPDO, $other, $_SESSION['config']['databasetype'], 11,false,"","","", false);
SNA's avatar
SNA committed
37 38 39 40

echo "<ul>\n";
for($i=0; $i< min(count($res), 10)  ;$i++)
{
41 42
	echo "<li>".functions::xssafe(functions::show_string($res[$i][0]['value']))
		.', ' . functions::xssafe(functions::show_string($res[$i][1]['value']))
Giovannoni Laurent's avatar
Giovannoni Laurent committed
43
		.' (' . functions::xssafe($res[$i][2]['value']).")</li>\n";
SNA's avatar
SNA committed
44 45 46 47 48
}
if(count($res) == 11)
{
	echo "<li>...</li>\n";
}
SNA's avatar
SNA committed
49
echo "</ul>";