FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ThirdPartyLicensesPage.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2020 Siemens AG
4  Author: Shaheem Azmal M MD
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\UI\Page;
10 
12 use Symfony\Component\HttpFoundation\Request;
13 use Symfony\Component\HttpFoundation\Response;
14 
19 {
20  const NAME = "thirdPartyLicenses-FOSSology";
21 
22  const FILENAME = "NOTICES-THIRDPARTY.html";
23 
24  public function __construct()
25  {
26  parent::__construct(self::NAME, array(
27  self::TITLE => "Third Party Licenses",
28  self::MENU_LIST => "Help::Third Party Licenses",
29  self::REQUIRES_LOGIN => false,
30  ));
31  }
32 
37  protected function handle(Request $request)
38  {
39  $htmlFileContents = "";
40  if (! file_exists(self::FILENAME)) {
41  $htmlFileContents = "Cannot find <b><u>". self::FILENAME ."</u></b> file";
42  } else {
43  $htmlFileContents = file_get_contents(self::FILENAME, true);
44  $htmlFileContents = "<div style='all:unset;'>".$htmlFileContents."</div>";
45  }
46  $vars = array(
47  'htmlFileContents' => $htmlFileContents
48  );
49  return $this->render('thirdPartyLicenses.html.twig', $this->mergeWithDefault($vars));
50  }
51 }
52 
53 register_plugin(new ThirdPartyLicensesPage());
render($templateName, $vars=null, $headers=null)