1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
function recupereCampagne()
{
$req="select * from phoning ;";
$res=mysql_query($req);
$j=0;
while($ligne=mysql_fetch_array($res))
{
$tab[0][$j] = $ligne['id'];
$tab[1][$j] = $ligne['dateDebut'];
$tab[2][$j] = $ligne['libelle'];
$tab[3][$j] = $ligne['cloture'];
$j++;
}
$req="select * from mailing ;";
$res=mysql_query($req);
while($ligne=mysql_fetch_array($res))
{
$tab[0][$j] = $ligne['id'];
$tab[1][$j] = $ligne['dateDebut'];
$tab[2][$j] = $ligne['libelle'];
$tab[3][$j] = $ligne['cloture'];
$j++;
}
$req="select * from faxing ;";
$res=mysql_query($req);
while($ligne=mysql_fetch_array($res))
{
$tab[0][$j] = $ligne['id'];
$tab[1][$j] = $ligne['dateDebut'];
$tab[2][$j] = $ligne['libelle'];
$tab[3][$j] = -1;
$j++;
}
$this->afficheListeCampagne($tab);
}
function compare($a, $b)
{
$date1=$a;
$heure1 = $date1['hours'];
$minute1 = $date1['minutes'];
$seconde1 = $date1['seconds'];
$mois1 = $date1['mon'];
$jour1 = $date1['mday'];
$annee1 = $date1['year'];
$date2=$b;
$heure2 = $date2['hours'];
$minute2 = $date2['minutes'];
$seconde2 = $date2['seconds'];
$mois2 = $date2['mon'];
$jour2 = $date2['mday'];
$annee2 = $date2['year'];
$nbsec1 = mktime ($heure1, $minute1, $seconde1, $mois1, $jour1, $annee1);
$nbsec2 = mktime ($heure2, $minute2, $seconde2, $mois2, $jour2, $annee2);
if($nbsec1<$nbsec2) return -1;
else if($nbsec1>$nbsec2) return 1;
else return 0;
}
function afficheListeCampagne($tab)
{
usort ($tab, "compare");
echo '<table border=1 valign="center" align="center">';
echo '<tr bordercolor="black" style="color:#FF0000">';
echo '<td width="180" align="center">' ."Début de la campagne". '</td>';
echo '<td width="180" align="center">' ."Libelle". '</td>';
echo '<td width="180" align="center">' ."Cloture". '</td>';
echo '</tr>';
$j=0;
while(isset($tab[0][$j]))
{
echo '<tr bordercolor="black">';
echo '<td width="180" align="center">' .$tab[1][$j]. ' ' . '</td>';
echo '<td width="180" align="center">' .$tab[2][$j]. ' ' . '</td>';
$clo=$tab[3][$j];
if($clo==0)
echo '<td width="180" align="center">' ."En cours". '</td>';
else if($clo==1)
echo '<td width="180" align="center">' ."Terminé". '</td>';
else
echo '<td width="180" align="center">' ."Etat inconnu". '</td>';
echo '</tr>';
$j++;
}
echo '</table>';
} |
Partager