88 define(
"REPORT_AGENT_NAME",
"unifiedreport");
102 use PhpOffice\PhpWord\Element\Section;
103 use PhpOffice\PhpWord\IOFactory;
104 use PhpOffice\PhpWord\PhpWord;
105 use PhpOffice\PhpWord\SimpleType\JcTable;
106 use PhpOffice\PhpWord\Style\Table;
109 include_once(__DIR__ .
"/version.php");
110 include_once(__DIR__ .
"/reportStatic.php");
111 include_once(__DIR__ .
"/reportSummary.php");
205 "borderColor" =>
"000000",
207 "alignment" => JcTable::START,
208 "layout" => Table::LAYOUT_FIXED
246 function __construct()
248 $this->cpClearedGetter =
new XpClearedGetter(
"copyright",
"statement");
266 $this->uploadDao = $this->container->get(
"dao.upload");
267 $this->userDao = $this->container->get(
"dao.user");
282 $licenses = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"license",
false);
283 $this->
heartbeat(empty($licenses) ? 0 : count($licenses[
"statements"]));
285 $licensesMain = $this->licenseMainGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
286 $this->
heartbeat(empty($licensesMain) ? 0 : count($licensesMain[
"statements"]));
288 $licensesHist = $this->licenseClearedGetter->getLicenseHistogramForReport($uploadId,
$groupId);
289 $this->
heartbeat(empty($licensesHist) ? 0 : count($licensesHist[
"statements"]));
291 $bulkLicenses = $this->bulkMatchesGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
292 $this->
heartbeat(empty($bulkLicenses) ? 0 : count($bulkLicenses[
"statements"]));
294 $this->licenseClearedGetter->setOnlyAcknowledgements(
true);
295 $licenseAcknowledgements = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"license",
false);
296 $this->
heartbeat(empty($licenseAcknowledgements) ? 0 : count($licenseAcknowledgements[
"statements"]));
298 $this->licenseClearedGetter->setOnlyComments(
true);
299 $licenseComments = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
300 $this->
heartbeat(empty($licenseComments) ? 0 : count($licenseComments[
"statements"]));
302 $licensesIrre = $this->licenseIrrelevantGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
303 $this->
heartbeat(empty($licensesIrre) ? 0 : count($licensesIrre[
"statements"]));
305 $licensesIrreComment = $this->licenseIrrelevantCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
306 $this->
heartbeat(empty($licensesIrreComment) ? 0 : count($licensesIrreComment[
"statements"]));
308 $licensesDNU = $this->licenseDNUGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
309 $this->
heartbeat(empty($licensesDNU) ? 0 : count($licensesDNU[
"statements"]));
311 $licensesDNUComment = $this->licenseDNUCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
312 $this->
heartbeat(empty($licensesDNUComment) ? 0 : count($licensesDNUComment[
"statements"]));
314 $licensesNonFunctional = $this->licenseNonFunctionalGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
315 $this->
heartbeat(empty($licensesNonFunctional) ? 0 : count($licensesNonFunctional[
"statements"]));
317 $licensesNonFunctionalComment = $this->licenseNonFunctionalCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
318 $this->
heartbeat(empty($licensesNonFunctionalComment) ? 0 : count($licensesNonFunctionalComment[
"statements"]));
320 $copyrights = $this->cpClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"copyright",
true);
321 $this->
heartbeat(empty($copyrights[
"scannerFindings"]) ? 0 : count($copyrights[
"scannerFindings"]) + count($copyrights[
"userFindings"]));
323 $ecc = $this->eccClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"ecc",
false);
324 $this->
heartbeat(empty($ecc) ? 0 : count($ecc[
"statements"]));
326 $ipra = $this->ipraClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"ipra",
false);
327 $this->
heartbeat(empty($ip) ? 0 : count($ip[
"statements"]));
329 $otherStatement = $this->otherGetter->getReportData($uploadId);
330 $this->
heartbeat(empty($otherStatement) ? 0 : count($otherStatement));
331 $otherStatement[
'includeDNU'] = (count($licensesDNU[
"statements"]) > 0) ?
true :
false;
332 $otherStatement[
'includeNonFunctional'] = (count($licensesNonFunctional[
"statements"]) > 0) ?
true :
false;
335 "licenses" => $licenses,
336 "bulkLicenses" => $bulkLicenses,
337 "licenseAcknowledgements" => $licenseAcknowledgements,
338 "licenseComments" => $licenseComments,
339 "copyrights" => $copyrights,
342 "licensesIrre" => $licensesIrre,
343 "licensesIrreComment" => $licensesIrreComment,
344 "licensesDNU" => $licensesDNU,
345 "licensesDNUComment" => $licensesDNUComment,
346 "licensesNonFunctional" => $licensesNonFunctional,
347 "licensesNonFunctionalComment" => $licensesNonFunctionalComment,
348 "licensesMain" => $licensesMain,
349 "licensesHist" => $licensesHist,
350 "otherStatement" => $otherStatement
366 $topHeading = array(
"size" => 22,
368 "underline" =>
"single"
371 $mainHeading = array(
"size" => 20,
376 $subHeading = array(
"size" => 16,
380 $subSubHeading = array(
"size" => 14,
384 $paragraphStyle = array(
"spaceAfter" => 0,
389 $phpWord->addNumberingStyle(
'hNum',
390 array(
'type' =>
'multilevel',
'levels' => array(
391 array(
'pStyle' =>
'Heading01',
'format' =>
'bullet',
'text' =>
''),
392 array(
'pStyle' =>
'Heading2',
'format' =>
'decimal',
'text' =>
'%2.'),
393 array(
'pStyle' =>
'Heading3',
'format' =>
'decimal',
'text' =>
'%2.%3.'),
394 array(
'pStyle' =>
'Heading4',
'format' =>
'decimal',
'text' =>
'%2.%3.%4.'),
400 $phpWord->setDefaultFontName(
"Arial");
401 $phpWord->addTitleStyle(1, $topHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 0));
402 $phpWord->addTitleStyle(2, $mainHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 1));
403 $phpWord->addTitleStyle(3, $subHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 2));
404 $phpWord->addTitleStyle(4, $subSubHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 3));
405 $phpWord->addParagraphStyle(
"pStyle", $paragraphStyle);
408 $properties = $phpWord->getDocInfo();
409 $properties->setCreator($userName);
410 $properties->setCompany(
"Your Organisation");
411 $properties->setTitle(
"Clearing Report");
412 $properties->setDescription(
"OSS clearing report by Fossology tool");
413 $properties->setSubject(
"Copyright (C) ".date(
"Y", $timestamp).
", Your Organisation");
426 $secondColLen = 9500;
429 $section->addTitle(htmlspecialchars($heading), 2);
430 $section->addText($titleSubHeading, $this->subHeadingStyle);
432 $table = $section->addTable($this->tablestyle);
433 if (!empty($mainLicenses)) {
434 foreach ($mainLicenses as $licenseMain) {
435 if ($licenseMain[
"risk"] ==
"4" || $licenseMain[
"risk"] ==
"5") {
436 $styleColumn = array(
"bgColor" =>
"F9A7B0");
437 } elseif ($licenseMain[
"risk"] ==
"2" || $licenseMain[
"risk"] ==
"3") {
438 $styleColumn = array(
"bgColor" =>
"FEFF99");
440 $styleColumn = array(
"bgColor" =>
"FFFFFF");
442 $table->addRow($this->rowHeight);
443 $cell1 = $table->addCell($firstColLen, $styleColumn);
444 $cell1->addText(htmlspecialchars($licenseMain[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
445 $cell2 = $table->addCell($secondColLen);
447 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseMain[
"text"], ENT_DISALLOWED));
448 $licenseText = str_replace(
"\r",
"", $licenseText);
449 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
450 if (!empty($licenseMain[
"files"])) {
451 $cell3 = $table->addCell($thirdColLen, $styleColumn);
452 asort($licenseMain[
"files"]);
453 foreach ($licenseMain[
"files"] as $fileName) {
454 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
457 $cell3 = $table->addCell($thirdColLen, $styleColumn)->addText(
"");
461 $table->addRow($this->rowHeight);
462 $table->addCell($firstColLen)->addText(
"");
463 $table->addCell($secondColLen)->addText(
"");
464 $table->addCell($thirdColLen)->addText(
"");
466 $section->addTextBreak();
480 $secondColLen = 9500;
482 if (!empty($title)) {
483 $section->addTitle(htmlspecialchars($title), 2);
485 $section->addText($titleSubHeading, $this->subHeadingStyle);
487 $table = $section->addTable($this->tablestyle);
488 if (!empty($licenses)) {
489 foreach ($licenses as $licenseStatement) {
490 $table->addRow($this->rowHeight);
491 $cell1 = $table->addCell($firstColLen,
"pStyle");
492 $cell1->addText(htmlspecialchars($licenseStatement[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
493 $cell2 = $table->addCell($secondColLen,
"pStyle");
495 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseStatement[
"text"], ENT_DISALLOWED));
496 $licenseText = str_replace(
"\r",
"", $licenseText);
497 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
498 $cell3 = $table->addCell($thirdColLen,
"pStyle");
499 asort($licenseStatement[
"files"]);
500 foreach ($licenseStatement[
"files"] as $fileName) {
501 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
505 $table->addRow($this->rowHeight);
506 $table->addCell($firstColLen)->addText(
"");
507 $table->addCell($secondColLen)->addText(
"");
508 $table->addCell($thirdColLen)->addText(
"");
510 $section->addTextBreak();
521 private function licensesTable(Section $section, $title, $licenses, $riskarray, $titleSubHeading)
524 $secondColLen = 9500;
528 $section->addTitle(htmlspecialchars($title), 2);
529 $section->addText($titleSubHeading, $this->subHeadingStyle);
531 $table = $section->addTable($this->tablestyle);
532 if (!empty($licenses)) {
533 foreach ($licenses as $licenseStatement) {
534 if (in_array($licenseStatement[
'risk'], $riskarray[
'riskLevel'])) {
536 $table->addRow($this->rowHeight);
537 $cell1 = $table->addCell($firstColLen, $riskarray[
'color']);
538 $cell1->addText(htmlspecialchars($licenseStatement[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
539 $cell2 = $table->addCell($secondColLen);
541 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseStatement[
"text"], ENT_DISALLOWED));
542 $licenseText = str_replace(
"\r",
"", $licenseText);
543 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
544 $cell3 = $table->addCell($thirdColLen, $riskarray[
'color']);
545 asort($licenseStatement[
"files"]);
546 foreach ($licenseStatement[
"files"] as $fileName) {
547 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
555 if (empty($emptyFlag)) {
556 $table->addRow($this->rowHeight);
557 $table->addCell($firstColLen)->addText(
"");
558 $table->addCell($secondColLen)->addText(
"");
559 $table->addCell($thirdColLen)->addText(
"");
561 $section->addTextBreak();
574 $smallRowHeight = 50;
576 $secondColLen = 5000;
578 $textStyle = array(
"size" => 10,
"bold" =>
true);
580 $section->addTitle(htmlspecialchars($title), 2);
582 $section->addText($text, $textStyle);
584 $section->addText($titleSubHeading, $this->subHeadingStyle);
586 $table = $section->addTable($this->tablestyle);
587 if (!empty($statementsCEI)) {
588 foreach ($statementsCEI as $statements) {
589 if (!empty($statements[
'content'])) {
590 $table->addRow($smallRowHeight);
591 $cell1 = $table->addCell($firstColLen);
592 $text = html_entity_decode($statements[
'content']);
593 $cell1->addText(htmlspecialchars($text, ENT_DISALLOWED), $this->licenseTextColumn,
"pStyle");
594 $cell2 = $table->addCell($secondColLen);
595 $cell2->addText(htmlspecialchars($statements[
'comments'], ENT_DISALLOWED), $this->licenseTextColumn,
"pStyle");
596 $cell3 = $table->addCell($thirdColLen);
597 asort($statements[
"files"]);
598 foreach ($statements[
'files'] as $fileName) {
599 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
604 $table->addRow($this->rowHeight);
605 $table->addCell($firstColLen)->addText(
"");
606 $table->addCell($secondColLen)->addText(
"");
607 $table->addCell($thirdColLen)->addText(
"");
609 $section->addTextBreak();
622 $secondColLen = 5000;
626 $section->addTitle(htmlspecialchars($title), 2);
627 $section->addText($titleSubHeading, $this->subHeadingStyle);
629 $table = $section->addTable($this->tablestyle);
630 if (!empty($licensesIrre)) {
631 foreach ($licensesIrre as $statements) {
632 $table->addRow($rowWidth,
"pStyle");
633 $cell1 = $table->addCell($firstColLen)->addText(htmlspecialchars($statements[
'content']),
null,
"pStyle");
634 $cell2 = $table->addCell($secondColLen)->addText(htmlspecialchars($statements[
'fileName']),
null,
"pStyle");
635 $cell3 = $table->addCell($thirdColLen);
636 asort($statements[
"licenses"]);
637 foreach ($statements[
'licenses'] as $licenseName) {
638 $cell3->addText(htmlspecialchars($licenseName), $this->filePathColumn,
"pStyle");
642 $table->addRow($this->rowHeight);
643 $table->addCell($firstColLen,
"pStyle")->addText(
"");
644 $table->addCell($secondColLen,
"pStyle")->addText(
"");
645 $table->addCell($thirdColLen,
"pStyle")->addText(
"");
647 $section->addTextBreak();
657 private function licenseHistogram(Section $section, $dataHistogram, $titleSubHeading, $heading)
660 $secondColLen = 2000;
663 $section->addTitle(htmlspecialchars($heading), 2);
664 $section->addText($titleSubHeading, $this->subHeadingStyle);
666 $table = $section->addTable($this->tablestyle);
668 foreach ($dataHistogram as $licenseData) {
669 $table->addRow($this->rowHeight);
670 $table->addCell($firstColLen)->addText($licenseData[
'scannerCount'],
"pStyle");
671 $table->addCell($secondColLen)->addText($licenseData[
'editedCount'],
"pStyle");
672 $table->addCell($thirdColLen)->addText(htmlspecialchars($licenseData[
'licenseShortname']),
"pStyle");
674 $section->addTextBreak();
693 $userName = $this->userDao->getUserName(
$userId);
694 $groupName = $this->userDao->getGroupNameById(
$groupId);
695 $packageName = $this->uploadDao->getUpload($uploadId)->getFilename();
697 $packageName = str_replace(
'(',
'_',$packageName);
698 $packageName = str_replace(
' ',
'_',$packageName);
699 $packageName = str_replace(
')',
'_',$packageName);
701 $parentItem = $this->uploadDao->getParentItemBounds($uploadId);
702 $docLayout = array(
"orientation" =>
"landscape",
703 "marginLeft" =>
"950",
704 "marginRight" =>
"950",
705 "marginTop" =>
"950",
706 "marginBottom" =>
"950"
710 $phpWord =
new PhpWord();
713 $jobInfo = $this->
dbManager->getSingleRow(
"SELECT extract(epoch FROM jq_starttime) "
714 .
" AS ts, jq_cmd_args FROM jobqueue WHERE jq_job_fk=$1", array($this->
jobId));
715 $timestamp = $jobInfo[
'ts'];
717 if (!empty($jobInfo[
'jq_cmd_args'])) {
718 $packageUri =
trim($jobInfo[
'jq_cmd_args']);
719 $packageUri = preg_replace(
"/api\/.*/i",
"", $packageUri);
720 $packageUri .=
"?mod=showjobs&upload=" . $uploadId;
727 $section = $phpWord->addSection($docLayout);
732 list($obligations, $whiteLists) = $this->obligationsGetter->getObligations($contents[
'licenses'][
'statements'],
733 $contents[
'licensesMain'][
'statements'], $uploadId,
$groupId);
736 $reportStaticSection->reportHeader($section);
738 list($contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements']) = $this->licenseClearedGetter->updateIdentifiedGlobalLicenses($contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements']);
741 $assignedToUserId = $this->uploadDao->getAssignee($uploadId,
$groupId);
742 if ($assignedToUserId != 1) {
743 $assignedToUserName = $this->userDao->getUserName($assignedToUserId);
745 $assignedToUserName =
"";
747 $reportSummarySection->summaryTable($section, $uploadId, $userName,
748 $contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements'],
749 $contents[
'licensesHist'][
'statements'], $contents[
'otherStatement'], $timestamp, $groupName, $packageUri, $assignedToUserName);
751 if (!empty($contents[
'otherStatement'][
'ri_unifiedcolumns'])) {
752 $unifiedColumns = (array) json_decode($contents[
'otherStatement'][
'ri_unifiedcolumns'],
true);
754 $unifiedColumns = UploadDao::UNIFIED_REPORT_HEADINGS;
757 $heading = array_keys($unifiedColumns[
'assessment'])[0];
758 $isEnabled = array_values($unifiedColumns[
'assessment'])[0];
761 $bookMarkCell = $reportStaticSection->assessmentSummaryTable($section, $contents[
'otherStatement'], $heading);
764 $heading = array_keys($unifiedColumns[
'compliancetasks'])[0];
765 $isEnabled = array_values($unifiedColumns[
'compliancetasks'])[0];
768 $reportStaticSection->todoTable($section, $heading);
770 $reportStaticSection->todoObliTable($section, $obligations);
773 $heading = array_keys($unifiedColumns[
'acknowledgements'])[0];
774 $isEnabled = array_values($unifiedColumns[
'acknowledgements'])[0];
777 $titleSubHeadingAcknowledgement =
"(Reference to the license, Text of acknowledgements, File path)";
778 $this->
bulkLicenseTable($section, $heading, $contents[
'licenseAcknowledgements'][
'statements'], $titleSubHeadingAcknowledgement);
781 $heading = array_keys($unifiedColumns[
'exportrestrictions'])[0];
782 $isEnabled = array_values($unifiedColumns[
'exportrestrictions'])[0];
785 $titleSubHeadingCEI =
"(Statements, Comments, File path)";
786 $section->addBookmark(
"eccInternalLink");
787 $textEcc =
"The content of this paragraph is not the result of the evaluation"
788 .
" of the export control experts (the ECCN). It contains information"
789 .
" found by the scanner which shall be taken in consideration by"
790 .
" the export control experts during the evaluation process. If"
791 .
" the scanner identifies an ECCN it will be listed here. (NOTE:"
792 .
" The ECCN is seen as an attribute of the component release and"
793 .
" thus it shall be present in the component catalogue.";
794 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'ecc'][
'statements'], $titleSubHeadingCEI, $textEcc);
797 $heading = array_keys($unifiedColumns[
'intellectualProperty'])[0];
798 $isEnabled = array_values($unifiedColumns[
'intellectualProperty'])[0];
801 $heading =
"Patent Relevant Statements";
802 $textIpra =
"The content of this paragraph is not the result of the evaluation of the IP professionals. It contains information found by the scanner which shall be taken in consideration by the IP professionals during the evaluation process.";
803 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'ipra'][
'statements'], $titleSubHeadingCEI, $textIpra);
806 $heading = array_keys($unifiedColumns[
'notes'])[0];
807 $isEnabled = array_values($unifiedColumns[
'notes'])[0];
810 $subHeading =
"Notes on individual files";
811 $reportStaticSection->notes($section, $heading, $subHeading);
812 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
813 $this->
bulkLicenseTable($section,
"", $contents[
'licenseComments'][
'statements'], $titleSubHeadingNotes);
816 $heading = array_keys($unifiedColumns[
'scanresults'])[0];
817 $isEnabled = array_values($unifiedColumns[
'scanresults'])[0];
820 $titleSubHeadingHistogram =
"(Scanner count, Concluded license count, License name)";
821 $this->
licenseHistogram($section, $contents[
'licensesHist'][
'statements'], $titleSubHeadingHistogram, $heading);
824 $heading = array_keys($unifiedColumns[
'mainlicenses'])[0];
825 $isEnabled = array_values($unifiedColumns[
'mainlicenses'])[0];
828 $titleSubHeadingLicense =
"(License name, License text, File path)";
829 $this->
globalLicenseTable($section, $contents[
'licensesMain'][
'statements'], $titleSubHeadingLicense, $heading);
832 $heading = array_keys($unifiedColumns[
'redlicense'])[0];
833 $isEnabled = array_values($unifiedColumns[
'redlicense'])[0];
836 $redLicense = array(
"color" => array(
"bgColor" =>
"F9A7B0"),
"riskLevel" => array(
"5",
"4"));
837 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $redLicense, $titleSubHeadingLicense);
840 $heading = array_keys($unifiedColumns[
'yellowlicense'])[0];
841 $isEnabled = array_values($unifiedColumns[
'yellowlicense'])[0];
844 $yellowLicense = array(
"color" => array(
"bgColor" =>
"FEFF99"),
"riskLevel" => array(
"3",
"2"));
845 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $yellowLicense, $titleSubHeadingLicense);
848 $heading = array_keys($unifiedColumns[
'whitelicense'])[0];
849 $isEnabled = array_values($unifiedColumns[
'whitelicense'])[0];
852 $whiteLicense = array(
"color" => array(
"bgColor" =>
"FFFFFF"),
"riskLevel" => array(
"",
"0",
"1"));
853 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $whiteLicense, $titleSubHeadingLicense);
856 $heading = array_keys($unifiedColumns[
'overviewwithwithoutobligations'])[0];
857 $isEnabled = array_values($unifiedColumns[
'overviewwithwithoutobligations'])[0];
859 $titleSubHeadingObli =
"(License ShortName, Obligation)";
860 $reportStaticSection->allLicensesWithAndWithoutObligations($section, $heading, $obligations, $whiteLists, $titleSubHeadingObli);
863 $heading = array_keys($unifiedColumns[
'copyrights'])[0];
864 $isEnabled = array_values($unifiedColumns[
'copyrights'])[0];
867 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'copyrights'][
'scannerFindings'], $titleSubHeadingCEI);
870 $heading = array_keys($unifiedColumns[
'copyrightsuf'])[0];
871 $isEnabled = array_values($unifiedColumns[
'copyrightsuf'])[0];
874 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'copyrights'][
'userFindings'], $titleSubHeadingCEI);
877 $heading = array_keys($unifiedColumns[
'bulkfindings'])[0];
878 $isEnabled = array_values($unifiedColumns[
'bulkfindings'])[0];
881 $this->
bulkLicenseTable($section, $heading, $contents[
'bulkLicenses'][
'statements'], $titleSubHeadingLicense);
884 $heading = array_keys($unifiedColumns[
'licensenf'])[0];
885 $isEnabled = array_values($unifiedColumns[
'licensenf'])[0];
888 $reportStaticSection->getNonFunctionalLicenses($section, $heading);
891 $heading = array_keys($unifiedColumns[
'irrelevantfiles'])[0];
892 $isEnabled = array_values($unifiedColumns[
'irrelevantfiles'])[0];
895 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
899 $subHeading =
"Comment for Irrelevant files";
900 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
901 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
902 $this->
bulkLicenseTable($section,
"", $contents[
'licensesIrreComment'][
'statements'], $titleSubHeadingNotes);
905 $heading = array_keys($unifiedColumns[
'dnufiles'])[0];
906 $isEnabled = array_values($unifiedColumns[
'dnufiles'])[0];
909 if ($contents[
'otherStatement'][
'includeDNU']) {
911 $columnStyleWithUnderline = array(
"size" => 11,
"color" =>
"0000A0",
'underline' =>
'single');
912 $section->addBookmark(
'DNUBookmark');
913 $bookMarkCell->addLink(
'DNUBookmark', htmlspecialchars(
' NOTE: DO NOT USE files found! Please check Do not use files section', ENT_COMPAT,
'UTF-8'), $columnStyleWithUnderline,
"pStyle",
true);
915 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
919 $subHeading =
"Comment for Do not use files";
920 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
921 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
922 $this->
bulkLicenseTable($section,
"", $contents[
'licensesDNUComment'][
'statements'], $titleSubHeadingNotes);
926 $heading =
"Non functional Files";
927 if ($contents[
'otherStatement'][
'includeNonFunctional']) {
929 $columnStyleWithUnderline = array(
"size" => 11,
"color" =>
"0000A0",
'underline' =>
'single');
930 $section->addBookmark(
'nonFunctionalBookmark');
931 $bookMarkCell->addLink(
'nonFunctionalBookmark', htmlspecialchars(
' NOTE: Non functional files found! Please check Non functional files section', ENT_COMPAT,
'UTF-8'), $columnStyleWithUnderline,
"pStyle",
true);
933 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
934 $this->
getRowsAndColumnsForIrre($section, $heading, $contents[
'licensesNonFunctional'][
'statements'], $titleSubHeadingIrre);
937 $subHeading =
"Comment for Non functional files";
938 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
939 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
940 $this->
bulkLicenseTable($section,
"", $contents[
'licensesNonFunctionalComment'][
'statements'], $titleSubHeadingNotes);
942 $heading = array_keys($unifiedColumns[
'changelog'])[0];
943 $isEnabled = array_values($unifiedColumns[
'changelog'])[0];
946 $reportStaticSection->clearingProtocolChangeLogTable($section, $heading);
950 $reportStaticSection->reportFooter($phpWord, $section, $contents[
'otherStatement']);
952 $fileBase = $SysConf[
"FOSSOLOGY"][
"path"].
"/report/";
953 if (!is_dir($fileBase)) {
954 mkdir($fileBase, 0777,
true);
957 $fileName = $fileBase.
"Clearing_Report_".$packageName.
".docx";
958 $objWriter = IOFactory::createWriter($phpWord,
"Word2007");
959 $objWriter->save($fileName);
973 $this->reportutils->updateOrInsertReportgenEntry($uploadId,
$jobId, $filename);
978 $agent->scheduler_connect();
979 $agent->run_scheduler_event_loop();
980 $agent->scheduler_disconnect(0);
Structure of an Agent with all required parameters.
heartbeat($newProcessed)
Send hear beat to the scheduler.
Handles static part of report.
Generates unified report.
$licenseNonFunctionalGetter
globalLicenseTable(Section $section, $mainLicenses, $titleSubHeading, $heading)
Generate global license table.
documentSettingsAndStyles(PhpWord &$phpWord, $timestamp, $userName)
Setting default heading styles and paragraph styles.
licensesTable(Section $section, $title, $licenses, $riskarray, $titleSubHeading)
This function lists out the red, white & yellow licenses.
getRowsAndColumnsForIrre(Section $section, $title, $licensesIrre, $titleSubHeading)
Irrelevant files in report.
bulkLicenseTable(Section $section, $title, $licenses, $titleSubHeading)
This function lists out the bulk licenses, comments of identified licenses.
licenseHistogram(Section $section, $dataHistogram, $titleSubHeading, $heading)
License histogram into report.
writeReport($contents, $uploadId, $groupId, $userId)
Writes the report to a file.
processUploadId($uploadId)
Given an upload ID, process the items in it.
updateReportTable($uploadId, $jobId, $filename)
Update database with generated report path.
$licenseIrrelevantCommentGetter
getRowsAndColumnsForCEI(Section $section, $title, $statementsCEI, $titleSubHeading, $text="")
Copyright or ecc table.
char * trim(char *ptext)
Trimming whitespace.
int jobId
The id of the job.
fo_dbManager * dbManager
fo_dbManager object