20 use \PhpOffice\PhpWord\Style;
38 "borderColor" =>
"000000",
50 public function __construct()
53 $this->uploadDao = $container->get(
'dao.upload');
63 if (!empty($licenses)) {
64 $licenses = array_unique(array_column($licenses,
'content'));
65 foreach ($licenses as $otherLicenses) {
66 $allOtherLicenses .= $otherLicenses.
", ";
68 $allOtherLicenses = rtrim($allOtherLicenses,
", ");
70 return $allOtherLicenses;
86 function summaryTable(Section $section, $uploadId, $userName, $mainLicenses, $licenses, $histLicenses, $otherStatement, $timestamp, $groupName, $packageUri)
88 $cellRowContinue = array(
"vMerge" =>
"continue");
89 $firstRowStyle = array(
"size" => 14,
"bold" =>
true);
90 $firstRowStyle1 = array(
"size" => 12,
"bold" =>
true);
92 $cellRowSpan = array(
"vMerge" =>
"restart",
"valign" =>
"top");
93 $cellColSpan = array(
"gridSpan" => 3,
"valign" =>
"center");
98 $cellSecondLen = 3800;
104 if (!empty($histLicenses)) {
105 foreach ($histLicenses as $histLicense) {
106 $allHistLicenses .= $histLicense[
"licenseShortname"].
", ";
108 $allHistLicenses = rtrim($allHistLicenses,
", ");
111 $newSw360Component = array();
112 $table = $section->addTable($this->tablestyle);
114 $table->addRow($rowWidth);
115 $table->addCell($cellFirstLen, $cellColSpan)->addText(htmlspecialchars(
" OSS Component Clearing report"),
116 $firstRowStyle,
"pStyle");
118 $table->addRow($rowWidth);
119 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" Clearing Information"), $firstRowStyle,
"pStyle");
120 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Department"), $firstRowStyle1,
"pStyle");
121 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_department']), null,
"pStyle");
123 $table->addRow($rowWidth);
124 $table->addCell($cellFirstLen, $cellRowContinue);
125 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Prepared by"), $firstRowStyle1,
"pStyle");
126 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
" " 127 .date(
"Y/m/d", $timestamp).
" ".$userName.
" (".$groupName.
") "), null,
"pStyle");
128 $table->addRow($rowWidth);
129 $table->addCell($cellFirstLen, $cellRowContinue);
130 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Reviewed by (opt.)"),$firstRowStyle1,
"pStyle");
131 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_reviewed']), null,
"pStyle");
133 $table->addRow($rowWidth);
134 $table->addCell($cellFirstLen, $cellRowContinue);
135 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Report release date"), $firstRowStyle1,
"pStyle");
136 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_report_rel']), null,
"pStyle");
138 $table->addRow($rowWidth);
139 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" Component Information"), $firstRowStyle,
"pStyle");
140 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Community"), $firstRowStyle1,
"pStyle");
141 if (!empty($newSw360Component[
"Community"])) {
142 $table->addCell($cellThirdLen)->addText(htmlspecialchars($newSw360Component[
"Community"]), null,
"pStyle");
144 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_community']), null,
"pStyle");
146 $table->addRow($rowWidth);
147 $table->addCell($cellFirstLen, $cellRowContinue);
148 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Component"), $firstRowStyle1,
"pStyle");
150 if (!empty($newSw360Component[
"Component"])) {
151 $table->addCell($cellThirdLen)->addText(htmlspecialchars($newSw360Component[
"Component"]), null,
"pStyle");
153 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_component']), null,
"pStyle");
155 $table->addRow($rowWidth);
156 $table->addCell($cellFirstLen, $cellRowContinue);
157 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Version"), $firstRowStyle1,
"pStyle");
159 if (!empty($newSw360Component[
"Version"])) {
160 $table->addCell($cellThirdLen)->addText(htmlspecialchars($newSw360Component[
"Version"]), null,
"pStyle");
162 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_version']), null,
"pStyle");
164 $table->addRow($rowWidth);
165 $table->addCell($cellFirstLen, $cellRowContinue);
166 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Component hash (SHA-1)"), $firstRowStyle1,
"pStyle");
168 $componentHash = $this->uploadDao->getUploadHashes($uploadId);
170 $table->addCell($cellThirdLen)->addText(htmlspecialchars($componentHash[
"sha1"]), null,
"pStyle");
172 $table->addRow($rowWidth);
173 $table->addCell($cellFirstLen, $cellRowContinue);
174 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Release date"), $firstRowStyle1,
"pStyle");
176 if (!empty($newSw360Component[
"Release date"])) {
177 $table->addCell($cellThirdLen)->addText(htmlspecialchars($newSw360Component[
"Release date"]), null,
"pStyle");
179 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_release_date']), null,
"pStyle");
182 $table->addRow($rowWidth);
183 $table->addCell($cellFirstLen, $cellRowContinue);
184 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
" Main license(s)"), $firstRowStyle1,
"pStyle");
185 if (!empty($allMainLicenses)) {
186 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"$allMainLicenses."), null,
"pStyle");
188 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"Main License(s) Not selected."), null,
"pStyle");
191 $table->addRow($rowWidth2);
192 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" "), $firstRowStyle,
"pStyle");
193 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
"Other license(s)"), $firstRowStyle1,
"pStyle");
194 if (!empty($allOtherLicenses)) {
195 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"$allOtherLicenses."), null,
"pStyle");
197 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"License(s) Not Identified."), null,
"pStyle");
200 $table->addRow($rowWidth2);
201 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" "), $firstRowStyle,
"pStyle");
202 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
"Fossology Upload/Package Link"), $firstRowStyle1,
"pStyle");
203 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
" ".$packageUri.
""), null,
"pStyle");
205 $table->addRow($rowWidth2);
206 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" "), $firstRowStyle,
"pStyle");
207 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
"SW360 Portal Link"), $firstRowStyle1,
"pStyle");
208 $table->addCell($cellThirdLen)->addText(htmlspecialchars($otherStatement[
'ri_sw360_link']), null,
"pStyle");
210 $table->addRow($rowWidth2);
211 $table->addCell($cellFirstLen, $cellRowSpan)->addText(htmlspecialchars(
" "), $firstRowStyle,
"pStyle");
212 $table->addCell($cellSecondLen)->addText(htmlspecialchars(
"Result of License Scan"), $firstRowStyle1,
"pStyle");
213 if (!empty($allHistLicenses)) {
214 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"$allHistLicenses."), null,
"pStyle");
216 $table->addCell($cellThirdLen)->addText(htmlspecialchars(
"No License found by the Scanner"), null,
"pStyle");
219 $section->addTextBreak();
220 $section->addTextBreak();
accumulateLicenses($licenses)
Remove the duplicate licenses.
summaryTable(Section $section, $uploadId, $userName, $mainLicenses, $licenses, $histLicenses, $otherStatement, $timestamp, $groupName, $packageUri)
Design the summaryTable of the report.