<?php

function	dispAdminLinks()
{

if ($_SESSION["user_right"] < $GLOBALS["EPTV"] )
{
	return("T'es ouf");
}

$str = '
	
	<table width="80%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">

			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp a l l &nbsp l i n k s
				</font>
				</b> 
			</td>
			</tr>
				
			<FORM name="new_news" method="post" action="index.php?section=AdminHome&section_admin=AdminAddLink">
   			<TR>
  			<TD><INPUT class="button" TYPE="submit" NAME="action" VALUE="  NOUVEAU LIEN  "><BR> </TD>
			</TR>
 			</FORM>
		
			<tr>
			<td bgcolor="#d3d3df">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">

				';

	$result = getAllLinks();	

	
	if (mysql_num_rows($result)){
		for ($cpt = 0; $cpt < mysql_numrows($result); $cpt++) {
			$link = mysql_fetch_array($result);
			
			$element_id = $link["link_id"];
			
			$str .= '
				<TR>
				<TD>
				<b>
				'.$link["link_link"].'
				</b>
				</TD>
				</TR>

				<TR><TD>
				<font class="texte_normal">
				<small>
				'.$link["link_comment"].'
				</font>	
				</small>	
				</TD></TR>

			<TD width="20%" align="right">		
 			 	<FORM name="update_news" method="post" action="index.php?section=AdminHome&section_admin=AdminModifLink&element_id='.$element_id.'">
 			 	<INPUT class="button" TYPE="submit" NAME="action" VALUE="  MODIFIER  "> 
  				</FORM>
	

 				<FORM name="supp_news" method="post" action="index.php?section=AdminHome&section_admin=AdminDelLink&element_id='.$element_id.'">
 				<INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  ">
				</FORM>
			</TD>
			</TR>

 			<TR><TD>
  			 <hr width="90%">
			</TD></TR>


		';
		}
	}



$str .= '
				</TR>
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		</td>
		</tr>
	</table>
	
	';

return $str;


}

function	dispAdminAddLink() {

 $date = get_date();

 $str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp a d d &nbsp l i n k &nbsp t o &nbsp d a t a b a s e
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#d3d3df">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
		    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=AddLink&element_id='.$element_id.'">
		    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
			    <TR><TD> Lien: </TD>
			    <TD> <INPUT TYPE="text" NAME="input_get_link" VALUE="" SIZE="50" MAXLENGTH="52"> </TD>
			    </TR>
   
			    <TR><TD>Commentaire: </TD>
			    <TD>
			    <TEXTAREA rows="3" cols="38" name="input_get_comment" ONFOCUS=""></textarea>
			    </TD>
			    </TR>

			    <TR>
				    <TD> </TD>
				    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPLOADER  "> </TD>
			    </TR>
			    <TR>
			 	   <TD> </TD>
				   <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
		    </TABLE>
		    </FORM>
		</TR>
	</TABLE>
	</TD>
	</TR>
</TABLE>
';

return ($str);
}


function	dispAdminModifLink() {
 
 $element_id =$_GET['element_id'];

 $result = getOneLinkById($element_id);


$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp m o d i f y &nbsp l i n k
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#d3d3df">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

  if (mysql_num_rows($result)){
    $link = mysql_fetch_array($result);    
  }

  $str .= '
    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=ModifLink&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
	   
 		   <TR><TD> Lien: </TD>
		    <TD> <INPUT TYPE="text" NAME="input_get_link" VALUE="'.$link["link_link"].'" SIZE="30" MAXLENGTH="30"> </TD>
		    </TR>
    
		    <TR><TD>Commentaire: </TD>
		    <TD>
		    <TEXTAREA rows="5" cols="38" name="input_get_comment" ONFOCUS="">'.$link["link_comment"].'</textarea>
		    </TD>
		    </TR>
	    </TD>
	    </TR>

	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPDATE  "> </TD>
	    </TR>
	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
	    </TR>
 
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>
 
';

return $str;

}



function	dispAdminDelLink() {

$element_id =$_GET['element_id'];

$result = getOneLinkById($element_id);

$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp d e l e t e &nbsp l i n k
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
	<td bgcolor="#d3d3df">
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

	  if (mysql_num_rows($result)){
	    $link = mysql_fetch_array($result);    
	  }

	  $str .= '
	    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=DelLink&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
		    <TR><TD> Lien: </TD>
		    <TD>'.$link["link_link"].'</TD>
		    </TR>
    
		    <TR><TD>Commentaire: </TD>
		    <TD>
		    '.$link["link_comment"].'
		    </TD>
		    </TR>

		    <TR>
		    <TD> </TD>
		    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  "> </TD>
		    </TR>  
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>
';

return ($str);
}

?>