You are not logged in.
Bonjour,
Suite à un besoin d'afficher les modèles de matériel pour un utilisateur sélectionné via le menu administration-utilisateurs onglet matériel, le code source du fichier user.function.php a été modifié et permet cet affichage.
Pour ceux que cela pourrait interessé, je joins le code modifié à partir de la ligne 110 vers 180 environ :
$ci=new CommonItem();
//modif 1
//echo "<div class='center'><table class='tab_cadre_fixe'><tr><th>".$LANG["common"][17]."</th><th>".$LANG["common"][16]."</th><th>".$LANG["common"][19]."</th><th>".$LANG["common"][20]."</th><th> </th></tr>";
echo "<div class='center'><table class='tab_cadre_fixe'><tr><th>".$LANG["common"][17]."</th><th>".$LANG["common"][16]."</th><th>".$LANG["common"][19]."</th><th>".$LANG["common"][20]."</th><th>".$LANG["common"][22]."</th><th> </th></tr>";
foreach ($CFG_GLPI["linkuser_types"] as $type){
if (haveTypeRight($type,'r')){
$query="SELECT * FROM ".$LINK_ID_TABLE[$type]." WHERE FK_users='$ID'";
$result=$DB->query($query);
if ($DB->numrows($result)>0){
$ci->setType($type);
$type_name=$ci->getType();
$cansee=haveTypeRight($type,"r");
while ($data=$DB->fetch_array($result)){
$link=$data["name"];
if ($cansee) $link="<a href='".$CFG_GLPI["root_doc"]."/".$INFOFORM_PAGES[$type]."?ID=".$data["ID"]."'>".$link.(($CFG_GLPI["view_ID"]||empty($link))?" (".$data["ID"].")":"")."</a>";
//modif 2
//$linktype="";
switch ($LINK_ID_TABLE[$type]) {
case 'glpi_computers':
$query_model="SELECT name FROM glpi_dropdown_model WHERE ID='".$data["model"]."'";
break;
case 'glpi_printers':
$query_model="SELECT name FROM glpi_dropdown_model_printers WHERE ID='".$data["model"]."'";
break;
case 'glpi_monitors':
$query_model="SELECT name FROM glpi_dropdown_model_monitors WHERE ID='".$data["model"]."'";
break;
case 'glpi_peripherals':
$query_model="SELECT name FROM glpi_dropdown_model_peripherals WHERE ID='".$data["model"]."'";
break;
case 'glpi_phones':
$query_model="SELECT name FROM glpi_dropdown_model_phones WHERE ID='".$data["model"]."'";
break;
/*case 'glpi_software':
$query_model="SELECT name FROM glpi_dropdown_model_software WHERE ID='".$data["model"]."'";
break;
case 'glpi_networking':
$query_model="SELECT name FROM glpi_dropdown_model_networking WHERE ID='".$data["model"]."'";
break;
*/
default :
//Pas de model dans ces cas
$query_model=Null;
break;
}
if ($query_model != NULL) {
$result_model=$DB->query($query_model);
if ($DB->numrows($result_model)>0) {
$row=$DB->fetch_row($result_model);
$linktype=$row[0];
} else {
$linktype=$LANG["common"][54];
}
$DB->free_result($result_model);
} else {
$linktype=$LANG["common"][54];
}
/*if ($data["FK_users"]==$ID){
//modif 3
$linktype=$LANG["common"][44];
}*/
echo "<tr class='tab_bg_1'><td class='center'>$type_name</td><td class='center'>$link</td>";
echo "<td class='center'>";
if (isset($data["serial"])&&!empty($data["serial"])){
echo $data["serial"];
} else echo ' ';
echo "</td><td class='center'>";
if (isset($data["otherserial"])&&!empty($data["otherserial"])) {
echo $data["otherserial"];
} else echo ' ';
//modif 4
echo "<td class='center'>$linktype</td></tr>";
}
}
}
}
Offline