<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="title" content="Trombinoscope" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="stylesheet" href="css/index.css" />
<title>Espace Collaboratif - Trombinoscope</title>
</head>
<body>
<div id="header">
<a href='..'><img src="./img/logo.png" alt="aucune" id='logo'/></a>
<nav>
<ul>
<li><a href="..">Accueil</a></li>
<li class="active"><a href="../trombi">Trombinoscope</a></li>
<li><a href="../signature">Générateur Signature</a></li>
<li><a href="../ged">Base Documentaire</a></li>
<li><a href="../journal">Journal Interne</a></li>
</ul>
</nav>
</div>
<div id='haut'></div>
<div id="content">
<form method="post" action="search.php">
<?php
include('accesBD.Script.php');
$BD = new accesBD;
$tab = array("07","06","02");
function wd_remove_accents($str, $charset='utf-8')
{
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. 'œ'
$str = preg_replace('#&[^;]+;#', '', $str); // supprime les autres caractères
return $str;
}
if(isset($_POST['search']))
{
$str = wd_remove_accents($_POST['searchValue']);
$value= str_replace(' ','%',strtoupper($str));
$value= str_replace("'","''",strtoupper($value));
$count=1; //comptage pour le nombre de fiche employé par ligne
foreach ($tab as &$val) {
if (preg_match("/$val/i", ".$value.")) {
$value = wordwrap("$value",2,".",1);
}
}
$test = $BD->SearchEmployes($value);
if (mysqli_num_rows($test) == 0) {
echo "Désolé";
} else {
?>
<table id="employe">
<?php
$var2 = "";
while($result = mysqli_fetch_array($test))
{
$var1 = $result['ID_SITE'];
if($var1 != $var2)
{
$var2 = $var1;
$affiliation= $result['NOM_SITE'];
$count=1;
echo '<tr><td colspan="2"><h3>'.$affiliation.'</h3></td></tr>';
}
if($count == 1)
// Si c'est la première fiche employé (sur 2) alor
echo '<tr>';
echo '<td>';
echo ' <img src="./upload_img/img/'.$result['ID_EMP'].'.jpg" onerror="this.src=\'./img/no-image.jpg\'" alt="" style="width:150px;height:150px;">';
echo '</td>';
echo '<td>';
echo '<table>';
echo '<tr><td>Nom</td><td>'.$result['NOM_EMP']." ".$result['PRENOM_EMP'].'</td></tr>';
echo '<tr><td>Poste</td><td>'.$result['LIBELLE_JOB'].'</td></tr>';
echo '<tr><td>Adresse</td><td>'.$result['ADRESSE']." ".$result['ADRESSE2'].'</td></tr>';
echo '<tr><td>Téléphone</td><td>'.$result['TEL_FIX'].'</td></tr>';
echo '<tr><td>Portable</td><td>'.$result['TEL_PORTABLE'].'</td></tr>';
echo '<tr><td>Email</td><td><a href="mailto:'.$result['EMAIL'].'">'.$result['EMAIL'].'</a></td></tr>';
echo '</table>';
echo '</td>';
if($count == 2)
{
$count = 1; //remise à 1.
echo '</tr>'; //Fermer la ligne de la table
}
else{
$count++;
}
}
if($count < 2)
echo "</table>";
}
}
?></form>
<div id="footer">
<div class="recherche">
<div class='retour'><a href='./index.php'><img src="./img/retour.png"></a></div>
<div class='imprimer'><a href="export_pdf.php">Télécharger le pdf</a></div>
<div class='top'><a href='#haut'><img src="./img/top.png"></a></a></div>
</div>
<div id="copyright">Copyright © GROUPE LE DU</div>
</div>
</div>
</body>
</html>