static function pdfItems(PluginPdfSimplePDF $pdf, Group $group, $tech, $tree, $user)
{
global $CFG_GLPI;
if ($tech) {
$types = $CFG_GLPI['linkgroup_tech_types'];
$field = 'groups_id_tech';
$title = __('Managed items');
} else {
$types = $CFG_GLPI['linkgroup_types'];
$field = 'groups_id';
$title = __('Used items');
}
$datas = array();
$max = $group->getDataItems($types, $field, $tree, $user, 0, $datas);
$nb = count($datas);
if ($nb < $max) {
$title = sprintf(__('%1$s (%2$s)'), $title, $nb / $max);
} else {
$title = sprintf(__('%1$s (%2$s)'), $title, $nb);
}
$pdf->setColumnsSize(100);
$pdf->displayTitle($title);
if ($nb) {
if ($tree || $user) {
$pdf->setColumnsSize(16, 20, 34, 30);
$pdf->displayTitle(__('Type'), __('Name'), __('Entity'), Group::getTypeName(1) . " / " . User::getTypeName(1));
} else {
$pdf->setColumnsSize(20, 25, 55);
$pdf->displayTitle(__('Type'), __('Name'), __('Entity'));
}
} else {
$pdf->displayLine(__('No item found'));
}
$tmpgrp = new Group();
$tmpusr = new User();
foreach ($datas as $data) {
if (!($item = getItemForItemtype($data['itemtype']))) {
continue;
}
$item->getFromDB($data['items_id']);
$col4 = '';
if ($tree || $user) {
if ($grp = $item->getField($field)) {
if ($tmpgrp->getFromDB($grp)) {
$col4 = $tmpgrp->getNameID();
}
} else {
if ($usr = $item->getField(str_replace('groups', 'users', $field))) {
$col4 = Html::clean(getUserName($usr));
}
}
}
$pdf->displayLine($item->getTypeName(1), $item->getName(), Html::clean(Dropdown::getDropdownName("glpi_entities", $item->getEntityID())), $col4);
}
$pdf->displaySpace();
}