<?php


function T_WHO_CONNECTED_USER_SELECT() {
	global $thiss,$result;
	ZAP_SQL("select * from ADMIN_USERS where A_STATUS='NORMAL' and ADM_TECH_WORKER!='NO' and ADM_COMPANY like '$_SESSION[ADM_COMPANY]'");
	echo "<select name=T_WHO_CONNECTED><option value=''> </option>
	";
	while ($h = mysql_fetch_row($result)) {
		echo "\n<option value='".$h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['ADM_ACCOUNT']]."' " ;
		if ($_SESSION['CURRENT_MENU'] == 'USERS_EDIT' || $_SESSION['CURRENT_MENU'] == 'EDIT_TABLE_RECORD') {
			if (!empty($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDIT_TEMPLATE']['T_WHO_CONNECTED'])) {
				if ($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDIT_TEMPLATE']['T_WHO_CONNECTED'] == $h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['ADM_ACCOUNT']]) {
					echo " selected";
				}
			}
		} else {
			if (!empty($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDITRECORD']['T_WHO_CONNECTED'])) {
				if ($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDITRECORD']['T_WHO_CONNECTED'] == $h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['T_WHO_CONNECTED']])	echo " selected";
				else if ($_SESSION[$thiss->DETECT_TABLE_COLUMN]['EDITRECORD']['T_WHO_CONNECTED'] == $h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['ADM_ACCOUNT']])	echo " selected";
			}
		}
		echo ">" . $h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['ADM_NAME']] . "(". $h[$_SESSION['ADMIN_COLUMN']['DESC_TO_KEY']['ADM_ACCOUNT']] . ")</option>" ;
	}
	echo "</select>";
}
