<?php
//Class for obtain some informations about a round (song, room, ...)

class Round
{
	private $id_round;
	
	/**
	 * @name GetPlayersRoundKey
	 * @return array
	 * @desc Return the Player_ID and Round_Key ok the players of the round
	 */
	function GetPlayersRoundKey()
	{
		$r_res=mysql_query('SELECT pid,round_key FROM player_stats WHERE round_id='.$this->id_round);
		while($a_data=mysql_fetch_assoc($r_res))
		{
			$a_infos[]=$a_data['round_key'];
		}
		return $a_infos;
	}
	
	/**
	 * @name GetRoundSong
	 * @return int
	 * @desc Return the Song_ID of the round
	 */
	function GetRoundSong ()
	{
		$r_res=mysql_query('SELECT song_ID FROM rounds WHERE round_id='.$this->id_round);
		return mysql_result($r_res,0,0);
	}
	
	/**
	 * @name GetRoundPlayTime
	 * @return timestamp
	 * @desc Return the date (timestamp format) of the round
	 */
	function GetRoundPlayTime ()
	{
		$r_res=mysql_query('SELECT playtime FROM rounds WHERE round_id='.$this->id_round);
		return mysql_result($r_res,0,0);
	}
	
	/**
	 * @name GetRoundRoomName
	 * @return string
	 * @desc Return the RoomName of the round
	 */
	function GetRoundRoomName ()
	{
		$r_res=mysql_query('SELECT roomname FROM rounds WHERE round_id='.$this->id_round);
		return mysql_result($r_res,0,0);
	}
	
	/**
	 * @name SetRoundID
	 * @param i_rid - int
	 * @desc Set the Round_ID used by the class
	 */
	function SetRoundID ($i_rid)
	{
		$this->id_round=$i_rid;
	}
	
/**
	 * @name GetRoundID
	 * @desc return the Round_ID used by the class
	 */
	function GetRoundID ()
	{
		return $this->id_round;
	}
}
?>