<?

class connect_cfor0100 extends stdICHModule {


	// Constructor
	function connect_cfor0100($lng_code){
		global $globalSettings;
	
		$this->stdICHModule("cfor0100", $lng_code);

		require_once $globalSettings->ti3a0365->paths->ddi;

		$this->_i3a = new troyceI3A();
		
	}

	function updateUserRecord($params) {

		$usr_id = $params[0];

		if (is_numeric($usr_id)) {

			$this->_i3a->getUsers($users, array(array('USR_ID', ' = '.$usr_id)), array('GATT_PHOTO'));
			$userdata = current($users);
			$rs = $this->_db->Query("SELECT usr_id FROM tbl_for_user WHERE usr_id = ".$usr_id);

			if ($rs->EOF()) {
				$sql = "INSERT INTO tbl_for_user SET 
							usr_id		 = ". $usr_id ."
						,	usr_fullname = '". $this->_i3a->getUserGreeting($usr_id, false)."'
						,	usr_photo_id = ".($userdata['GATT_PHOTO'] ? $userdata['GATT_PHOTO'] : 'NULL');
			
			} else {


				$sql = "UPDATE tbl_for_user SET 
							usr_fullname = '". $this->_i3a->getUserGreeting($usr_id, false)."'
						,	usr_photo_id = ".($userdata['GATT_PHOTO'] ? $userdata['GATT_PHOTO'] : 'NULL')." 
						WHERE usr_id = ". $usr_id;
			}

			$this->_db->Execute($sql);

		}
	}
	

}


?>