<?
/*---------------------------------------------------+
| HoloCMS - Website and Content Management System
+----------------------------------------------------+
| Copyright © 2008 Meth0d
+----------------------------------------------------+
| HoloCMS is provided "as is" and comes without
| warrenty of any kind.
| Wow wtf, why are you looking at my source?
| It was only released for teh faggot :D
| Fuck off out of my source
+---------------------------------------------------*/
@include('./global.php');
@include('../global.php');
include('templates/community_subheader.php');
// start it blud
$sql = mysql_query("SELECT * FROM cms_staffpick WHERE type='room'"); 
?>
<div id="tab-1-3-1-content" style=""><div id="staffpicks-rooms-habblet-list-container" class="habblet-list-container groups-list">
    <ul class="habblet-list">
<?
while($row = mysql_fetch_assoc($sql)){
	// oh shit the even shit.
	
	
	$id = $row['rec_id'];
	$getem = mysql_fetch_assoc(mysql_query("SELECT * FROM rooms WHERE id=".$id.""));
	if(!empty($getem['id'])){
		$i++; // fucking not a clue but it seems to do this in all the other sources so, why am i any different? xD
		/* Below(Not coded by myself ripped from community php - credited where needed) */
			// Calculate percentage
        if($getem['users_now'] == 0){ $getem['users_now'] = 0; }
        $data[$i] = ($getem['users_now'] / $getem['users_max']) * 100;

        // Base room icon based on this - percantage levels may not be habbolike
        if($data[$i] == 99 || $data[$i] > 99){
            $room_fill = 5;
        } elseif($data[$i] > 65){
            $room_fill = 4;
        } elseif($data[$i] > 32){
            $room_fill = 3;
        } elseif($data[$i] > 0){
            $room_fill = 2;
        } elseif($data[$i] < 1){
            $room_fill = 1;
        }
        /* Above(Not coded by myself ripped from community php - credited where needed) */
        
					if(IsEven($i)){
				 $even = "even room-occupancy-$room_fill";
      		  } else {
      			 $even = "odd room-occupancy-$room_fill";
        			} ?>
        			<li class="<?php echo $even; ?>">
            <div>
                <span class="room-name"><a href="<?php echo $path; ?>client.php?forwardId=2&amp;roomId=<?php echo $id; ?>" target="client" onclick="openOrFocusHabbo('client.php'); return false;"><?php echo $getem['caption'];?></a></span>
                <span class="room-owner"><a href="user_profile.php?name=<?php echo $getem['owner']; ?>"><?php echo $getem['owner']; ?></a></span>
                <p><? echo htmlspecialchars($getem['description']); ?></p>
            </div>		
	<?	
	}else{
		echo '<br />D&eacute;sol&eacute;: aucun appart a afficher.';
	}
	}
?>
</li>
</ul>
</div>
</div>	
