static function pdfForSoftware(PluginPdfSimplePDF $pdf, Software $software, $infocom = false)
 {
     global $DB;
     $sID = $software->getField('id');
     $license = new SoftwareLicense();
     $query = "SELECT `id`\n                FROM `glpi_softwarelicenses`\n                WHERE `softwares_id` = '" . $sID . "' " . getEntitiesRestrictRequest('AND', 'glpi_softwarelicenses', '', '', true) . "\n                ORDER BY `name`";
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . _n('License', 'Licenses', 2) . '</b>');
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result)) {
             for ($tot = 0; $data = $DB->fetch_assoc($result);) {
                 if ($license->getFromDB($data['id'])) {
                     self::pdfMain($pdf, $license, false);
                     if ($infocom) {
                         PluginPdfInfocom::pdfForItem($pdf, $license);
                     }
                 }
             }
         } else {
             $pdf->displayLine(__('No item found'));
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
Exemple #2
0
 /**
  * export Tab content - classic content use by various object
  *
  * @since version 0.83
  *
  * @param $pdf          PluginPdfSimplePDF object for output
  * @param $item         CommonGLPI object for which the tab need to be displayed
  * @param $tab   string tab number
  *
  * @return true if display done (else will search for another handler)
  **/
 static final function displayCommonTabForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab)
 {
     switch ($tab) {
         case '_main_':
             static::pdfMain($pdf, $item);
             break;
         case 'Note':
             self::pdfNote($pdf, $item);
             break;
         case 'Document$1':
             PluginPdfDocument::pdfForItem($pdf, $item);
             break;
         case 'NetworkPort$1':
             PluginPdfNetworkPort::pdfForItem($pdf, $item);
             break;
         case 'Infocom$1':
             PluginPdfInfocom::pdfForItem($pdf, $item);
             break;
         case 'Contract_Item$1':
             PluginPdfContract_Item::pdfForItem($pdf, $item);
             break;
         case 'Ticket$1':
             PluginPdfTicket::pdfForItem($pdf, $item);
             break;
         case 'Link$1':
             PluginPdfLink::pdfForItem($pdf, $item);
             break;
         case 'Reservation$1':
             PluginPdfReservation::pdfForItem($pdf, $item);
             break;
         case 'Log$1':
             PluginPdfLog::pdfForItem($pdf, $item);
             break;
         default:
             return false;
     }
     return true;
 }