<?
header("Pragma: no-cache");

$list = new iconlist($_GET['tabid']);



//$db->debug=1;
$rs = $db->query("SELECT * FROM ".$settings->config['users_tablename'].",".$settings->config['interauth_tablename'].",".$settings->config['auth_tablename'].",".$settings->config['optinfo_tablename']." WHERE ".$settings->config['users_tablename'].".gid='".$sys['gid']."' AND ".$settings->config['interauth_tablename'].".username=".$settings->config['auth_tablename'].".username AND ".$settings->config['interauth_tablename'].".id=".$settings->config['users_tablename'].".id AND ".$settings->config['optinfo_tablename'].".uid=".$settings->config['interauth_tablename'].".id ORDER BY ".$settings->config['auth_tablename'].".username ASC");
//$db->debug=0;

while (!$rs->EOF) {



$listViewDetails = "";
$listViewDetails .= $rs->fields["firstname"];
if ($rs->fields["lastname"]) {
	if (strlen($listViewDetails) > 0) {
		$listViewDetails .= " ";
	}
$listViewDetails .= $rs->fields["lastname"];
}

if ($rs->fields["email"]) {
	if (strlen($listViewDetails) > 0) {
		$listViewDetails .= ", ";
	}
	$listViewDetails .= $rs->fields["email"];
}

if ($rs->fields["company"]) {
	if (strlen($listViewDetails) > 0) {
		$listViewDetails .= ", ";
	}
	$listViewDetails .= $rs->fields["company"];
}




			$data['name'] = $rs->fields["username"];
			$data['lcname'] = strtolower($data['name']);
			$data['filetypedescription'] = $listViewDetails;
			$data['icon_img'] = "images/tree/afn.gif";
			$data['thumb_img'] = "images/tree/afn.gif";
			$data['list_img'] = "images/tree/afn.gif";
			$data['filetype'] = "user"; //?
			$data['ondblclick'] = "AdmUsersSummary('".$rs->fields['id']."')";
			$data['input_value'] = $rs->fields['id'];
			$data['extra'] = "";
			
			$list->setIcon($data);
			
			$rs->MoveNext();
}


?>
<script>
tb = parent.AfianHandler['allTabs']['<?echo $_GET['tabid'];?>'];
if (tb != undefined) {
tb.removeAll();
}
<?

for ($i = 0 ; $i < sizeof($list->icons) ; $i++) {
	$list->drawIcon($list->icons[$i]);
}

?>

if (tb != undefined) {
	parent.cancelTimeOut(tb.id);
	tb.buildItems();
	if (tb.active) {
	tb.showItems();
	parent.toggleTreeByPath('admin_users@afian');
	}
	tb.hideHourGlass();
	tb.countSelected = 0;
	tb.onselect();
	tb.browsed = true;
	tb.onload();
}
</script>