<?php
$page="Liste des utilisateurs";
include_once("inc/header.inc.php");
if(isset($_GET['by']) && $_GET['by']!="")
{
$orderby=mysql_escape_string($_GET['by']);
}
else
{
$orderby="username";
}
if(isset($_GET['desc']))
{
$ordermode="DESC";
}
else
{
$ordermode="ASC";
}
$query="SELECT g.user_id, godf.username AS godfather_name, u.username AS username, u.user_regdate AS user_regdate FROM ".FORUM_PREFIX."user_group AS g
JOIN ".FORUM_PREFIX."users AS u ON u.user_id=g.user_id
JOIN gmt_users AS gmt ON gmt.user_id=g.user_id
LEFT JOIN ".FORUM_PREFIX."users AS godf ON godf.user_id=gmt.user_godfather
WHERE g.group_id='".FORUM_GROUP."' ORDER BY $orderby $ordermode";
$sql=new sql();
$sql->getArrayQuery($query);
$res=$sql->result;
echo "\n<table cellpadding=\"0\" width=\"100%\"><thead>\n<tr>";
echo "<th class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="user_id")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=user_id&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=user_id&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=user_id&desc")."\"><h5>";}
echo "ID</h5></a></div></th>\n";
echo "<th colspan=\"4\" class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="username")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=username&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=username&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=username&desc")."\"><h5>";}
echo "Nom</h5></a></div></th>\n";
echo "<th class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="user_status")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=user_status&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=user_status&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=user_status&desc")."\"><h5>";}
echo "Rang</h5></a></div></th>\n";
echo "<th class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="user_points")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=user_points&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=user_points&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=user_points&desc")."\"><h5>";}
echo "Points</h5></a></div></th>\n";
echo "<th class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="godfather_name")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=godfather_name&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=godfather_name&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=godfather_name&desc")."\"><h5>";}
echo "Parrain</h5></a></div></th>\n";
echo "<th class=\"ui-widget\"><div class=\"ui-widget-header ui-corner-all\" style=\"padding: 0 .7em;\"><a href=\"";
if($orderby=="user_regdate")
{
if($ordermode=="DESC")
{echo append_sid("users.php?by=user_regdate&asc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-s\"";}
else
{echo append_sid("users.php?by=user_regdate&desc")."\"><h5><span class=\"ui-icon-header ui-icon-triangle-1-n\"";}
echo " style=\"float: left; margin-right: .3em;\"></span>";
}
else{echo append_sid("users.php?by=user_regdate&desc")."\"><h5>";}
echo "Inscription</h5></a></div></th>\n";
echo "</tr></thead><tbody>\n";
for($i=0;$i<sizeof($res);$i++)
{
$curuser=new gmtuser($res[$i]['user_id']);
if($curuser->isValidUser())
{
echo "<tr><td align=\"center\"><text>".$curuser->id."</text></td>";
echo "<td align=\"center\"><text><a >\"window.open('','profile','width=300,height=300,left=200,top=200,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=yes')\" target=\"profile\" href=\"".append_sid("viewProfile.php?uid=".$curuser->id)."\">".$curuser->name."</a></text></td>\n";
//Actions
//View
echo "<td align=\"center\"><text><a >\"window.open('','profile','width=300,height=300,left=200,top=200,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=yes')\" target=\"profile\" href=\"".append_sid("viewProfile.php?uid=".$curuser->id)."\" class=\"ui-icon ui-icon-search\"></a></text></td>\n";
//Edit
if(($gmtuser->status>$curuser->status && $gmtuser->status>=STATUS_ADMINISTRATOR) )//|| $gmtuser->id==$curuser->id)
{
echo "<td align=\"center\"><text><a >\"window.open('','profile','width=300,height=300,left=200,top=200,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=yes')\" target=\"profile\" href=\"".append_sid("editProfile.php?uid=".$curuser->id)."\" class=\"ui-icon ui-icon-wrench\"></a></text></td>\n";
}
else
{
echo "<td/>";
}
//Delete
if(($gmtuser->status>$curuser->status && $gmtuser->status>=STATUS_ADMINISTRATOR))
{
echo "<td align=\"center\"><text><a >\"window.open('','profile','width=300,height=300,left=200,top=200,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=yes')\" target=\"profile\" href=\"".append_sid("deleteProfile.php?uid=".$curuser->id)."\" class=\"ui-icon ui-icon-trash\"></a></text></td>\n";
}
else
{
echo "<td/>";
}
echo "<td align=\"center\"><text>".GetRankName($curuser->status)."</text></td>";
echo "<td align=\"center\"><text>".$curuser->points."</text></td>";
echo "<td align=\"center\"><text><a >\"window.open('','profile','width=300,height=300,left=200,top=200,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=yes')\" target=\"profile\" href=\"".append_sid("viewProfile.php?uid=".$curuser->godfather->id)."\">".$curuser->godfather->name."</a></text></td>\n";
echo "<td align=\"center\"><text>".$curuser->regdate."</text></td></tr>\n";
}
}
echo "</tbody></table>";
include_once("inc/footer.inc.php");
?>