<?

    include ('header.php');
    GraphicAdmin();
    MainMenu();
    Max_OpenTable();
    $id_aide = intval($id_aide);
    $result1 = $db->sql_query("SELECT aide_probleme FROM ".$prefix."_nsnhelp_help where id_aide=$id_aide");
    list($aide_probleme1) = $db->sql_fetchrow($result1);
    if($aide_probleme1 !="3"){
    $db->sql_query("update ".$prefix."_nsnhelp_help set aide_probleme='1' where id_aide='$id_aide'");
    }
    $result2 = $db->sql_query("SELECT id_user_aide, user_name_aide, description_aide, fonction_titre FROM ".$prefix."_nsnhelp_help where id_aide=$id_aide");
    list($id_user_aide, $user_name_aide, $description_aide, $fonction_titre) = $db->sql_fetchrow($result2);
    $id_user_aide = intval($id_user_aide);
    $user_name_aide = stripslashes($user_name_aide);
    $description_aide = stripslashes($description_aide);
    $fonction_titre = stripslashes($fonction_titre);
    $result3 = $db->sql_query("SELECT user_email from ".$prefix."_users where username='$user_name_aide'");
    list($email) = $db->sql_fetchrow($result3);
    echo "<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    . "<tr><td width=\"100%\" colspan=\"2\" align=\"center\"><font class=\"content\"><strong>"._INFO_PSEUDO."</strong></font></td></tr>"
    . "<tr><td width=\"100%\" align=\"center\"><font class=\"content\"><br />"._PSEUDO." <b>$user_name_aide</b> [ <a href=\"mailto:$email?Subject=Re: Aide\">"._EMAILUSER."</a> | <a href='modules.php?name=Your_Account&op=userinfo&username=$user_name_aide'>"._USERPROFILE."</a> | <a href=\"modules.php?name=Private_Messages&amp;mode=post&amp;u=$id_user_aide\">"._SENDPM."</a> ]</font></td></tr></table>";
    Max_CloseTable();
    br('1');	
    Max_OpenTable();
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    . "<tr><td width=\"100%\" colspan=\"2\" align=\"center\"><font class=\"content\"><strong>"._HELP."</strong></font></td>"
    . "<tr><td width=\"100%\" align=\"center\"><br /><b><i>"._FONCTION."$fonction_titre</i></b><br /><br />$description_aide</tr></td></table>";
    Max_CloseTable();
    br('1');
    Max_OpenTable();
    echo "<table width=\"100%\" border=\"1\" cellspacing=\"2\" cellpadding=\"2\">"
    . "<tr><td width=\"100%\" colspan=\"2\" align=\"center\"><font class=\"content\"><strong>"._COMMENT_ADMIN."</strong></font></td></tr>";
    $result4 = $db->sql_query("SELECT id_aide_admin, aid, admin_avis, time FROM ".$prefix."_nsnhelp_admin where id_aide=$id_aide order by time ASC");
    while ($row = $db->sql_fetchrow($result4)) {
    $id_aide_admin = $db->XMFnum($row['id_aide_admin']);
    $aid_admin = intval($row['aid']);
    $admin_avis = $row['admin_avis'];
    $time_admin = $row['time'];
    $admin_avis = stripslashes($admin_avis);
    $dadate = BenDate($time_admin, $currentlang);
    echo "<tr><td width=\"100%\" align=\"center\"><br /><b>$aid_admin</b> "._AID_ADD." $dadate</td><tr><td width=\"100%\" align=\"center\"><br />$admin_avis<br /></td></tr>";
    }
    if($id_aide_admin == "" AND $aid_admin == ""){
    echo "<tr><td width=\"100%\" align=\"center\"><br />"._NO_COMMENT_ADMIN."</td></tr>";
    }
    if($aide_probleme1 < 3){
    echo "<form action=\"" . $admin_file . ".php?op=HelpWait&id_aide=$id_aide\" method=\"post\">"
    . "<br /><tr><td width=\"100%\" align=\"center\"><input type=\"submit\" value=\""._WAIT_HELP."\"></td></tr></form>";
    }
    echo "</table>";
    Max_CloseTable();
    br('1');
    Max_OpenTable();
    echo "<form action=\"" . $admin_file . ".php?op=SubmitAvisAide\" method=\"post\">"
    . "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
    . "<tr><td width=\"100%\" colspan=\"2\" align=\"center\"><font class=\"content\"><strong>"._AVIS_ADMIN."</strong></font></td><tr>"
    . "<tr><td width=\"50%\" align=\"center\"><br /><b>$aid</b>"._POST_HELP_INFO."</td></tr>"
    . "<tr><td  width=\"50%\" align=\"center\"><textarea cols=\"70\" rows=\"12\" name=\"aide_admin\"></textarea></td></tr>"
    . "<input type=\"hidden\" NAME=\"id_aide\" value=\"$id_aide\">"
    . "<input type=\"hidden\" NAME=\"action\" value=\"submit_avis\">"
    . "<tr><td width=\"50%\" align=\"center\"><input type=\"submit\" value=\""._VALIDATE."\"></td></tr>"
    . "</table>";
    Max_CloseTable();
    $db->sql_freeresult($result1);
    $db->sql_freeresult($result2);
    $db->sql_freeresult($result3);
    $db->sql_freeresult($result4);
    include ('footer.php');

?>
