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;
108 include_once(__DIR__ .
"/version.php");
109 include_once(__DIR__ .
"/reportStatic.php");
110 include_once(__DIR__ .
"/reportSummary.php");
199 "borderColor" =>
"000000",
201 "alignment" => JcTable::START,
202 "layout" => Table::LAYOUT_FIXED
240 function __construct()
242 $this->cpClearedGetter =
new XpClearedGetter(
"copyright",
"statement");
259 $this->uploadDao = $this->container->get(
"dao.upload");
260 $this->userDao = $this->container->get(
"dao.user");
275 $licenses = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"license",
false);
276 $this->
heartbeat(empty($licenses) ? 0 : count($licenses[
"statements"]));
278 $licensesMain = $this->licenseMainGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
279 $this->
heartbeat(empty($licensesMain) ? 0 : count($licensesMain[
"statements"]));
281 $licensesHist = $this->licenseClearedGetter->getLicenseHistogramForReport($uploadId,
$groupId);
282 $this->
heartbeat(empty($licensesHist) ? 0 : count($licensesHist[
"statements"]));
284 $bulkLicenses = $this->bulkMatchesGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
285 $this->
heartbeat(empty($bulkLicenses) ? 0 : count($bulkLicenses[
"statements"]));
287 $this->licenseClearedGetter->setOnlyAcknowledgements(
true);
288 $licenseAcknowledgements = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"license",
false);
289 $this->
heartbeat(empty($licenseAcknowledgements) ? 0 : count($licenseAcknowledgements[
"statements"]));
291 $this->licenseClearedGetter->setOnlyComments(
true);
292 $licenseComments = $this->licenseClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
293 $this->
heartbeat(empty($licenseComments) ? 0 : count($licenseComments[
"statements"]));
295 $licensesIrre = $this->licenseIrrelevantGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
296 $this->
heartbeat(empty($licensesIrre) ? 0 : count($licensesIrre[
"statements"]));
298 $licensesIrreComment = $this->licenseIrrelevantCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
299 $this->
heartbeat(empty($licensesIrreComment) ? 0 : count($licensesIrreComment[
"statements"]));
301 $licensesDNU = $this->licenseDNUGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
302 $this->
heartbeat(empty($licensesDNU) ? 0 : count($licensesDNU[
"statements"]));
304 $licensesDNUComment = $this->licenseDNUCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
305 $this->
heartbeat(empty($licensesDNUComment) ? 0 : count($licensesDNUComment[
"statements"]));
307 $licensesNonFunctional = $this->licenseNonFunctionalGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
308 $this->
heartbeat(empty($licensesNonFunctional) ? 0 : count($licensesNonFunctional[
"statements"]));
310 $licensesNonFunctionalComment = $this->licenseNonFunctionalCommentGetter->getCleared($uploadId, $this,
$groupId,
true,
null,
false);
311 $this->
heartbeat(empty($licensesNonFunctionalComment) ? 0 : count($licensesNonFunctionalComment[
"statements"]));
313 $copyrights = $this->cpClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"copyright",
true);
314 $this->
heartbeat(empty($copyrights[
"scannerFindings"]) ? 0 : count($copyrights[
"scannerFindings"]) + count($copyrights[
"userFindings"]));
316 $ecc = $this->eccClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"ecc",
false);
317 $this->
heartbeat(empty($ecc) ? 0 : count($ecc[
"statements"]));
319 $ipra = $this->ipraClearedGetter->getCleared($uploadId, $this,
$groupId,
true,
"ipra",
false);
320 $this->
heartbeat(empty($ip) ? 0 : count($ip[
"statements"]));
322 $otherStatement = $this->otherGetter->getReportData($uploadId);
323 $this->
heartbeat(empty($otherStatement) ? 0 : count($otherStatement));
324 $otherStatement[
'includeDNU'] = (count($licensesDNU[
"statements"]) > 0) ?
true :
false;
325 $otherStatement[
'includeNonFunctional'] = (count($licensesNonFunctional[
"statements"]) > 0) ?
true :
false;
328 "licenses" => $licenses,
329 "bulkLicenses" => $bulkLicenses,
330 "licenseAcknowledgements" => $licenseAcknowledgements,
331 "licenseComments" => $licenseComments,
332 "copyrights" => $copyrights,
335 "licensesIrre" => $licensesIrre,
336 "licensesIrreComment" => $licensesIrreComment,
337 "licensesDNU" => $licensesDNU,
338 "licensesDNUComment" => $licensesDNUComment,
339 "licensesNonFunctional" => $licensesNonFunctional,
340 "licensesNonFunctionalComment" => $licensesNonFunctionalComment,
341 "licensesMain" => $licensesMain,
342 "licensesHist" => $licensesHist,
343 "otherStatement" => $otherStatement
359 $topHeading = array(
"size" => 22,
361 "underline" =>
"single"
364 $mainHeading = array(
"size" => 20,
369 $subHeading = array(
"size" => 16,
373 $subSubHeading = array(
"size" => 14,
377 $paragraphStyle = array(
"spaceAfter" => 0,
382 $phpWord->addNumberingStyle(
'hNum',
383 array(
'type' =>
'multilevel',
'levels' => array(
384 array(
'pStyle' =>
'Heading01',
'format' =>
'bullet',
'text' =>
''),
385 array(
'pStyle' =>
'Heading2',
'format' =>
'decimal',
'text' =>
'%2.'),
386 array(
'pStyle' =>
'Heading3',
'format' =>
'decimal',
'text' =>
'%2.%3.'),
387 array(
'pStyle' =>
'Heading4',
'format' =>
'decimal',
'text' =>
'%2.%3.%4.'),
393 $phpWord->setDefaultFontName(
"Arial");
394 $phpWord->addTitleStyle(1, $topHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 0));
395 $phpWord->addTitleStyle(2, $mainHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 1));
396 $phpWord->addTitleStyle(3, $subHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 2));
397 $phpWord->addTitleStyle(4, $subSubHeading, array(
'numStyle' =>
'hNum',
'numLevel' => 3));
398 $phpWord->addParagraphStyle(
"pStyle", $paragraphStyle);
401 $properties = $phpWord->getDocInfo();
402 $properties->setCreator($userName);
403 $properties->setCompany(
"Your Organisation");
404 $properties->setTitle(
"Clearing Report");
405 $properties->setDescription(
"OSS clearing report by Fossology tool");
406 $properties->setSubject(
"Copyright (C) ".date(
"Y", $timestamp).
", Your Organisation");
419 $secondColLen = 9500;
422 $section->addTitle(htmlspecialchars($heading), 2);
423 $section->addText($titleSubHeading, $this->subHeadingStyle);
425 $table = $section->addTable($this->tablestyle);
426 if (!empty($mainLicenses)) {
427 foreach ($mainLicenses as $licenseMain) {
428 if ($licenseMain[
"risk"] ==
"4" || $licenseMain[
"risk"] ==
"5") {
429 $styleColumn = array(
"bgColor" =>
"F9A7B0");
430 } elseif ($licenseMain[
"risk"] ==
"2" || $licenseMain[
"risk"] ==
"3") {
431 $styleColumn = array(
"bgColor" =>
"FEFF99");
433 $styleColumn = array(
"bgColor" =>
"FFFFFF");
435 $table->addRow($this->rowHeight);
436 $cell1 = $table->addCell($firstColLen, $styleColumn);
437 $cell1->addText(htmlspecialchars($licenseMain[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
438 $cell2 = $table->addCell($secondColLen);
440 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseMain[
"text"], ENT_DISALLOWED));
441 $licenseText = str_replace(
"\r",
"", $licenseText);
442 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
443 if (!empty($licenseMain[
"files"])) {
444 $cell3 = $table->addCell($thirdColLen, $styleColumn);
445 asort($licenseMain[
"files"]);
446 foreach ($licenseMain[
"files"] as $fileName) {
447 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
450 $cell3 = $table->addCell($thirdColLen, $styleColumn)->addText(
"");
454 $table->addRow($this->rowHeight);
455 $table->addCell($firstColLen)->addText(
"");
456 $table->addCell($secondColLen)->addText(
"");
457 $table->addCell($thirdColLen)->addText(
"");
459 $section->addTextBreak();
473 $secondColLen = 9500;
475 if (!empty($title)) {
476 $section->addTitle(htmlspecialchars($title), 2);
478 $section->addText($titleSubHeading, $this->subHeadingStyle);
480 $table = $section->addTable($this->tablestyle);
481 if (!empty($licenses)) {
482 foreach ($licenses as $licenseStatement) {
483 $table->addRow($this->rowHeight);
484 $cell1 = $table->addCell($firstColLen,
"pStyle");
485 $cell1->addText(htmlspecialchars($licenseStatement[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
486 $cell2 = $table->addCell($secondColLen,
"pStyle");
488 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseStatement[
"text"], ENT_DISALLOWED));
489 $licenseText = str_replace(
"\r",
"", $licenseText);
490 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
491 $cell3 = $table->addCell($thirdColLen,
"pStyle");
492 asort($licenseStatement[
"files"]);
493 foreach ($licenseStatement[
"files"] as $fileName) {
494 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
498 $table->addRow($this->rowHeight);
499 $table->addCell($firstColLen)->addText(
"");
500 $table->addCell($secondColLen)->addText(
"");
501 $table->addCell($thirdColLen)->addText(
"");
503 $section->addTextBreak();
514 private function licensesTable(Section $section, $title, $licenses, $riskarray, $titleSubHeading)
517 $secondColLen = 9500;
521 $section->addTitle(htmlspecialchars($title), 2);
522 $section->addText($titleSubHeading, $this->subHeadingStyle);
524 $table = $section->addTable($this->tablestyle);
525 if (!empty($licenses)) {
526 foreach ($licenses as $licenseStatement) {
527 if (in_array($licenseStatement[
'risk'], $riskarray[
'riskLevel'])) {
529 $table->addRow($this->rowHeight);
530 $cell1 = $table->addCell($firstColLen, $riskarray[
'color']);
531 $cell1->addText(htmlspecialchars($licenseStatement[
"content"], ENT_DISALLOWED), $this->licenseColumn,
"pStyle");
532 $cell2 = $table->addCell($secondColLen);
534 $licenseText = str_replace(
"\n",
"</w:t>\n<w:br />\n<w:t xml:space=\"preserve\">", htmlspecialchars($licenseStatement[
"text"], ENT_DISALLOWED));
535 $licenseText = str_replace(
"\r",
"", $licenseText);
536 $cell2->addText($licenseText, $this->licenseTextColumn,
"pStyle");
537 $cell3 = $table->addCell($thirdColLen, $riskarray[
'color']);
538 asort($licenseStatement[
"files"]);
539 foreach ($licenseStatement[
"files"] as $fileName) {
540 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
548 if (empty($emptyFlag)) {
549 $table->addRow($this->rowHeight);
550 $table->addCell($firstColLen)->addText(
"");
551 $table->addCell($secondColLen)->addText(
"");
552 $table->addCell($thirdColLen)->addText(
"");
554 $section->addTextBreak();
567 $smallRowHeight = 50;
569 $secondColLen = 5000;
571 $textStyle = array(
"size" => 10,
"bold" =>
true);
573 $section->addTitle(htmlspecialchars($title), 2);
575 $section->addText($text, $textStyle);
577 $section->addText($titleSubHeading, $this->subHeadingStyle);
579 $table = $section->addTable($this->tablestyle);
580 if (!empty($statementsCEI)) {
581 foreach ($statementsCEI as $statements) {
582 if (!empty($statements[
'content'])) {
583 $table->addRow($smallRowHeight);
584 $cell1 = $table->addCell($firstColLen);
585 $text = html_entity_decode($statements[
'content']);
586 $cell1->addText(htmlspecialchars($text, ENT_DISALLOWED), $this->licenseTextColumn,
"pStyle");
587 $cell2 = $table->addCell($secondColLen);
588 $cell2->addText(htmlspecialchars($statements[
'comments'], ENT_DISALLOWED), $this->licenseTextColumn,
"pStyle");
589 $cell3 = $table->addCell($thirdColLen);
590 asort($statements[
"files"]);
591 foreach ($statements[
'files'] as $fileName) {
592 $cell3->addText(htmlspecialchars($fileName), $this->filePathColumn,
"pStyle");
597 $table->addRow($this->rowHeight);
598 $table->addCell($firstColLen)->addText(
"");
599 $table->addCell($secondColLen)->addText(
"");
600 $table->addCell($thirdColLen)->addText(
"");
602 $section->addTextBreak();
615 $secondColLen = 5000;
619 $section->addTitle(htmlspecialchars($title), 2);
620 $section->addText($titleSubHeading, $this->subHeadingStyle);
622 $table = $section->addTable($this->tablestyle);
623 if (!empty($licensesIrre)) {
624 foreach ($licensesIrre as $statements) {
625 $table->addRow($rowWidth,
"pStyle");
626 $cell1 = $table->addCell($firstColLen)->addText(htmlspecialchars($statements[
'content']),
null,
"pStyle");
627 $cell2 = $table->addCell($secondColLen)->addText(htmlspecialchars($statements[
'fileName']),
null,
"pStyle");
628 $cell3 = $table->addCell($thirdColLen);
629 asort($statements[
"licenses"]);
630 foreach ($statements[
'licenses'] as $licenseName) {
631 $cell3->addText(htmlspecialchars($licenseName), $this->filePathColumn,
"pStyle");
635 $table->addRow($this->rowHeight);
636 $table->addCell($firstColLen,
"pStyle")->addText(
"");
637 $table->addCell($secondColLen,
"pStyle")->addText(
"");
638 $table->addCell($thirdColLen,
"pStyle")->addText(
"");
640 $section->addTextBreak();
650 private function licenseHistogram(Section $section, $dataHistogram, $titleSubHeading, $heading)
653 $secondColLen = 2000;
656 $section->addTitle(htmlspecialchars($heading), 2);
657 $section->addText($titleSubHeading, $this->subHeadingStyle);
659 $table = $section->addTable($this->tablestyle);
661 foreach ($dataHistogram as $licenseData) {
662 $table->addRow($this->rowHeight);
663 $table->addCell($firstColLen)->addText($licenseData[
'scannerCount'],
"pStyle");
664 $table->addCell($secondColLen)->addText($licenseData[
'editedCount'],
"pStyle");
665 $table->addCell($thirdColLen)->addText(htmlspecialchars($licenseData[
'licenseShortname']),
"pStyle");
667 $section->addTextBreak();
686 $userName = $this->userDao->getUserName(
$userId);
687 $groupName = $this->userDao->getGroupNameById(
$groupId);
688 $packageName = $this->uploadDao->getUpload($uploadId)->getFilename();
690 $packageName = str_replace(
'(',
'_',$packageName);
691 $packageName = str_replace(
' ',
'_',$packageName);
692 $packageName = str_replace(
')',
'_',$packageName);
694 $parentItem = $this->uploadDao->getParentItemBounds($uploadId);
695 $docLayout = array(
"orientation" =>
"landscape",
696 "marginLeft" =>
"950",
697 "marginRight" =>
"950",
698 "marginTop" =>
"950",
699 "marginBottom" =>
"950"
703 $phpWord =
new PhpWord();
706 $jobInfo = $this->
dbManager->getSingleRow(
"SELECT extract(epoch FROM jq_starttime) "
707 .
" AS ts, jq_cmd_args FROM jobqueue WHERE jq_job_fk=$1", array($this->
jobId));
708 $timestamp = $jobInfo[
'ts'];
710 if (!empty($jobInfo[
'jq_cmd_args'])) {
711 $packageUri =
trim($jobInfo[
'jq_cmd_args']);
712 $packageUri = preg_replace(
"/api\/.*/i",
"", $packageUri);
713 $packageUri .=
"?mod=showjobs&upload=" . $uploadId;
720 $section = $phpWord->addSection($docLayout);
725 list($obligations, $whiteLists) = $this->obligationsGetter->getObligations($contents[
'licenses'][
'statements'],
726 $contents[
'licensesMain'][
'statements'], $uploadId,
$groupId);
729 $reportStaticSection->reportHeader($section);
731 list($contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements']) = $this->licenseClearedGetter->updateIdentifiedGlobalLicenses($contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements']);
734 $assignedToUserId = $this->uploadDao->getAssignee($uploadId,
$groupId);
735 if ($assignedToUserId != 1) {
736 $assignedToUserName = $this->userDao->getUserName($assignedToUserId);
738 $assignedToUserName =
"";
740 $reportSummarySection->summaryTable($section, $uploadId, $userName,
741 $contents[
'licensesMain'][
'statements'], $contents[
'licenses'][
'statements'],
742 $contents[
'licensesHist'][
'statements'], $contents[
'otherStatement'], $timestamp, $groupName, $packageUri, $assignedToUserName);
744 if (!empty($contents[
'otherStatement'][
'ri_unifiedcolumns'])) {
745 $unifiedColumns = (array) json_decode($contents[
'otherStatement'][
'ri_unifiedcolumns'],
true);
747 $unifiedColumns = UploadDao::UNIFIED_REPORT_HEADINGS;
750 $heading = array_keys($unifiedColumns[
'assessment'])[0];
751 $isEnabled = array_values($unifiedColumns[
'assessment'])[0];
754 $bookMarkCell = $reportStaticSection->assessmentSummaryTable($section, $contents[
'otherStatement'], $heading);
757 $heading = array_keys($unifiedColumns[
'compliancetasks'])[0];
758 $isEnabled = array_values($unifiedColumns[
'compliancetasks'])[0];
761 $reportStaticSection->todoTable($section, $heading);
763 $reportStaticSection->todoObliTable($section, $obligations);
766 $heading = array_keys($unifiedColumns[
'acknowledgements'])[0];
767 $isEnabled = array_values($unifiedColumns[
'acknowledgements'])[0];
770 $titleSubHeadingAcknowledgement =
"(Reference to the license, Text of acknowledgements, File path)";
771 $this->
bulkLicenseTable($section, $heading, $contents[
'licenseAcknowledgements'][
'statements'], $titleSubHeadingAcknowledgement);
774 $heading = array_keys($unifiedColumns[
'exportrestrictions'])[0];
775 $isEnabled = array_values($unifiedColumns[
'exportrestrictions'])[0];
778 $titleSubHeadingCEI =
"(Statements, Comments, File path)";
779 $section->addBookmark(
"eccInternalLink");
780 $textEcc =
"The content of this paragraph is not the result of the evaluation"
781 .
" of the export control experts (the ECCN). It contains information"
782 .
" found by the scanner which shall be taken in consideration by"
783 .
" the export control experts during the evaluation process. If"
784 .
" the scanner identifies an ECCN it will be listed here. (NOTE:"
785 .
" The ECCN is seen as an attribute of the component release and"
786 .
" thus it shall be present in the component catalogue.";
787 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'ecc'][
'statements'], $titleSubHeadingCEI, $textEcc);
790 $heading = array_keys($unifiedColumns[
'intellectualProperty'])[0];
791 $isEnabled = array_values($unifiedColumns[
'intellectualProperty'])[0];
794 $heading =
"Patent Relevant Statements";
795 $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.";
796 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'ipra'][
'statements'], $titleSubHeadingCEI, $textIpra);
799 $heading = array_keys($unifiedColumns[
'notes'])[0];
800 $isEnabled = array_values($unifiedColumns[
'notes'])[0];
803 $subHeading =
"Notes on individual files";
804 $reportStaticSection->notes($section, $heading, $subHeading);
805 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
806 $this->
bulkLicenseTable($section,
"", $contents[
'licenseComments'][
'statements'], $titleSubHeadingNotes);
809 $heading = array_keys($unifiedColumns[
'scanresults'])[0];
810 $isEnabled = array_values($unifiedColumns[
'scanresults'])[0];
813 $titleSubHeadingHistogram =
"(Scanner count, Concluded license count, License name)";
814 $this->
licenseHistogram($section, $contents[
'licensesHist'][
'statements'], $titleSubHeadingHistogram, $heading);
817 $heading = array_keys($unifiedColumns[
'mainlicenses'])[0];
818 $isEnabled = array_values($unifiedColumns[
'mainlicenses'])[0];
821 $titleSubHeadingLicense =
"(License name, License text, File path)";
822 $this->
globalLicenseTable($section, $contents[
'licensesMain'][
'statements'], $titleSubHeadingLicense, $heading);
825 $heading = array_keys($unifiedColumns[
'redlicense'])[0];
826 $isEnabled = array_values($unifiedColumns[
'redlicense'])[0];
829 $redLicense = array(
"color" => array(
"bgColor" =>
"F9A7B0"),
"riskLevel" => array(
"5",
"4"));
830 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $redLicense, $titleSubHeadingLicense);
833 $heading = array_keys($unifiedColumns[
'yellowlicense'])[0];
834 $isEnabled = array_values($unifiedColumns[
'yellowlicense'])[0];
837 $yellowLicense = array(
"color" => array(
"bgColor" =>
"FEFF99"),
"riskLevel" => array(
"3",
"2"));
838 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $yellowLicense, $titleSubHeadingLicense);
841 $heading = array_keys($unifiedColumns[
'whitelicense'])[0];
842 $isEnabled = array_values($unifiedColumns[
'whitelicense'])[0];
845 $whiteLicense = array(
"color" => array(
"bgColor" =>
"FFFFFF"),
"riskLevel" => array(
"",
"0",
"1"));
846 $this->
licensesTable($section, $heading, $contents[
'licenses'][
'statements'], $whiteLicense, $titleSubHeadingLicense);
849 $heading = array_keys($unifiedColumns[
'overviewwithwithoutobligations'])[0];
850 $isEnabled = array_values($unifiedColumns[
'overviewwithwithoutobligations'])[0];
852 $titleSubHeadingObli =
"(License ShortName, Obligation)";
853 $reportStaticSection->allLicensesWithAndWithoutObligations($section, $heading, $obligations, $whiteLists, $titleSubHeadingObli);
856 $heading = array_keys($unifiedColumns[
'copyrights'])[0];
857 $isEnabled = array_values($unifiedColumns[
'copyrights'])[0];
860 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'copyrights'][
'scannerFindings'], $titleSubHeadingCEI);
863 $heading = array_keys($unifiedColumns[
'copyrightsuf'])[0];
864 $isEnabled = array_values($unifiedColumns[
'copyrightsuf'])[0];
867 $this->
getRowsAndColumnsForCEI($section, $heading, $contents[
'copyrights'][
'userFindings'], $titleSubHeadingCEI);
870 $heading = array_keys($unifiedColumns[
'bulkfindings'])[0];
871 $isEnabled = array_values($unifiedColumns[
'bulkfindings'])[0];
874 $this->
bulkLicenseTable($section, $heading, $contents[
'bulkLicenses'][
'statements'], $titleSubHeadingLicense);
877 $heading = array_keys($unifiedColumns[
'licensenf'])[0];
878 $isEnabled = array_values($unifiedColumns[
'licensenf'])[0];
881 $reportStaticSection->getNonFunctionalLicenses($section, $heading);
884 $heading = array_keys($unifiedColumns[
'irrelevantfiles'])[0];
885 $isEnabled = array_values($unifiedColumns[
'irrelevantfiles'])[0];
888 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
892 $subHeading =
"Comment for Irrelevant files";
893 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
894 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
895 $this->
bulkLicenseTable($section,
"", $contents[
'licensesIrreComment'][
'statements'], $titleSubHeadingNotes);
898 $heading = array_keys($unifiedColumns[
'dnufiles'])[0];
899 $isEnabled = array_values($unifiedColumns[
'dnufiles'])[0];
902 if ($contents[
'otherStatement'][
'includeDNU']) {
904 $columnStyleWithUnderline = array(
"size" => 11,
"color" =>
"0000A0",
'underline' =>
'single');
905 $section->addBookmark(
'DNUBookmark');
906 $bookMarkCell->addLink(
'DNUBookmark', htmlspecialchars(
' NOTE: DO NOT USE files found! Please check Do not use files section', ENT_COMPAT,
'UTF-8'), $columnStyleWithUnderline,
"pStyle",
true);
908 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
912 $subHeading =
"Comment for Do not use files";
913 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
914 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
915 $this->
bulkLicenseTable($section,
"", $contents[
'licensesDNUComment'][
'statements'], $titleSubHeadingNotes);
919 $heading =
"Non functional Files";
920 if ($contents[
'otherStatement'][
'includeNonFunctional']) {
922 $columnStyleWithUnderline = array(
"size" => 11,
"color" =>
"0000A0",
'underline' =>
'single');
923 $section->addBookmark(
'nonFunctionalBookmark');
924 $bookMarkCell->addLink(
'nonFunctionalBookmark', htmlspecialchars(
' NOTE: Non functional files found! Please check Non functional files section', ENT_COMPAT,
'UTF-8'), $columnStyleWithUnderline,
"pStyle",
true);
926 $titleSubHeadingIrre =
"(Path, Files, Licenses)";
927 $this->
getRowsAndColumnsForIrre($section, $heading, $contents[
'licensesNonFunctional'][
'statements'], $titleSubHeadingIrre);
930 $subHeading =
"Comment for Non functional files";
931 $section->addTitle(htmlspecialchars(
"$subHeading"), 3);
932 $titleSubHeadingNotes =
"(License name, Comment Entered, File path)";
933 $this->
bulkLicenseTable($section,
"", $contents[
'licensesNonFunctionalComment'][
'statements'], $titleSubHeadingNotes);
935 $heading = array_keys($unifiedColumns[
'changelog'])[0];
936 $isEnabled = array_values($unifiedColumns[
'changelog'])[0];
939 $reportStaticSection->clearingProtocolChangeLogTable($section, $heading);
943 $reportStaticSection->reportFooter($phpWord, $section, $contents[
'otherStatement']);
945 $fileBase = $SysConf[
"FOSSOLOGY"][
"path"].
"/report/";
946 if (!is_dir($fileBase)) {
947 mkdir($fileBase, 0777,
true);
950 $fileName = $fileBase.
"$packageName".
"_clearing_report_".date(
"D_M_d_m_Y_h_i_s").
".docx";
951 $objWriter = IOFactory::createWriter($phpWord,
"Word2007");
952 $objWriter->save($fileName);
966 $this->
dbManager->getSingleRow(
"INSERT INTO reportgen(upload_fk, job_fk, filepath) VALUES($1,$2,$3)",
967 array($uploadId,
$jobId, $filename), __METHOD__);
972 $agent->scheduler_connect();
973 $agent->run_scheduler_event_loop();
974 $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