예제 #1
0
function valider_utf8($s)
{
    /*
    	 if ( mb_detect_encoding($s, "UTF-8") == "UTF-8")
    	 	return $s;
    	 else 
    	 	return utf8_encode($s);
    */
    if (valid_utf8($s)) {
        return $s;
    } else {
        return utf8_encode($s);
    }
}
예제 #2
0
function csc($s)
{
    if (valid_utf8($s)) {
        return $s;
    } else {
        return iconv(get_option("dccharset"), "UTF-8", $s);
    }
}
예제 #3
0
function Aff_feed_closeTab ($mode, $filter,$tri) {

    global $mnuchoice;
    // Recherche dans la table maint_task si il existe des demandes en attente de traitement
    $filter= mktime(0, 0, 0, 10, 0, 2010);
    $sens = "ASC";
    if ( $tri == "emetteur") $tri="Owner";
    elseif ( $tri == "prisencharge") $tri="Author";
    else { $tri="OpenTimeStamp"; $sens = "DESC"; }
    $cols = array(
        "Rid"=>"N°",
        "Owner"=>"Emetteur",
        "Author"=>"Traité par",
        "Room"=>"Salle",
        "NumComp"=>"Ordi.",
        "Mark"=>"Marque",
        "Os"=>"Os",
        "Cat"=>"Origine",
        "Content"=>"Demande",
        "OpenTimeStamp"=>"Date",
        "TakeTimeStamp"=>"PeC.",
        "CloseTimeStamp"=>"Clôture",
        "BoosTimeStamp"=>"Relance",
        "TimeLife"=>"Temps",
        "Cost"=>"Coût"
     );
    Aff_tHead($cols );
    $requete = mysql_query("SELECT * FROM maint_task WHERE (OpenTimeStamp>$filter AND Acq='2' ) ORDER BY $tri $sens");
    while($row = mysql_fetch_array($requete)) {
        $Rid=$row["Rid"];
        $cout=0;
        $requete1 = mysql_query("SELECT * FROM maint_thread WHERE (TopRid='$Rid')");
        // Affichage du feed du rapport d'intervention
        $comments="";
        while($row1 = mysql_fetch_array($requete1)) {
            $timelife = $row1['TimeLife'] == 0 ? 5 : $timelife+$row1['TimeLife'];
            $cout = $row1['Cost'] == 0 ? $cout : $cout+$row1['Cost'];
            $comments .= "<div class=\"bold\">R&#233;ponse du ".dateFR( $row1['TimeStamp'])."</div>";
            $comments .= "<div >".$row1['Content']."</div><hr/>";
        }
        $html .=  "<tr>";
        $tempsPasse = intval($row['CloseTimeStamp']) - intval($row['TakeTimeStamp']);
        foreach($cols as $k=>$col) {
            $hTd = "<td ";
            if( $k=="Rid")
            $hTd .= " class=\"collapsible\" rowspan=\"2\"";
            if( $k=="Owner" || $k=="Author" || $k=="Room" || $k=="NumComp" || $k=="Os" || $k=="Mark" )
            $hTd .= " rowspan=\"2\"";
            if( $k=="Cat" )
            $hTd .= " class=\"collapsible_alt\" rowspan=\"2\"";
            //	if($col=="OwnerMail")
            if($k=="Owner") $hTd .= " title=\"".$row['OwnerMail']."\">".$row[$k]."</td>";
            else if($k=="Room") $hTd .= "title=\"Secteur : ".$row['Sector'].", Bat : ".valid_utf8($row['Bat'])."\">".valid_utf8($row[$k]) ."</td>";
            else if($k=="BoosTimeStamp" ){ $rl=$row[$k] ==0?0:1;$hTd .= " title=\"Date : ".strftime("%d-%m-%Y - %H.%M",$row["BoosTimeStamp"])."\">".$rl."</td>";}
            else if($k=="Content") {
                $ctnt = test_utf8( $row[$k] ) ? $row[$k] : utf8_encode($row[$k]);
                $hTd .= "title=\"Secteur : ".$row['Sector'].", Bat : ".$row['Bat']."\" style=\"width: 265px;\">".$ctnt."</td>";
            }
            else if($k=="OpenTimeStamp") $hTd .= "> ".dateFR( $row["OpenTimeStamp"])." </td>";
            else if($k=="CloseTimeStamp") $hTd .= "> ".dateFR( $row["CloseTimeStamp"])." </td>";
            else if($k=="TakeTimeStamp") $hTd .= "> ".dateFR( $row["TakeTimeStamp"])." </td>";
            else if($k=="TimeLife") $hTd .= ">".intval($timelife)." mn </td>";
            else if($k=="Cost") $hTd .= ">".$cout." &#128;</td>";
            else {
                $ctnt = test_utf8( $row[$k] ) ? $row[$k] : utf8_encode($row[$k]);
                $hTd .=   ">".$ctnt ."</td>\n";
            }
            $html .=   $hTd;
        }
        $html .= "</tr>";
        $html .= "<tr  class=\"expand-child\">";
        $html .= "<td style=\"display: none;\" colspan=\"7\">";
        $html .= test_utf8( $comments ) ? $comments : utf8_encode( $comments );
        $html .= "</td></tr>";
    }  //fin du while
    $html .= "</tbody>";
    $html .= "</table>";
    echo $html;
}