コード例 #1
0
ファイル: group.class.php プロジェクト: geldarr/hack-space
 static function pdfChildren(PluginPdfSimplePDF $pdf, CommonTreeDropdown $item)
 {
     global $DB;
     $ID = $item->getID();
     $fields = $item->getAdditionalFields();
     $nb = count($fields);
     $entity_assign = $item->isEntityAssign();
     $fk = $item->getForeignKeyField();
     $crit = array($fk => $item->getID(), 'ORDER' => 'name');
     $pdf->setColumnsSize(100);
     $pdf->displayTitle(sprintf(__('Sons of %s'), '<b>' . $item->getNameID() . '</b>'));
     if ($item->haveChildren()) {
         if ($entity_assign) {
             if ($fk == 'entities_id') {
                 $crit['id'] = $_SESSION['glpiactiveentities'];
                 $crit['id'] += $_SESSION['glpiparententities'];
             } else {
                 $crit['entities_id'] = $_SESSION['glpiactiveentities'];
             }
             $pdf->setColumnsSize(30, 30, 40);
             $pdf->displayTitle(__('Name'), __('Entity'), __('Comments'));
         } else {
             $pdf->setColumnsSize(45, 55);
             $pdf->displayTitle(__('Name'), __('Comments'));
         }
         foreach ($DB->request($item->getTable(), $crit) as $data) {
             if ($entity_assign) {
                 $pdf->displayLine($data['name'], Html::clean(Dropdown::getDropdownName("glpi_entities", $data["entities_id"])), $data['comment']);
             } else {
                 $pdf->displayLine($data['name'], $data['comment']);
             }
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }